Re: [PATCH 1/1] KVM: arm64: PMU: Fix PMCR_EL0 reset value

From: Marc Zyngier
Date: Sat Dec 10 2022 - 06:20:22 EST


On Fri, 09 Dec 2022 17:58:31 +0000,
Oliver Upton <oliver.upton@xxxxxxxxx> wrote:
>
> On Fri, Dec 09, 2022 at 04:44:46PM +0000, James Clark wrote:
> > ARMV8_PMU_PMCR_N_MASK is an unshifted value which results in the wrong
> > reset value for PMCR_EL0, so shift it to fix it.
>
> That's just mean. *_MASK tends to be a shifted mask, although it would
> appear that asm/perf_event.h does not follow this convention. Fixing
> that would be nice (as I'm sure somebody else will get burned by this),
> but for the sake of an immediate fix:

Well, that'll teach me the usual lesson: last minute changes without
full non-regression testing are bound to end in disaster.

>
> > This fixes the following error when running qemu:
> >
> > $ qemu-system-aarch64 -cpu host -machine type=virt,accel=kvm -kernel ...
> >
> > target/arm/helper.c:1813: pmevcntr_rawwrite: Assertion `counter < pmu_num_counters(env)' failed.
> >
> > Fixes: 292e8f149476 ("KVM: arm64: PMU: Simplify PMCR_EL0 reset handling")
> > Signed-off-by: James Clark <james.clark@xxxxxxx>
>
> Reviewed-by: Oliver Upton <oliver.upton@xxxxxxxxx>

Thanks both. I'll queue that ASAP as a fix.

M.

--
Without deviation from the norm, progress is not possible.