Re: [PATCH v4 1/9] x86/asm: add iosubmit_cmds512() based on MOVDIR64B CPU instruction
From: Borislav Petkov
Date: Mon Jan 13 2020 - 05:14:15 EST
On Tue, Jan 07, 2020 at 01:40:58PM -0700, Dave Jiang wrote:
> With the introduction of MOVDIR64B instruction, there is now an instruction
> that can write 64 bytes of data atomically.
>
> Quoting from Intel SDM:
> "There is no atomicity guarantee provided for the 64-byte load operation
> from source address, and processor implementations may use multiple
> load operations to read the 64-bytes. The 64-byte direct-store issued
> by MOVDIR64B guarantees 64-byte write-completion atomicity. This means
> that the data arrives at the destination in a single undivided 64-byte
> write transaction."
>
> We have identified at least 3 different use cases for this instruction in
> the format of func(dst, src, count):
> 1) Clear poison / Initialize MKTME memory
> @dst is normal memory.
> @src in normal memory. Does not increment. (Copy same line to all
> targets)
> @count (to clear/init multiple lines)
> 2) Submit command(s) to new devices
> @dst is a special MMIO region for a device. Does not increment.
> @src is normal memory. Increments.
> @count usually is 1, but can be multiple.
> 3) Copy to iomem in big chunks
> @dst is iomem and increments
> @src in normal memory and increments
> @count is number of chunks to copy
>
> Add support for case #2 to support device that will accept commands via
> this instruction. We provide a @count in order to submit a batch of
> preprogrammed descriptors in virtually contiguous memory. This
> allows the caller to submit multiple descriptors to a devices with a single
"to a device"
> submission. The special device requires the entire 64bytes descriptor to
> be written atomically and will accept MOVDIR64B instruction.
>
> Signed-off-by: Dave Jiang <dave.jiang@xxxxxxxxx>
but the above can be fixed by whoever applies this.
Acked-by: Borislav Petkov <bp@xxxxxxx>
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette