From f7fb73b8cdd3f77e26f9fcff8cf24ff1b58d200f Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 30 Mar 2021 14:05:33 +0100 Subject: 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 Tested-by: Marcin Juszkiewicz Message-id: 20210311165947.27470-1-peter.maydell@linaro.org Reviewed-by: Richard Henderson --- target/arm/kvm64.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'target/arm/kvm64.c') diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index dff85f6db9..581335e49d 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -566,6 +566,8 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) ARM64_SYS_REG(3, 0, 0, 7, 1)); err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64mmfr2, ARM64_SYS_REG(3, 0, 0, 7, 2)); + err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0, + ARM64_SYS_REG(3, 3, 9, 12, 0)); /* * Note that if AArch32 support is not present in the host, -- cgit 1.4.1