]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: arm64: nv: Adjust range of accessible PMCs according to HPMN
authorOliver Upton <oliver.upton@linux.dev>
Fri, 25 Oct 2024 18:23:48 +0000 (18:23 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Thu, 31 Oct 2024 19:00:40 +0000 (19:00 +0000)
commit9a1c58cfefb06974a804174f127de3fedc779394
treec42e37e809ac750cfcce9262b2ecdecdca6babcb
parenta3034dab74fc12d6c0a589e31af9fafc436a4a0e
KVM: arm64: nv: Adjust range of accessible PMCs according to HPMN

The value of MDCR_EL2.HPMN controls the number of event counters made
visible to EL0 and EL1. This means it is possible for the guest
hypervisor to allow direct access to event counters to the L2.

Rework KVM's PMU register emulation to take the effects of HPMN into
account when handling a trap. For bitmask-style registers, writes only
affect accessible registers.

Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20241025182354.3364124-14-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/pmu-emul.c
arch/arm64/kvm/sys_regs.c
include/kvm/arm_pmu.h