]> www.infradead.org Git - users/hch/misc.git/commit
drivers/perf: apple_m1: Provide helper for mapping PMUv3 events
authorOliver Upton <oliver.upton@linux.dev>
Wed, 5 Mar 2025 20:26:39 +0000 (12:26 -0800)
committerOliver Upton <oliver.upton@linux.dev>
Tue, 11 Mar 2025 19:54:29 +0000 (12:54 -0700)
commit2d00cab849be5e4c1b2ba82d4fdcfa0af48c340f
tree9ea0fbea390a33d09509e61ba1d1cc8044115158
parent1e7dcbfa4b7cddfbe1cde6067d135f5452692256
drivers/perf: apple_m1: Provide helper for mapping PMUv3 events

Apple M* parts carry some IMP DEF traps for guest accesses to PMUv3
registers, even though the underlying hardware doesn't implement PMUv3.
This means it is possible to virtualize PMUv3 for KVM guests.

Add a helper for mapping common PMUv3 event IDs onto hardware event IDs,
keeping the implementation-specific crud in the PMU driver rather than
KVM proper. Populate the pmceid_bitmap based on the supported events so
KVM can provide synthetic PMCEID* values to the guest.

Tested-by: Janne Grunau <j@jannau.net>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20250305202641.428114-13-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
drivers/perf/apple_m1_cpu_pmu.c