Skip to contentSkip to conversation

KVM: x86: Sort CPUID_8000_0021_EAX leaf bits properly

PATCH Applied Borislav Petkov 3 participants 4 messages Mar 24, 2025 – Apr 25, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: x86: Sort CPUID_8000_0021_EAX leaf bits properly

From: "Borislav Petkov (AMD)" <[email protected]>

WRMSR_XX_BASE_NS is bit 1 so put it there, add some new bits as comments only.

---
 arch/x86/kvm/cpuid.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/kvm/cpuid.c +6 -1
index 121edf1f2a79..e98ab18f784b 100644
@@ -1160,6 +1160,7 @@ void kvm_set_cpu_caps(void)
 
 	kvm_cpu_cap_init(CPUID_8000_0021_EAX,
 		F(NO_NESTED_DATA_BP),
+		F(WRMSR_XX_BASE_NS),
 		/*
 		 * Synthesize "LFENCE is serializing" into the AMD-defined entry
 		 * in KVM's supported CPUID, i.e. if the feature is reported as
@@ -1173,10 +1174,14 @@ void kvm_set_cpu_caps(void)
 		SYNTHESIZED_F(LFENCE_RDTSC),
 		/* SmmPgCfgLock */
 		F(NULL_SEL_CLR_BASE),
+		/* UpperAddressIgnore */
 		F(AUTOIBRS),
 		EMULATED_F(NO_SMM_CTL_MSR),
+		/* FSRS */
+		/* FSRC */
 		/* PrefetchCtlMsr */
-		F(WRMSR_XX_BASE_NS),
+		/* GpOnUserCpuid */
+		/* EPSF */
 		SYNTHESIZED_F(SBPB),
 		SYNTHESIZED_F(IBPB_BRTYPE),
 		SYNTHESIZED_F(SRSO_NO),
Signature · 1 line
2.43.0
#1 lore raw
Quoted 23 lines · Borislav Petkov

From: "Borislav Petkov (AMD)" <[email protected]>

WRMSR_XX_BASE_NS is bit 1 so put it there, add some new bits as comments only.

---
 arch/x86/kvm/cpuid.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/kvm/cpuid.c +1 -0
index 121edf1f2a79..e98ab18f784b 100644
@@ -1160,6 +1160,7 @@ void kvm_set_cpu_caps(void)
 
 	kvm_cpu_cap_init(CPUID_8000_0021_EAX,
 		F(NO_NESTED_DATA_BP),
+		F(WRMSR_XX_BASE_NS),
 		/*
 		 * Synthesize "LFENCE is serializing" into the AMD-defined entry
 		 * in KVM's supported CPUID, i.e. if the feature is reported as

arch/x86/kvm/cpuid.c void kvm_set_cpu_caps(void) · line 1181

Quoted 8 lines
arch/x86/kvm/cpuid.c +3 -0
@@ -1173,10 +1174,14 @@ void kvm_set_cpu_caps(void)
 		SYNTHESIZED_F(LFENCE_RDTSC),
 		/* SmmPgCfgLock */
 		F(NULL_SEL_CLR_BASE),
+		/* UpperAddressIgnore */
 		F(AUTOIBRS),
 		EMULATED_F(NO_SMM_CTL_MSR),
+		/* FSRS */
+		/* FSRC */

I'm going to skip these, as they aren't yet publicly documented, and there are patches proposed to add actual support. I wouldn't care all that much if these didn't collide with Intel's version (the proposed patches name them AMD_FSxx).

https://lore.kernel.org/all/[email protected]

arch/x86/kvm/cpuid.c void kvm_set_cpu_caps(void) · line 1184

Quoted 4 lines
arch/x86/kvm/cpuid.c +2 -1
 		/* PrefetchCtlMsr */
-		F(WRMSR_XX_BASE_NS),
+		/* GpOnUserCpuid */
+		/* EPSF */

FWIW, this one's also not in the APM (though the only APM I can find is a year old), though it's in tools/x86/kcpuid.

Quoted 6 lines
arch/x86/kvm/cpuid.c +0 -0
 		SYNTHESIZED_F(SBPB),
 		SYNTHESIZED_F(IBPB_BRTYPE),
 		SYNTHESIZED_F(SRSO_NO),
Signature · 1 line
2.43.0
maintainer
#2 lore raw
Quoted 1 line · Sean Christopherson

I'm going to skip these, as they aren't yet publicly documented,

https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/programmer-references/57238.zip

Quoted 5 lines

and there are patches proposed to add actual support. I wouldn't care all that much if these didn't collide with Intel's version (the proposed patches name them AMD_FSxx).

https://lore.kernel.org/all/[email protected]

Pff, I think the right thing to do is to detect those and when set, set the Intel flags because they're basically the same.

Lemme go reply there.

... goes and replies...

Quoted 8 lines

arch/x86/kvm/cpuid.c void kvm_set_cpu_caps(void) · line 1184

Quoted 5 lines
arch/x86/kvm/cpuid.c +2 -1
 		/* PrefetchCtlMsr */
-		F(WRMSR_XX_BASE_NS),
+		/* GpOnUserCpuid */
+		/* EPSF */

FWIW, this one's also not in the APM (though the only APM I can find is a year old), though it's in tools/x86/kcpuid.

See above. Yeah, the PPRs have them earlier than the APM.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette