perf/arm_pmuv3: Add PMUv3.9 per counter EL0 access control
authorRob Herring (Arm) <robh@kernel.org>
Wed, 2 Oct 2024 18:43:24 +0000 (13:43 -0500)
committerWill Deacon <will@kernel.org>
Mon, 28 Oct 2024 17:27:15 +0000 (17:27 +0000)
commit0bbff9ed81654d5f06bfca484681756ee407f924
tree10ab083995cee3f3802c0ffa2b076dfcfa50d08a
parent759b5fc6cc3e3c5841f6a3e4638b39534b0fc716
perf/arm_pmuv3: Add PMUv3.9 per counter EL0 access control

Armv8.9/9.4 PMUv3.9 adds per counter EL0 access controls. Per counter
access is enabled with the UEN bit in PMUSERENR_EL1 register. Individual
counters are enabled/disabled in the PMUACR_EL1 register. When UEN is
set, the CR/ER bits control EL0 write access and must be set to disable
write access.

With the access controls, the clearing of unused counters can be
skipped.

KVM also configures PMUSERENR_EL1 in order to trap to EL2. UEN does not
need to be set for it since only PMUv3.5 is exposed to guests.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20241002184326.1105499-1-robh@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm/include/asm/arm_pmuv3.h
arch/arm64/include/asm/arm_pmuv3.h
arch/arm64/tools/sysreg
drivers/perf/arm_pmuv3.c
include/linux/perf/arm_pmuv3.h