Skip to contentSkip to conversation

arm/cpu: fix GIC v3 flag for a64fx

PATCH Applied Ferdinand Schober 2 participants 2 messages Nov 3 – Nov 6

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm/cpu: fix GIC v3 flag for a64fx

The a64fx CPU model wrongfully set GIC bits in the processor feature register (ID_AA64PFR0).

I traced this back to e31c70ac04001df5e540b79843834277e283fa71, where A64FX got added.

This bit is supposed to get set conditionally in id_aa64pfr0_read, depending on whether or not a gicv3 is present, from what I can tell. Qemu picks gic-version=2 by default, while v3 gets advertised due to this flag. Recent EDK2 firmware accesses ICC_SRE_EL2 in this case and crashes.

Clear the GIC field, as the other CPU models do.

Fixes e31c70ac0400 ("target-arm: Add support for Fujitsu A64FX")

---
To reproduce: UEFI firmware (version edk2-20260812-8.fc44 built at 00:00:00 on Sep 9 2026) (edk2-aarch64-20260812-8.fc44.noarch from Fedora 44)

qemu-system-aarch64 -m 1G -cpu a64fx \
-machine virt,virtualization=on,iommu=smmuv3 -nographic \
-bios /usr/share/edk2/aarch64/QEMU_EFI.fd

 target/arm/tcg/cpu64.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
target/arm/tcg/cpu64.c +2 -1
index 60c701e5d7..3a0f8b623c 100644
@@ -504,7 +504,8 @@ static void aarch64_a64fx_initfn(Object *obj)
     SET_IDREG(isar, REVIDR, 0);
     cpu->ctr = 0x86668006;
     cpu->reset_sctlr = 0x30000180;
-    SET_IDREG(isar, ID_AA64PFR0, 0x0000000101111111); /* No RAS Extensions */
+    /* No RAS Extensions, GIC filled in later */
+    SET_IDREG(isar, ID_AA64PFR0, 0x0000000100111111);
     SET_IDREG(isar, ID_AA64PFR1, 0x0000000000000000);
     SET_IDREG(isar, ID_AA64DFR0, 0x0000000010305408);
     SET_IDREG(isar, ID_AA64DFR1, 0x0000000000000000);
Signature · 1 line
2.56.0
#1 lore raw
Quoted 12 lines · Ferdinand Schober

The a64fx CPU model wrongfully set GIC bits in the processor feature register (ID_AA64PFR0).

I traced this back to e31c70ac04001df5e540b79843834277e283fa71, where A64FX got added.

This bit is supposed to get set conditionally in id_aa64pfr0_read, depending on whether or not a gicv3 is present, from what I can tell. Qemu picks gic-version=2 by default, while v3 gets advertised due to this flag. Recent EDK2 firmware accesses ICC_SRE_EL2 in this case and crashes.

Quoted 6 lines

Clear the GIC field, as the other CPU models do.

Fixes e31c70ac0400 ("target-arm: Add support for Fujitsu A64FX")

---

Applied to target-arm.next, thanks.

-- PMM