]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: arm64: Add PMU event filter bits required if EL3 is implemented
authorOliver Upton <oliver.upton@linux.dev>
Thu, 19 Oct 2023 18:56:18 +0000 (18:56 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Tue, 24 Oct 2023 19:26:14 +0000 (19:26 +0000)
commitae8d3522e5b7208d238c893a00957864536983dc
tree2f47bb9885efc917c43d66bcb27679585e4dd33c
parentbc512d6a9b92390760f0e8c895501c5016539929
KVM: arm64: Add PMU event filter bits required if EL3 is implemented

Suzuki noticed that KVM's PMU emulation is oblivious to the NSU and NSK
event filter bits. On systems that have EL3 these bits modify the
filter behavior in non-secure EL0 and EL1, respectively. Even though the
kernel doesn't use these bits, it is entirely possible some other guest
OS does. Additionally, it would appear that these and the M bit are
required by the architecture if EL3 is implemented.

Allow the EL3 event filter bits to be set if EL3 is advertised in the
guest's ID register. Implement the behavior of NSU and NSK according to
the pseudocode, and entirely ignore the M bit for perf event creation.

Reported-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20231019185618.3442949-3-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/pmu-emul.c
include/linux/perf/arm_pmuv3.h