x86/asm: Add support for MOVDIR64B instruction
PATCH 1/1 x86/asm: Add support for MOVDIR64B instruction
Add support for a new instruction MOVDIR64B. The instruction moves 64-bytes as direct-store with 64-byte write atomicity from source memory address to destination memory address.
MOVDIR64B requires the destination address to be 64-byte aligned. No alignment restriction is enforced for source operand.
See Intel Software Developer’s Manual for more information on the instruction.
---
Several upcoming patchsets will make use of the helper.
--- arch/x86/include/asm/special_insns.h | 7 +++++++ 1 file changed, 7 insertions(+)
arch/x86/include/asm/special_insns.h +7 -0
@@ -248,6 +248,13 @@ static inline void clwb(volatile void *__p)#define nop () asm volatile ("nop") +static inline void movdir64b (void *dst,const void *src) +{ +/* movdir64b [rdx], rax */ + asmvolatile (".byte 0x66, 0x0f, 0x38, 0xf8, 0x02" + :"=m" (*(char *)dst) + :"d" (src),"a" (dst)); +}#endif /* __KERNEL__ */
Signature · 1 line
2.21.0
Quoted 11 lines · Kirill A. Shutemov
Add support for a new instruction MOVDIR64B. The instruction moves 64-bytes as direct-store with 64-byte write atomicity from source memory address to destination memory address.
MOVDIR64B requires the destination address to be 64-byte aligned. No alignment restriction is enforced for source operand.
See Intel Software Developer’s Manual for more information on the instruction.
Signed-off-by Kirill A. Shutemov <[email protected]>
Quoted 26 lines
---
Several upcoming patchsets will make use of the helper.
--- arch/x86/include/asm/special_insns.h | 7 +++++++ 1 file changed, 7 insertions(+)arch/x86/include/asm/special_insns.h +7
-0@@ -248,6 +248,13 @@ static inline void clwb(volatile void *__p)#define nop () asm volatile ("nop") +static inline void movdir64b (void *dst,const void *src) +{ +/* movdir64b [rdx], rax */ + asmvolatile (".byte 0x66, 0x0f, 0x38, 0xf8, 0x02" + :"=m" (*(char *)dst) + :"d" (src),"a" (dst)); +}#endif /* __KERNEL__ */
Borislav Petkov
maintainerQuoted 7 lines · Kirill A. Shutemov
Add support for a new instruction MOVDIR64B. The instruction moves 64-bytes as direct-store with 64-byte write atomicity from source memory address to destination memory address.
MOVDIR64B requires the destination address to be 64-byte aligned. No alignment restriction is enforced for source operand.
Quoted 7 lines
See Intel Software Developer’s Manual for more information on the instruction.
Signed-off-by Kirill A. Shutemov <[email protected]>---
Several upcoming patchsets will make use of the helper.
... so why aren't you sending it together with its first user?
Signature · 5 lines
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--Quoted 11 lines · Borislav Petkov
Quoted 10 lines · Kirill A. Shutemov
Add support for a new instruction MOVDIR64B. The instruction moves 64-bytes as direct-store with 64-byte write atomicity from source memory address to destination memory address.
MOVDIR64B requires the destination address to be 64-byte aligned. No alignment restriction is enforced for source operand.
See Intel Software Developer’s Manual for more information on the instruction.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Kirill A. Shutemov <[email protected]>---
Several upcoming patchsets will make use of the helper.
... so why aren't you sending it together with its first user?
We are not yet sure which patchset will hit upstream first. I thought it would be logistically easier to get the patch upstream on its own.
But if you prefer the patch to be submitted along with the first user, we can definately do this.
Jing, are you okay with this?
Signature · 1 line
Kirill A. Shutemov
Quoted 4 lines · Borislav Petkov
Quoted 1 line · Kirill A. Shutemov
Several upcoming patchsets will make use of the helper.
... so why aren't you sending it together with its first user?
Just to get another of the non-controversial bits out of the way before the main course arrives.
Note that the CPUFEATURE bit for MOVDIR64B already went upstream in v4.20:
ace6485a0326 ("x86/cpufeatures: Enumerate MOVDIR64B instruction")
-Tony
Borislav Petkov
maintainerQuoted 2 lines · Tony
Just to get another of the non-controversial bits out of the way before the main course arrives.
Let's submit functions together with their respective users pls. Like we always do.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.