[PATCH v2 4/5] KVM: SEV: mask off firmware unsupported vm types

Tycho Andersen posted 5 patches 1 week, 2 days ago
[PATCH v2 4/5] KVM: SEV: mask off firmware unsupported vm types
Posted by Tycho Andersen 1 week, 2 days ago
From: "Tycho Andersen (AMD)" <tycho@kernel.org>

In some configurations not all VM types are supported by the firmware.
Reflect this information in the supported_vm_types that KVM exports.

Link: https://lore.kernel.org/all/aZyLIWtffvEnmtYh@google.com/
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>
---
 arch/x86/kvm/svm/sev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index 37490803f2e8..0fe9515db1e7 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -2976,7 +2976,8 @@ void __init sev_set_cpu_caps(void)
 		supported_vm_types |= BIT(KVM_X86_SNP_VM);
 	}
 
-	kvm_caps.supported_vm_types |= supported_vm_types;
+	kvm_caps.supported_vm_types |= (supported_vm_types &
+					sev_firmware_supported_vm_types());
 }
 
 static bool is_sev_snp_initialized(void)
-- 
2.53.0