KVM: arm64: PMU: Do not let AArch32 change the counters' top 32 bits
authorMarc Zyngier <maz@kernel.org>
Sun, 13 Nov 2022 16:38:25 +0000 (16:38 +0000)
committerMarc Zyngier <maz@kernel.org>
Sat, 19 Nov 2022 12:43:47 +0000 (12:43 +0000)
commit26d2d0594d7016dbcbce4038aa202c2858d5a944
tree9905b537a3d3a093922754f773613c1ddc6bbc3f
parent9917264d74d9063341968a8e071266358496777b
KVM: arm64: PMU: Do not let AArch32 change the counters' top 32 bits

Even when using PMUv3p5 (which implies 64bit counters), there is
no way for AArch32 to write to the top 32 bits of the counters.
The only way to influence these bits (other than by counting
events) is by writing PMCR.P==1.

Make sure we obey the architecture and preserve the top 32 bits
on a counter update.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20221113163832.3154370-10-maz@kernel.org
arch/arm64/kvm/pmu-emul.c