Merge tag 'kvm-x86-svm-6.9' of https://github.com/kvm-x86/linux into HEAD
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 18 Mar 2024 23:03:26 +0000 (19:03 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 18 Mar 2024 23:03:26 +0000 (19:03 -0400)
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.

1  2 
arch/x86/kvm/svm/sev.c
arch/x86/kvm/trace.h

index ae0ac12382b9278732fc89d4ef00a5f84866f8c0,f06f9e51ad9dba5da99896d6983dfed2c3fdd1bb..e5a4d9b0e79fd23e2dfc8224aa7a89d3b243c103
@@@ -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;
-       int asid, ret;
 +      struct sev_platform_init_args init_args = {0};
+       int ret;
  
        if (kvm->created_vcpus)
                return -EINVAL;
  
        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;
  
Simple merge