Skip to content

Commit 6605694

Browse files
H. Peter Anvin (Intel)Ingo Molnar
authored andcommitted
x86/cpufeature: Add the CPU feature bit for LKGS
Add the CPU feature bit for LKGS (Load "Kernel" GS). LKGS instruction is introduced with Intel FRED (flexible return and event delivery) specification. Search for the latest FRED spec in most search engines with this search pattern: site:intel.com FRED (flexible return and event delivery) specification LKGS behaves like the MOV to GS instruction except that it loads the base address into the IA32_KERNEL_GS_BASE MSR instead of the GS segment’s descriptor cache, which is exactly what Linux kernel does to load a user level GS base. Thus, with LKGS, there is no need to SWAPGS away from the kernel GS base. [ mingo: Minor tweaks to the description. ] Signed-off-by: H. Peter Anvin (Intel) <[email protected]> Signed-off-by: Xin Li <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0125acd commit 6605694

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@
312312
#define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */
313313
#define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512 BFLOAT16 instructions */
314314
#define X86_FEATURE_CMPCCXADD (12*32+ 7) /* "" CMPccXADD instructions */
315+
#define X86_FEATURE_LKGS (12*32+18) /* "" Load "kernel" (userspace) GS */
315316
#define X86_FEATURE_AMX_FP16 (12*32+21) /* "" AMX fp16 Support */
316317
#define X86_FEATURE_AVX_IFMA (12*32+23) /* "" Support for VPMADD52[H,L]UQ */
317318

tools/arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@
312312
#define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */
313313
#define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512 BFLOAT16 instructions */
314314
#define X86_FEATURE_CMPCCXADD (12*32+ 7) /* "" CMPccXADD instructions */
315+
#define X86_FEATURE_LKGS (12*32+18) /* "" Load "kernel" (userspace) GS */
315316
#define X86_FEATURE_AMX_FP16 (12*32+21) /* "" AMX fp16 Support */
316317
#define X86_FEATURE_AVX_IFMA (12*32+23) /* "" Support for VPMADD52[H,L]UQ */
317318

0 commit comments

Comments
 (0)