Skip to content

Commit d99fb82

Browse files
committed
KVM: arm64: Hoist NV+SVE check into KVM_ARM_VCPU_INIT ioctl handler
Move the feature check out of kvm_reset_vcpu() so we can make the function succeed uncondtitionally. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 12405b0 commit d99fb82

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

arch/arm64/kvm/arm.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,11 @@ static int kvm_vcpu_init_check_features(struct kvm_vcpu *vcpu,
12391239
test_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, &features))
12401240
return -EINVAL;
12411241

1242+
/* Disallow NV+SVE for the time being */
1243+
if (test_bit(KVM_ARM_VCPU_HAS_EL2, &features) &&
1244+
test_bit(KVM_ARM_VCPU_SVE, &features))
1245+
return -EINVAL;
1246+
12421247
if (!test_bit(KVM_ARM_VCPU_EL1_32BIT, &features))
12431248
return 0;
12441249

arch/arm64/kvm/reset.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,6 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
208208
if (loaded)
209209
kvm_arch_vcpu_put(vcpu);
210210

211-
/* Disallow NV+SVE for the time being */
212-
if (vcpu_has_nv(vcpu) && vcpu_has_feature(vcpu, KVM_ARM_VCPU_SVE)) {
213-
ret = -EINVAL;
214-
goto out;
215-
}
216-
217211
if (!kvm_arm_vcpu_sve_finalized(vcpu)) {
218212
if (test_bit(KVM_ARM_VCPU_SVE, vcpu->arch.features))
219213
kvm_vcpu_enable_sve(vcpu);
@@ -267,7 +261,7 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
267261

268262
/* Reset timer */
269263
ret = kvm_timer_vcpu_reset(vcpu);
270-
out:
264+
271265
if (loaded)
272266
kvm_arch_vcpu_load(vcpu, smp_processor_id());
273267
preempt_enable();

0 commit comments

Comments
 (0)