Skip to content

Commit cd84a42

Browse files
author
Marc Zyngier
committed
KVM: arm64: Don't let userspace write to PMCR_EL0.N when the vcpu has EL2
Now that userspace can provide its limit for hte maximum number of counters, prevent it from writing to PMCR_EL0.N, as the value should be derived from MDCR_EL2.HPMN in that case. Reviewed-by: Oliver Upton <oliver.upton@linux.dev> Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent b7628c7 commit cd84a42

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,6 +1216,7 @@ static int set_pmcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r,
12161216
* with the existing KVM behavior.
12171217
*/
12181218
if (!kvm_vm_has_ran_once(kvm) &&
1219+
!vcpu_has_nv(vcpu) &&
12191220
new_n <= kvm_arm_pmu_get_max_counters(kvm))
12201221
kvm->arch.nr_pmu_counters = new_n;
12211222

0 commit comments

Comments
 (0)