From: Paolo Bonzini Date: Mon, 18 Mar 2024 23:03:26 +0000 (-0400) Subject: Merge tag 'kvm-x86-svm-6.9' of https://github.com/kvm-x86/linux into HEAD X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1d55934ed584861d06efc8c61a77e9cbe287e7a2;p=linux.git Merge tag 'kvm-x86-svm-6.9' of https://github.com/kvm-x86/linux into HEAD KVM SVM changes for 6.9: - Add support for systems that are configured with SEV and SEV-ES+ enabled, but have all ASIDs assigned to SEV-ES+ guests, which effectively makes SEV unusuable. Cleanup ASID handling to make supporting this scenario less brittle/ugly. - Return -EINVAL instead of -EBUSY if userspace attempts to invoke KVM_SEV{,ES}_INIT on an SEV+ guest. The operation is simply invalid, and not related to resource contention in any way. --- 1d55934ed584861d06efc8c61a77e9cbe287e7a2 diff --cc arch/x86/kvm/svm/sev.c index ae0ac12382b92,f06f9e51ad9db..e5a4d9b0e79fd --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@@ -246,8 -254,7 +254,8 @@@ static void sev_unbind_asid(struct kvm static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp) { struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info; + struct sev_platform_init_args init_args = {0}; - int asid, ret; + int ret; if (kvm->created_vcpus) return -EINVAL; @@@ -258,13 -264,11 +265,12 @@@ sev->active = true; sev->es_active = argp->id == KVM_SEV_ES_INIT; - asid = sev_asid_new(sev); - if (asid < 0) + ret = sev_asid_new(sev); + if (ret) goto e_no_asid; - sev->asid = asid; - ret = sev_platform_init(&argp->error); + init_args.probe = false; + ret = sev_platform_init(&init_args); if (ret) goto e_free;