target/arm: Make number of counters in PMCR follow the CPU
commitf7fb73b8cdd3f77e26f9fcff8cf24ff1b58d200f
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 30 Mar 2021 13:05:33 +0000 (30 14:05 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 30 Mar 2021 13:05:33 +0000 (30 14:05 +0100)
tree4871056b9e8f1f77600012dc197a3fad6cd5d91a
parent6c1bd93954cbdd70d8bdcd67b1f01d759747d895
target/arm: Make number of counters in PMCR follow the CPU

Currently we give all the v7-and-up CPUs a PMU with 4 counters.  This
means that we don't provide the 6 counters that are required by the
Arm BSA (Base System Architecture) specification if the CPU supports
the Virtualization extensions.

Instead of having a single PMCR_NUM_COUNTERS, make each CPU type
specify the PMCR reset value (obtained from the appropriate TRM), and
use the 'N' field of that value to define the number of counters
provided.

This means that we now supply 6 counters for Cortex-A53, A57, A72,
A15 and A9 as well as '-cpu max'; Cortex-A7 and A8 stay at 4; and
Cortex-R5 goes down to 3.

Note that because we now use the PMCR reset value of the specific
implementation, we no longer set the LC bit out of reset.  This has
an UNKNOWN value out of reset for all cores with any AArch32 support,
so guest software should be setting it anyway if it wants it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Message-id: 20210311165947.27470-1-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
target/arm/cpu.h
target/arm/cpu64.c
target/arm/cpu_tcg.c
target/arm/helper.c
target/arm/kvm64.c