KVM: arm64: Narrow PMU sysreg reset values to architectural requirements
authorMarc Zyngier <maz@kernel.org>
Mon, 19 Jul 2021 12:38:59 +0000 (13:38 +0100)
committerMarc Zyngier <maz@kernel.org>
Mon, 2 Aug 2021 13:26:33 +0000 (14:26 +0100)
commit0ab410a93d627ae73136d1a52c096262360b7992
tree9cef35a6cd93c8286ebb5190e761a25db00f9f18
parentc500bee1c5b2f1d59b1081ac879d73268ab0ff17
KVM: arm64: Narrow PMU sysreg reset values to architectural requirements

A number of the PMU sysregs expose reset values that are not
compliant with the architecture (set bits in the RES0 ranges,
for example).

This in turn has the effect that we need to pointlessly mask
some register fields when using them.

Let's start by making sure we don't have illegal values in the
shadow registers at reset time. This affects all the registers
that dedicate one bit per counter, the counters themselves,
PMEVTYPERn_EL0 and PMSELR_EL0.

Reported-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Link: https://lore.kernel.org/r/20210719123902.1493805-2-maz@kernel.org
arch/arm64/kvm/sys_regs.c