• Marc Zyngier's avatar
    KVM: arm64: Fix CPU interface MMIO compatibility detection · af22df99
    Marc Zyngier authored
    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: default avatarShameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
    Fixes: 9739f6ef ("KVM: arm64: Workaround firmware wrongly advertising GICv2-on-v3 compatibility")
    Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
    af22df99
vgic-v3-sr.c 24.1 KB