Skip to contentSkip to conversation

KVM: x86: Advertise SUCCOR and OVERFLOW_RECOV cpuid bits

PATCH In review John Allen 2 participants 2 messages Jul 31, 2024 – Aug 15, 2024

Subsystems (3)
lore
Share & tools
lore

John Allen

author
#0 lore raw

PATCH v2 1/1 KVM: x86: Advertise SUCCOR and OVERFLOW_RECOV cpuid bits

Handling deferred, uncorrected MCEs on AMD guests is now possible with additional support in qemu. Ensure that the SUCCOR and OVERFLOW_RECOV bits are advertised to the guest in KVM.

---
v2:
- Add cpuid_entry_override for CPUID_8000_0007_EBX.
- Handle masking bits in arch/x86/kvm/cpuid.c

---
 arch/x86/kvm/cpuid.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/kvm/cpuid.c +7 -1
index 2617be544480..f8e1fd409cee 100644
@@ -743,6 +743,11 @@ void kvm_set_cpu_caps(void)
 	if (!tdp_enabled && IS_ENABLED(CONFIG_X86_64))
 		kvm_cpu_cap_set(X86_FEATURE_GBPAGES);
 
+	kvm_cpu_cap_mask(CPUID_8000_0007_EBX,
+		F(OVERFLOW_RECOV) |
+		F(SUCCOR)
+	);
+
 	kvm_cpu_cap_init_kvm_defined(CPUID_8000_0007_EDX,
 		SF(CONSTANT_TSC)
 	);
@@ -1237,11 +1242,12 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
 		entry->edx &= ~GENMASK(17, 16);
 		break;
 	case 0x80000007: /* Advanced power management */
+		cpuid_entry_override(entry, CPUID_8000_0007_EBX);
 		cpuid_entry_override(entry, CPUID_8000_0007_EDX);
 
 		/* mask against host */
 		entry->edx &= boot_cpu_data.x86_power;
-		entry->eax = entry->ebx = entry->ecx = 0;
+		entry->eax = entry->ecx = 0;
 		break;
 	case 0x80000008: {
 		/*
Signature · 1 line
2.34.1
#1 lore raw

s/cpuid/CPUID

Quoted 3 lines · John Allen

Handling deferred, uncorrected MCEs on AMD guests is now possible with additional support in qemu. Ensure that the SUCCOR and OVERFLOW_RECOV bits are advertised to the guest in KVM.

To host userspace, not the guest.

Please add a paragraph explaining (a) what these features do, (b) why KVM doesn't need additional enabling, and (c) why KVM can't emulate these features in software (though this can be omitted if it's quite obvious from (a)).