]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit6f0a76dfd698fb5ecc1fb99b75e801f0ef5e2eb3
tree70cf0659e4ea69ce0b3d66466867af8872f4994c
parent04c9796be54d1a44439afaf6a23b5530800739b6
KVM: arm64: Hide AArch32 PMU registers when not available

commit 07258a07d77a ("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