target/arm: Support 64-bit event counters for FEAT_PMUv3p5
commit47b385dae8e95e833114285625f4db796c52e8a3
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 22 Aug 2022 13:23:57 +0000 (22 14:23 +0100)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 14 Sep 2022 10:19:40 +0000 (14 11:19 +0100)
tree503fa8c3a9b3158ccb196d8bd35f3a2bdde8f88c
parent0b42f4fab9d3e994efa44e17cb76c15b269bcbda
target/arm: Support 64-bit event counters for FEAT_PMUv3p5

With FEAT_PMUv3p5, the event counters are now 64 bit, rather than 32
bit.  (Previously, only the cycle counter could be 64 bit, and other
event counters were always 32 bits).  For any given event counter,
whether the overflow event is noted for overflow from bit 31 or from
bit 63 is controlled by a combination of PMCR.LP, MDCR_EL2.HLP and
MDCR_EL2.HPMN.

Implement the 64-bit event counter handling.  We choose to make our
counters always 64 bits, and mask out the top 32 bits on read or
write of PMXEVCNTR for CPUs which don't have FEAT_PMUv3p5.

(Note that the changes to pmenvcntr_op_start() and
pmenvcntr_op_finish() bring their logic closer into line with that of
pmccntr_op_start() and pmccntr_op_finish(), which already had to cope
with the overflow being either at 32 or 64 bits.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220822132358.3524971-10-peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
target/arm/cpu.h
target/arm/helper.c
target/arm/internals.h