Skip to content

Commit e88cfd5

Browse files
xinli-intelsean-jc
authored andcommitted
KVM: x86: Advertise support for LKGS
Advertise support for LKGS (load into IA32_KERNEL_GS_BASE) to userspace if the instruction is supported by the underlying CPU. LKGS is introduced with FRED to completely eliminate the need to swapgs explicilty. It 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 there is no need to SWAPGS away from the kernel GS base. LKGS is an independent CPU feature that works correctly in a KVM guest without requiring explicit enablement. Signed-off-by: Xin Li (Intel) <xin@zytor.com> Link: https://lore.kernel.org/r/20250626173521.2301088-1-xin@zytor.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent e1ef1c5 commit e88cfd5

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

arch/x86/kvm/cpuid.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,7 @@ void kvm_set_cpu_caps(void)
979979
F(FSRS),
980980
F(FSRC),
981981
F(WRMSRNS),
982+
X86_64_F(LKGS),
982983
F(AMX_FP16),
983984
F(AVX_IFMA),
984985
F(LAM),

0 commit comments

Comments
 (0)