Skip to content

Commit 2a71fab

Browse files
Alexandru EliseiMarc Zyngier
authored andcommitted
KVM: arm64: Don't zero the cycle count register when PMCR_EL0.P is set
According to ARM DDI 0487G.a, page D13-3895, setting the PMCR_EL0.P bit to 1 has the following effect: "Reset all event counters accessible in the current Exception level, not including PMCCNTR_EL0, to zero." Similar behaviour is described for AArch32 on page G8-7022. Make it so. Fixes: c01d6a1 ("KVM: arm64: pmu: Only handle supported event counters") Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20210618105139.83795-1-alexandru.elisei@arm.com
1 parent 8124c8a commit 2a71fab

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

arch/arm64/kvm/pmu-emul.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ void kvm_pmu_handle_pmcr(struct kvm_vcpu *vcpu, u64 val)
578578
kvm_pmu_set_counter_value(vcpu, ARMV8_PMU_CYCLE_IDX, 0);
579579

580580
if (val & ARMV8_PMU_PMCR_P) {
581+
mask &= ~BIT(ARMV8_PMU_CYCLE_IDX);
581582
for_each_set_bit(i, &mask, 32)
582583
kvm_pmu_set_counter_value(vcpu, i, 0);
583584
}

0 commit comments

Comments
 (0)