Skip to content

KVM: arm64: nv: More complete support for FEAT_PMUv3

Oliver Upton kvmarm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest12 patches 2 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12KVM: arm64: Rename kvm_pmu_valid_counter_mask()arch/arm64/kvm/pmu-emul.c arch/arm64/kvm/sys_regs.c include/kvm/arm_pmu.h+12 -120 replies
2/12KVM: arm64: nv: Adjust range of accessible PMCs according to HPMNarch/arm64/kvm/pmu-emul.c arch/arm64/kvm/sys_regs.c include/kvm/arm_pmu.h+24 -70 replies
3/12KVM: arm64: nv: Rename BEHAVE_FORWARD_ANYarch/arm64/kvm/emulate-nested.c+42 -410 replies
4/12KVM: arm64: nv: Add support for describing traps that affect Host EL0arch/arm64/kvm/emulate-nested.c+34 -31 reply
5/12KVM: arm64: nv: Reinject traps that take effect in Host EL0arch/arm64/include/asm/kvm_emulate.h arch/arm64/kvm/emulate-nested.c+26 -40 replies
6/12KVM: arm64: nv: Honor MDCR_EL2.{TPM, TPMCR} in Host EL0arch/arm64/kvm/emulate-nested.c+4 -20 replies
7/12KVM: arm64: nv: Allow coarse-grained trap combos to use complex trapsarch/arm64/kvm/emulate-nested.c+2 -10 replies
8/12KVM: arm64: nv: Describe trap behaviour of MDCR_EL2.HPMNarch/arm64/kvm/emulate-nested.c+101 -640 replies
9/12KVM: arm64: nv: Advertise support for FEAT_HPMN0arch/arm64/kvm/nested.c+3 -21 reply
10/12KVM: arm64: Add helpers to determine if PMC counts at a given ELarch/arm64/kvm/pmu-emul.c+28 -120 replies
11/12KVM: arm64: nv: Honor NSH filter when in hyp contextarch/arm64/kvm/pmu-emul.c+14 -10 replies
12/12KVM: arm64: nv: Reprogram PMU events affected by nested transitionarch/arm64/kvm/emulate-nested.c arch/arm64/kvm/pmu-emul.c include/kvm/arm_pmu.h+31 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/12] KVM: arm64: nv: More complete support for FEAT_PMUv3

Well, looks like that grew a bit :)

The coarse-grained traps for the PMU available at EL2 are annoyingly effective in both guest and host contexts, meaning the traps need to be evaluated for a VM's host EL0. Yuck.

First couple patches align the PMU emulation w/ the architecture, where a PMU has an implemented set of counters *and* a dynamic view of said counters based on the current context.

Patches 2-9 add support for Host EL0 traps to the NV trap infrastructure, and takes advantage of it for MDCR_EL2.{TPM, TPMCR, HPMN}.

The whole interaction of CGTs declaring their EL0-ness is a bit shaky, since it is a property of the triaged sysreg itself. I structured it this way for the mostly theoretical problem of a sysreg having multiple traps, only some of which take effect in Host EL0.

Last bit is the event filter fixes I had from before.

v1: https://lore.kernel.org/kvmarm/[email protected]/

Oliver Upton (12):
KVM: arm64: Rename kvm_pmu_valid_counter_mask()
KVM: arm64: nv: Adjust range of accessible PMCs according to HPMN
KVM: arm64: nv: Rename BEHAVE_FORWARD_ANY
KVM: arm64: nv: Add support for describing traps that affect Host EL0
KVM: arm64: nv: Reinject traps that take effect in Host EL0
KVM: arm64: nv: Honor MDCR_EL2.{TPM, TPMCR} in Host EL0
KVM: arm64: nv: Allow coarse-grained trap combos to use complex traps
KVM: arm64: nv: Describe trap behaviour of MDCR_EL2.HPMN
KVM: arm64: nv: Advertise support for FEAT_HPMN0
KVM: arm64: Add helpers to determine if PMC counts at a given EL
KVM: arm64: nv: Honor NSH filter when in hyp context
KVM: arm64: nv: Reprogram PMU events affected by nested transition

 arch/arm64/include/asm/kvm_emulate.h |   5 +
 arch/arm64/kvm/emulate-nested.c      | 319 +++++++++++++++++----------
 arch/arm64/kvm/nested.c              |   5 +-
 arch/arm64/kvm/pmu-emul.c            |  97 ++++++--
 arch/arm64/kvm/sys_regs.c            |  12 +-
 include/kvm/arm_pmu.h                |  12 +-
 6 files changed, 311 insertions(+), 139 deletions(-)

base-commit: 7c626ce4bae1ac14f60076d00eafe71af30450ba

Signature · 1 line
2.46.0.295.g3b9ea8a38a-goog