]> www.infradead.org Git - users/hch/misc.git/commit
drivers/perf: apple_m1: Support host/guest event filtering
authorOliver Upton <oliver.upton@linux.dev>
Wed, 5 Mar 2025 20:26:29 +0000 (12:26 -0800)
committerOliver Upton <oliver.upton@linux.dev>
Tue, 11 Mar 2025 19:52:32 +0000 (12:52 -0700)
commit46573d944f00f440dc794fa87ebbdb0dd9dbf691
tree5b1fea9e5b352f4d80e7a5b96ef1de85043eda62
parent75ecffc361bbc85696c084f3d3c73eb207386e3f
drivers/perf: apple_m1: Support host/guest event filtering

The PMU appears to have a separate register for filtering 'guest'
exception levels (i.e. EL1 and !ELIsInHost(EL0)) which has the same
layout as PMCR1_EL1. Conveniently, there exists a VHE register alias
(PMCR1_EL12) that can be used to configure it.

Support guest events by programming the EL12 register with the intended
guest kernel/userspace filters. Limit support for guest events to VHE
(i.e. kernel running at EL2), as it avoids involving KVM to context
switch PMU registers. VHE is the only supported mode on M* parts anyway,
so this isn't an actual feature limitation.

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