]> 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)
commitaac751f78c9e4bb85bd662d6c2f47bf9c466c98d
tree70cf0659e4ea69ce0b3d66466867af8872f4994c
parent4df1d2a8f9cac29af9b3095f5e8367cc4d77a8c2
KVM: arm64: Hide AArch32 PMU registers when not available

commit 0f271584b297 ("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