Skip to content

Commit 9116db1

Browse files
committed
KVM: arm64: Hoist PMUv3 check into KVM_ARM_VCPU_INIT ioctl handler
Test that the system supports PMUv3 before ever getting to kvm_reset_vcpu(). Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent ef15090 commit 9116db1

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

arch/arm64/kvm/arm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,9 @@ static unsigned long system_supported_vcpu_features(void)
11971197
if (!cpus_have_final_cap(ARM64_HAS_32BIT_EL1))
11981198
clear_bit(KVM_ARM_VCPU_EL1_32BIT, &features);
11991199

1200+
if (!kvm_arm_support_pmu_v3())
1201+
clear_bit(KVM_ARM_VCPU_PMU_V3, &features);
1202+
12001203
return features;
12011204
}
12021205

arch/arm64/kvm/reset.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,6 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
255255
else
256256
pstate = VCPU_RESET_PSTATE_EL1;
257257

258-
if (kvm_vcpu_has_pmu(vcpu) && !kvm_arm_support_pmu_v3()) {
259-
ret = -EINVAL;
260-
goto out;
261-
}
262-
263258
/* Reset core registers */
264259
memset(vcpu_gp_regs(vcpu), 0, sizeof(*vcpu_gp_regs(vcpu)));
265260
memset(&vcpu->arch.ctxt.fp_regs, 0, sizeof(vcpu->arch.ctxt.fp_regs));

0 commit comments

Comments
 (0)