]> xenbits.xensource.com Git - people/pauldu/linux.git/commitdiff
KVM: arm64: Hoist NV+SVE check into KVM_ARM_VCPU_INIT ioctl handler
authorOliver Upton <oliver.upton@linux.dev>
Wed, 20 Sep 2023 19:50:34 +0000 (19:50 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Thu, 21 Sep 2023 18:13:29 +0000 (18:13 +0000)
Move the feature check out of kvm_reset_vcpu() so we can make the
function succeed uncondtitionally.

Link: https://lore.kernel.org/r/20230920195036.1169791-7-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/arm.c
arch/arm64/kvm/reset.c

index a791809fb1a1044e22c16208b52f0f3b9d10a02d..995d7d9053009dc4d976c7a8ceef8dc8ce126027 100644 (file)
@@ -1239,6 +1239,11 @@ static int kvm_vcpu_init_check_features(struct kvm_vcpu *vcpu,
            test_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, &features))
                return -EINVAL;
 
+       /* Disallow NV+SVE for the time being */
+       if (test_bit(KVM_ARM_VCPU_HAS_EL2, &features) &&
+           test_bit(KVM_ARM_VCPU_SVE, &features))
+               return -EINVAL;
+
        if (!test_bit(KVM_ARM_VCPU_EL1_32BIT, &features))
                return 0;
 
index bbcf5bbd66d94c167bb4c0fee55bfd2cd24dfa38..edffbfab5e7b33ad8085654248820276d05562d1 100644 (file)
@@ -208,12 +208,6 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
        if (loaded)
                kvm_arch_vcpu_put(vcpu);
 
-       /* Disallow NV+SVE for the time being */
-       if (vcpu_has_nv(vcpu) && vcpu_has_feature(vcpu, KVM_ARM_VCPU_SVE)) {
-               ret = -EINVAL;
-               goto out;
-       }
-
        if (!kvm_arm_vcpu_sve_finalized(vcpu)) {
                if (test_bit(KVM_ARM_VCPU_SVE, vcpu->arch.features))
                        kvm_vcpu_enable_sve(vcpu);
@@ -267,7 +261,7 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
 
        /* Reset timer */
        ret = kvm_timer_vcpu_reset(vcpu);
-out:
+
        if (loaded)
                kvm_arch_vcpu_load(vcpu, smp_processor_id());
        preempt_enable();