The ICH_HCR_EL2 patching code is generally GIC implementation agnostic, except when checking for broken Apple HW, which imposes to read ICH_VTR_EL2. It is therefore important to check whether we are running on such HW before reading this register, as it will otherwise UNDEF when run on HW that doesn't have GICv3. Reported-by: Marek Szyprowski Tested-by: Marek Szyprowski Fixes: ca30799f7c2d ("KVM: arm64: Turn vgic-v3 errata traps into a patched-in constant") Closes: https://lore.kernel.org/r/b618732b-fd26-49e0-84c5-bfd54be09cd2@samsung.com Signed-off-by: Marc Zyngier --- arch/arm64/kvm/vgic/vgic-v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/vgic/vgic-v3.c b/arch/arm64/kvm/vgic/vgic-v3.c index fc7a4cb8e231d..598621b14a30d 100644 --- a/arch/arm64/kvm/vgic/vgic-v3.c +++ b/arch/arm64/kvm/vgic/vgic-v3.c @@ -829,8 +829,8 @@ static const struct midr_range broken_seis[] = { static bool vgic_v3_broken_seis(void) { return (is_kernel_in_hyp_mode() && - (read_sysreg_s(SYS_ICH_VTR_EL2) & ICH_VTR_EL2_SEIS) && - is_midr_in_range_list(broken_seis)); + is_midr_in_range_list(broken_seis) && + (read_sysreg_s(SYS_ICH_VTR_EL2) & ICH_VTR_EL2_SEIS)); } void noinstr kvm_compute_ich_hcr_trap_bits(struct alt_instr *alt, -- 2.47.3