[PATCH] arm/cpu: fix GIC v3 flag for a64fx

Ferdinand Schober posted 1 patch 2 weeks, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261103145254.1543907-1-schober@cs.fau.de
Maintainers: Peter Maydell <peter.maydell@linaro.org>
target/arm/tcg/cpu64.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] arm/cpu: fix GIC v3 flag for a64fx
Posted by Ferdinand Schober 2 weeks, 5 days ago
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.

Cc: qemu-stable@nongnu.org
Fixes: e31c70ac0400 ("target-arm: Add support for Fujitsu A64FX")
Signed-off-by: Ferdinand Schober <schober@cs.fau.de>
---
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(-)

diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c
index 60c701e5d7..3a0f8b623c 100644
--- a/target/arm/tcg/cpu64.c
+++ b/target/arm/tcg/cpu64.c
@@ -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);
-- 
2.56.0
Re: [PATCH] arm/cpu: fix GIC v3 flag for a64fx
Posted by Peter Maydell 2 weeks, 2 days ago
On Tue, 3 Nov 2026 at 14:54, Ferdinand Schober <schober@cs.fau.de> wrote:
>
> 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.
>
> Cc: qemu-stable@nongnu.org
> Fixes: e31c70ac0400 ("target-arm: Add support for Fujitsu A64FX")
> Signed-off-by: Ferdinand Schober <schober@cs.fau.de>
> ---



Applied to target-arm.next, thanks.

-- PMM