public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: KVM: Add feature flag for AMD's FsGsKernelGsBaseNonSerializing
@ 2023-10-04  0:20 Jim Mattson
  2023-10-04  0:57 ` Dave Hansen
  0 siblings, 1 reply; 16+ messages in thread
From: Jim Mattson @ 2023-10-04  0:20 UTC (permalink / raw)
  To: kvm, linux-kernel, Pawan Gupta, Jiaxi Chen, Kim Phillips,
	Paolo Bonzini, Sean Christopherson, H. Peter Anvin, x86,
	Dave Hansen, Borislav Petkov, Ingo Molnar, Thomas Gleixner
  Cc: Jim Mattson

Define an X86_FEATURE_* flag for
CPUID.80000021H:EAX.FsGsKernelGsBaseNonSerializing[bit 1], and
advertise the feature to userspace via KVM_GET_SUPPORTED_CPUID.

This feature is not yet documented in the APM. See AMD's "Processor
Programming Reference (PPR) for AMD Family 19h Model 61h, Revision B1
Processors (56713-B1-PUB)."

Signed-off-by: Jim Mattson <jmattson@google.com>
---
 arch/x86/include/asm/cpufeatures.h | 1 +
 arch/x86/kvm/cpuid.c               | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
index 58cb9495e40f..b53951c83d1d 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -443,6 +443,7 @@
 
 /* AMD-defined Extended Feature 2 EAX, CPUID level 0x80000021 (EAX), word 20 */
 #define X86_FEATURE_NO_NESTED_DATA_BP	(20*32+ 0) /* "" No Nested Data Breakpoints */
+#define X86_FEATURE_BASES_NON_SERIAL	(20*32+ 1) /* "" FSBASE, GSBASE, and KERNELGSBASE are non-serializing */
 #define X86_FEATURE_LFENCE_RDTSC	(20*32+ 2) /* "" LFENCE always serializing / synchronizes RDTSC */
 #define X86_FEATURE_NULL_SEL_CLR_BASE	(20*32+ 6) /* "" Null Selector Clears Base */
 #define X86_FEATURE_AUTOIBRS		(20*32+ 8) /* "" Automatic IBRS */
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 0544e30b4946..5e776e8619be 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -761,7 +761,8 @@ void kvm_set_cpu_caps(void)
 
 	kvm_cpu_cap_mask(CPUID_8000_0021_EAX,
 		F(NO_NESTED_DATA_BP) | F(LFENCE_RDTSC) | 0 /* SmmPgCfgLock */ |
-		F(NULL_SEL_CLR_BASE) | F(AUTOIBRS) | 0 /* PrefetchCtlMsr */
+		F(NULL_SEL_CLR_BASE) | F(AUTOIBRS) | 0 /* PrefetchCtlMsr */ |
+		F(BASES_NON_SERIAL)
 	);
 
 	if (cpu_feature_enabled(X86_FEATURE_SRSO_NO))
-- 
2.42.0.582.g8ccd20d70d-goog


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-10-05 17:52 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-04  0:20 [PATCH] x86: KVM: Add feature flag for AMD's FsGsKernelGsBaseNonSerializing Jim Mattson
2023-10-04  0:57 ` Dave Hansen
2023-10-04  2:44   ` Jim Mattson
2023-10-04  3:27     ` Dave Hansen
2023-10-04  4:24       ` Jim Mattson
2023-10-04  7:58     ` Borislav Petkov
2023-10-04 20:29       ` Jim Mattson
2023-10-05 16:22       ` Jim Mattson
2023-10-05 16:35         ` Dave Hansen
2023-10-05 16:41           ` Jim Mattson
2023-10-05 16:51             ` Paolo Bonzini
2023-10-05 17:52             ` Dave Hansen
2023-10-05 16:38       ` Paolo Bonzini
2023-10-05 17:06         ` Jim Mattson
2023-10-05 17:14           ` Paolo Bonzini
2023-10-05 17:27             ` Jim Mattson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox