diff options
author | Oliver Upton <oliver.upton@linux.dev> | 2024-12-19 14:40:59 -0800 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2024-12-20 08:49:08 +0000 |
commit | 2417218f2f234fd7880fb193ebf3ae5fcccfa29b (patch) | |
tree | 321b7e9ce4c17f988fa9157429b6bf211aa008ac /tools/perf/scripts/python/task-analyzer.py | |
parent | 8ca19c40c47d80af369c222662445bbf593666b1 (diff) |
KVM: arm64: Get rid of __kvm_get_mdcr_el2() and related warts
KVM caches MDCR_EL2 on a per-CPU basis in order to preserve the
configuration of MDCR_EL2.HPMN while running a guest. This is a bit
gross, since we're relying on some baked configuration rather than the
hardware definition of implemented counters.
Discover the number of implemented counters by reading PMCR_EL0.N
instead. This works because:
- In VHE the kernel runs at EL2, and N always returns the number of
counters implemented in hardware
- In {n,h}VHE, the EL2 setup code programs MDCR_EL2.HPMN with the EL2
view of PMCR_EL0.N for the host
Lastly, avoid traps under nested virtualization by saving PMCR_EL0.N in
host data.
Tested-by: James Clark <james.clark@linaro.org>
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20241219224116.3941496-3-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/task-analyzer.py')
0 files changed, 0 insertions, 0 deletions