Skip to contentSkip to conversation

KVM: VMX: Also clear SGX EDECCSSA in KVM CPU caps when SGX is disabled

PATCH Applied Kai Huang 2 participants 2 messages Sep 5, 2024 – Sep 10, 2024

Subsystems (3)
lore
Share & tools
lore

Kai Huang

author
#0 lore raw

PATCH 1/1 KVM: VMX: Also clear SGX EDECCSSA in KVM CPU caps when SGX is disabled

When SGX EDECCSSA support was added to KVM in commit 16a7fe3728a8 ("KVM/VMX: Allow exposing EDECCSSA user leaf function to KVM guest"), it forgot to clear the X86_FEATURE_SGX_EDECCSSA bit in KVM CPU caps when KVM SGX is disabled. Fix it.

Fixes 16a7fe3728a8 ("KVM/VMX: Allow exposing EDECCSSA user leaf function to KVM guest")
---
 arch/x86/kvm/vmx/vmx.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kvm/vmx/vmx.c +1 -0
index 594db9afbc0f..98d737e0d416 100644
@@ -7963,6 +7963,7 @@ static __init void vmx_set_cpu_caps(void)
 		kvm_cpu_cap_clear(X86_FEATURE_SGX_LC);
 		kvm_cpu_cap_clear(X86_FEATURE_SGX1);
 		kvm_cpu_cap_clear(X86_FEATURE_SGX2);
+		kvm_cpu_cap_clear(X86_FEATURE_SGX_EDECCSSA);
 	}
 
 	if (vmx_umip_emulated())

base-commit: 44518120c4ca569cfb9c6199e94c312458dc1c07

Signature · 1 line
2.46.0
maintainer Applied
#1 lore raw
Quoted 4 lines · Kai Huang

When SGX EDECCSSA support was added to KVM in commit 16a7fe3728a8 ("KVM/VMX: Allow exposing EDECCSSA user leaf function to KVM guest"), it forgot to clear the X86_FEATURE_SGX_EDECCSSA bit in KVM CPU caps when KVM SGX is disabled. Fix it.

Applied to kvm-x86 vmx. At some point, we should probably look at using the kernel's cpufeatures dependency chains, but that's no reason to hold this fix.

Thanks!

[1/1] KVM: VMX: Also clear SGX EDECCSSA in KVM CPU caps when SGX is disabled

      https://github.com/kvm-x86/linux/commit/7efb4d8a392a

--
https://github.com/kvm-x86/linux/tree/next