Skip to content

KVM: arm64: Disabled PMU handling

Marc Zyngier kvm kvmarm linux-arm-kernel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 12 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8KVM: arm64: Add kvm_vcpu_has_pmu() helperarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/pmu-emul.c+6 -50 replies
2/8KVM: arm64: Set ID_AA64DFR0_EL1.PMUVer to 0 when no PMU supportarch/arm64/kvm/sys_regs.c+6 -10 replies
3/8KVM: arm64: Refuse illegal KVM_ARM_VCPU_PMU_V3 at reset timearch/arm64/kvm/pmu-emul.c arch/arm64/kvm/reset.c+6 -23 replies
4/8KVM: arm64: Inject UNDEF on PMU access when no PMU configuredarch/arm64/kvm/sys_regs.c+8 -40 replies
5/8KVM: arm64: Remove PMU RAZ/WI handlingarch/arm64/kvm/sys_regs.c+0 -302 replies
6/8KVM: arm64: Remove dead PMU sysreg decoding codearch/arm64/kvm/sys_regs.c+0 -44 replies
7/8KVM: arm64: Gate kvm_pmu_update_state() on the PMU featurearch/arm64/kvm/pmu-emul.c+1 -10 replies
8/8KVM: arm64: Get rid of the PMU ready statearch/arm64/kvm/pmu-emul.c include/kvm/arm_pmu.h+0 -40 replies

Reviews trailers per patch

2 of 8 patches have a Reviewed-by or Acked-by.

PatchAlexandru Elisei
1/8
2/8
3/8
4/8
5/8R-b
6/8R-b
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/8] KVM: arm64: Disabled PMU handling

It recently dawned on me that the way we handle PMU traps when the PMU is disabled is plain wrong. We consider that handling the registers as RAZ/WI is a fine thing to do, while the ARMv8 ARM is pretty clear that that's not OK and that such registers should UNDEF when FEAT_PMUv3 doesn't exist. I went all the way back to the first public version of the spec, and it turns out we were *always* wrong.

It probably comes from the fact that we used not to trap the ID registers, and thus were unable to advertise the lack of PMU, but that's hardly an excuse. So let's fix the damned thing.

This series adds an extra check in the helpers that check for the validity of the PMU access (most of the registers have to checked against some enable flags and/or the accessing exception level), and rids us of the RAZ/WI behaviour.

This enables us to make additional cleanups, to the point where we can remove the PMU "ready" state that always had very bizarre semantics. All in all, a negative diffstat, and spec compliant behaviours. What's not to like?

I've run a few guests with and without PMUs as well as KUT, and nothing caught fire. The patches are on top of kvmarm/queue.

Marc Zyngier (8):
KVM: arm64: Add kvm_vcpu_has_pmu() helper
KVM: arm64: Set ID_AA64DFR0_EL1.PMUVer to 0 when no PMU support
KVM: arm64: Refuse illegal KVM_ARM_VCPU_PMU_V3 at reset time
KVM: arm64: Inject UNDEF on PMU access when no PMU configured
KVM: arm64: Remove PMU RAZ/WI handling
KVM: arm64: Remove dead PMU sysreg decoding code
KVM: arm64: Gate kvm_pmu_update_state() on the PMU feature
KVM: arm64: Get rid of the PMU ready state

 arch/arm64/include/asm/kvm_host.h |  3 ++
 arch/arm64/kvm/pmu-emul.c         | 11 +++----
 arch/arm64/kvm/reset.c            |  4 +++
 arch/arm64/kvm/sys_regs.c         | 51 ++++++++-----------------------
 include/kvm/arm_pmu.h             |  3 --
 5 files changed, 24 insertions(+), 48 deletions(-)
Signature · 1 line
2.28.0