]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Fix CPU interface MMIO compatibility detection
authorMarc Zyngier <maz@kernel.org>
Tue, 23 Mar 2021 16:08:18 +0000 (16:08 +0000)
committerMarc Zyngier <maz@kernel.org>
Wed, 24 Mar 2021 17:26:38 +0000 (17:26 +0000)
commit5a90836693f4f2e2a71c9359c67d98f4c16abfc9
tree9a295c9d662c7ad3a958c281b6686cb5133f368a
parente9f6ba4aa36ec35671db0c1de57b10a45acbb259
KVM: arm64: Fix CPU interface MMIO compatibility detection

In order to detect whether a GICv3 CPU interface is MMIO capable,
we switch ICC_SRE_EL1.SRE to 0 and check whether it sticks.

However, this is only possible if *ALL* of the HCR_EL2 interrupt
overrides are set, and the CPU is perfectly allowed to ignore
the write to ICC_SRE_EL1 otherwise. This leads KVM to pretend
that a whole bunch of ARMv8.0 CPUs aren't MMIO-capable, and
breaks VMs that should work correctly otherwise.

Fix this by setting IMO/FMO/IMO before touching ICC_SRE_EL1,
and clear them afterwards. This allows us to reliably detect
the CPU interface capabilities.

Tested-by: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
Fixes: 021e47094bae ("KVM: arm64: Workaround firmware wrongly advertising GICv2-on-v3 compatibility")
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/vgic-v3-sr.c