[PATCH 3/4] KVM: SVM: Ignore sev_platform_init() return code when creating SNP VM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <seanjc@xxxxxxxxxx>
---
 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


--ZxKkPI+e2NE34Qwk
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
	filename="0004-KVM-SVM-Add-support-to-initialize-SEV-SNP-functional.patch"


[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux