]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: arm64: nv: Describe trap behaviour of MDCR_EL2.HPMN
authorOliver Upton <oliver.upton@linux.dev>
Fri, 25 Oct 2024 18:23:45 +0000 (18:23 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Thu, 31 Oct 2024 19:00:40 +0000 (19:00 +0000)
commit336afe0c832d6eb985d0e9dbc5a70929594e58d9
tree04d932222810be0a974710feb57603434706a1e8
parent4ee5d5ff4b4dd0e08d0424aeec62f25d1d66bb04
KVM: arm64: nv: Describe trap behaviour of MDCR_EL2.HPMN

MDCR_EL2.HPMN splits the PMU event counters into two ranges: the first
range is accessible from all ELs, and the second range is accessible
only to EL2/3. Supposing the guest hypervisor allows direct access to
the PMU counters from the L2, KVM needs to locally handle those
accesses.

Add a new complex trap configuration for HPMN that checks if the counter
index is accessible to the current context. As written, the architecture
suggests HPMN only causes PMEVCNTR<n>_EL0 to trap, though intuition (and
the pseudocode) suggest that the trap applies to PMEVTYPER<n>_EL0 as
well.

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