Skip to contentSkip to conversation

KVM: arm64: GICv3: Check the implementation before accessing ICH_VTR_EL2

PATCH Applied Marc Zyngier 2 participants 2 messages Nov 13, 2025

Subsystems (3)
lore
Share & tools
lore

Marc Zyngier

author maintainer
#0 lore raw

PATCH 1/1 KVM: arm64: GICv3: Check the implementation before accessing ICH_VTR_EL2

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.

Fixes ca30799f7c2d ("KVM: arm64: Turn vgic-v3 errata traps into a patched-in constant")
---
 arch/arm64/kvm/vgic/vgic-v3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kvm/vgic/vgic-v3.c +2 -2
index fc7a4cb8e231d..598621b14a30d 100644
@@ -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,
Signature · 1 line
2.47.3
maintainer Applied
#1 lore raw
Quoted 9 lines · Marc Zyngier

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.

[...]

Applied to next, thanks!

[1/1] KVM: arm64: GICv3: Check the implementation before accessing ICH_VTR_EL2

      https://git.kernel.org/kvmarm/kvmarm/c/8ed2ae76f20c

--
Best,
Oliver