>From 8dd4327a3e30ce73753e818377c6b47a16e48467 Mon Sep 17 00:00:00 2001 From: Sean Christopherson Date: Fri, 28 Feb 2025 10:09:48 -0800 Subject: [PATCH 3/4] KVM: SVM: Ignore sev_platform_init() return code when creating SNP VM Ignore errors from sev_platform_init() when creating SNP VMs, as SNP initialization can succeed even if SEV/SEV-ES initialization fails. Fixes: 1dfe571c12cf ("KVM: SEV: Add initial SEV-SNP support") Signed-off-by: Sean Christopherson --- arch/x86/kvm/svm/sev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index dd001a293899..354f6c32c435 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -443,8 +443,15 @@ static int __sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp, goto e_no_asid; init_args.probe = false; + /* + * Initialize SEV/SEV-ES if neccessary, i.e. if the CCP driver was + * configured to defer setup. + * Ignore failure for SNP VMs, as SNP initialization can succeed even + * if SEV/SEV-ES initialization fails (and vice versa). SNP support is + * communicated via an out param, and is checked below. + */ ret = sev_platform_init(&init_args); - if (ret) + if (ret && vm_type != KVM_X86_SNP_VM) goto e_free; /* This needs to happen after SEV/SNP firmware initialization. */ -- 2.48.1.711.g2feabab25a-goog