KVM: arm64: Hide AArch32 PMU registers when not available
authorAlexandru Elisei <alexandru.elisei@arm.com>
Tue, 3 May 2022 06:02:04 +0000 (06:02 +0000)
committerMarc Zyngier <maz@kernel.org>
Tue, 3 May 2022 10:17:41 +0000 (11:17 +0100)
commita9e192cd4fc738469448803693c9dc730898b8f1
tree70cf0659e4ea69ce0b3d66466867af8872f4994c
parentfd1264c4ca610a99d52c35a37e5551eec442723d
KVM: arm64: Hide AArch32 PMU registers when not available

commit 11663111cd49 ("KVM: arm64: Hide PMU registers from userspace when
not available") hid the AArch64 PMU registers from userspace and guest
when the PMU VCPU feature was not set. Do the same when the PMU
registers are accessed by an AArch32 guest. While we're at it, rename
the previously unused AA32_ZEROHIGH to AA32_DIRECT to match the behavior
of get_access_mask().

Now that KVM emulates ID_DFR0 and hides the PMU from the guest when the
feature is not set, it is safe to inject to inject an undefined exception
when the PMU is not present, as that corresponds to the architected
behaviour.

Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
[Oliver - Add AA32_DIRECT to match the zero value of the enum]
Signed-off-by: Oliver Upton <oupton@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220503060205.2823727-7-oupton@google.com
arch/arm64/kvm/sys_regs.c
arch/arm64/kvm/sys_regs.h