Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

4.1 GICv3 architecture

The GICv3 architecture is specified in IHI0069, not in the Arm ARM. The Arm ARM defines only the PE side: the IRQ, FIQ and SError exceptions, PSTATE masking, the routing controls covered in 3.3, and the existence of a “GIC CPU interface” whose registers are ICC_* System registers. Everything else is in the GIC specification: the components, the state machine and the memory-mapped frames. This section maps out those components and how affinity routing ties them to MPIDR_EL1.

The four components

           wired SPIs                    MSI writes (DeviceID, EventID)
               |                                   |
        +--------------+                     +-----------+
        | Distributor  |  SPI routing,       |    ITS    |  translation tables in memory
        |  (GICD_*)    |  SPI config         | (GITS_*)  |  -> LPI INTID + target collection
        +--------------+                     +-----------+
               |  (IMPLEMENTATION DEFINED interconnect: AXI-Stream / on-chip fabric)
   +-----------+-----------+------------------- ... ---------+
   |                       |                                 |
+------------------+  +------------------+              +------------------+
| Redistributor 0  |  | Redistributor 1  |              | Redistributor N  |  SGI/PPI config,
| (GICR_*)         |  | (GICR_*)         |              | (GICR_*)         |  LPI tables, power
+------------------+  +------------------+              +------------------+
   | GIC Stream protocol / IMPLEMENTATION DEFINED
+------------------+
| CPU interface    |  ICC_* System registers, inside or beside the PE
+------------------+
   | IRQ / FIQ (and vIRQ/vFIQ)
   PE
ComponentScopeOwnsAccessed by
DistributorOne per GIC (per chip in multi-chip configurations, see 4.5)SPIs (and extended SPIs): enable, group, priority, trigger, routing; global enables GICD_CTLRMMIO, GICD_*
RedistributorOne per PESGIs and PPIs (config in the SGI_base frame), LPI property/pending table pointers, PE power handshake (GICR_WAKER)MMIO, GICR_*
CPU interfaceOne per PEAcknowledge, EOI, deactivate, priority mask, running priority, binary point, SGI generationSystem registers ICC_* (virtual: ICV_*, control: ICH_*)
ITSZero or moreTranslation of MSIs to LPIsMMIO, GITS_*, plus a command queue in memory (4.4)

The split between Redistributor and CPU interface matters to firmware. The Redistributor is in the GIC’s power and clock domain and survives a PE power-down. The CPU interface is usually built into the core. Arm cores implement it there, and it talks to the Redistributor over the GIC Stream protocol (AXI4-Stream in Arm’s GIC-600/700 IP). That interface is IMPLEMENTATION DEFINED as far as the architecture is concerned. It is also why the GICR_WAKER handshake exists: the Redistributor must be told that its PE’s interface is quiescent before power is removed, and must be woken before the PE takes interrupts again.

Redistributor frames and discovery

Each Redistributor occupies contiguous 64KB frames:

FrameOffsetContents
RD_base0x00000GICR_CTLR, GICR_IIDR, GICR_TYPER (0x8), GICR_WAKER (0x14), GICR_PROPBASER (0x70), GICR_PENDBASER (0x78)
SGI_base0x10000GICR_IGROUPR0, GICR_ISENABLER0, …, GICR_IPRIORITYR<n>, GICR_ICFGR0/1, GICR_IGRPMODR0, GICR_NSACR
VLPI_base + reserved0x20000, 0x30000GICv4 only (see 11.4)

A GICv3 Redistributor therefore has a 128KB stride and a GICv4 Redistributor a 256KB stride. Software never assumes which: it walks the region and reads GICR_TYPER in each frame. GICR_TYPER.Affinity_Value (bits [63:32]) holds the Aff3.Aff2.Aff1.Aff0 of the PE served by that Redistributor, GICR_TYPER.Last (bit 4) marks the last Redistributor in a contiguous region, and GICR_TYPER.VLPIS shows whether the larger GICv4 stride applies. TF-A’s gicv3_rdistif_probe() and Linux’s gic_iterate_rdists() both do exactly this walk, matching the affinity value against the PE’s own MPIDR_EL1.

Bring-up note: A device tree or platform #define that gives the wrong Redistributor region size or stride is one of the most common first-interrupt failures. The walk either stops early, so a PE finds no Redistributor and TF-A panics or Linux leaves that CPU without a GIC, or it reads garbage GICR_TYPER values from unpopulated space. Dump GICR_TYPER at every 64KB step once before trusting the platform constants.

The CPU interface as System registers

GICv3 moved the CPU interface from MMIO (the GICv2 GICC_* frame) to System registers. This was more than a speed-up. It makes the interface per-PE without needing banked addresses, lets EL2 trap or virtualise it cleanly (ICH_HCR_EL2, ICV_*), and lets accesses be ordered by the PE’s own context-synchronization rules.

RegisterPurpose
ICC_SRE_EL1/EL2/EL3System Register Enable: SRE (bit 0) selects the System-register interface; DFB/DIB disable FIQ/IRQ bypass; Enable (EL2/EL3 only) allows lower ELs to use ICC_SRE_EL1
ICC_IAR0_EL1, ICC_IAR1_EL1Acknowledge the highest-priority pending Group 0 / Group 1 interrupt
ICC_EOIR0_EL1, ICC_EOIR1_EL1, ICC_DIR_EL1Priority drop, and deactivation (4.2)
ICC_HPPIR0_EL1, ICC_HPPIR1_EL1Peek at the highest-priority pending interrupt without acknowledging it
ICC_PMR_EL1, ICC_RPR_EL1Priority mask; running priority (4.3)
ICC_BPR0_EL1, ICC_BPR1_EL1Binary point (preemption granularity)
ICC_AP0R<n>_EL1, ICC_AP1R<n>_EL1Active-priority bitmaps; save/restore only
ICC_IGRPEN0_EL1, ICC_IGRPEN1_EL1, ICC_IGRPEN1_EL3Per-PE group enables at the CPU interface
ICC_CTLR_EL1, ICC_CTLR_EL3EOImode, CBPR, and read-only capability fields (PRIbits, IDbits, SEIS, A3V, RSS, ExtRange)
ICC_SGI0R_EL1, ICC_SGI1R_EL1, ICC_ASGI1R_EL1Generate SGIs (Group 0; Group 1 of the current Security state; Group 1 of the other Security state)
ICC_NMIAR1_EL1Acknowledge a Group 1 NMI (GICv3.3 with FEAT_NMI, see 4.3)

Writes to these registers are not self-synchronising in general. A write to ICC_PMR_EL1, ICC_IGRPENn_EL1, ICC_EOIRn_EL1 or ICC_SGI1R_EL1 is only guaranteed to have taken effect after a context synchronization event, which is why Linux puts an ISB after its EOI and SGI writes (see 7.8). Leaving the System-register interface disabled (ICC_SRE_ELx.SRE == 0) selects the legacy memory-mapped interface. Support for that is optional, and most modern implementations make SRE RAO/WI. The enable order across EL3, EL2 and EL1 belongs to 4.5.

Affinity routing

With affinity routing enabled (GICD_CTLR.ARE_S and GICD_CTLR.ARE_NS; just ARE when GICD_CTLR.DS == 1), every target is named by an affinity value in the same format as MPIDR_EL1. That gives a hierarchical name of up to 2^32 PEs, where GICv2 had an 8-bit target mask. In practice affinity routing is always on. GICv3 legacy (non-ARE) operation is optional and only exists for GICv2-era software.

SPI routing uses one 64-bit GICD_IROUTER<n> per SPI, at GICD_base + 0x6000 + 8n:

FieldBitsMeaning
Aff0, Aff1, Aff2[7:0], [15:8], [23:16]Target PE affinity
Interrupt_Routing_Mode (IRM)310: route to the named PE. 1: “1 of N”, deliver to any participating PE
Aff3[39:32]Target PE affinity, level 3

In 1-of-N mode the GIC picks a PE from those whose Redistributor has not opted out with GICR_CTLR.DPG0/DPG1NS/DPG1S, and whose CPU interface has the group enabled. Support for 1-of-N is optional (GICD_TYPER.No1N), and its selection policy is IMPLEMENTATION DEFINED. Firmware that needs determinism, such as a Secure SPI that must reach the core running the SPMC, names a PE explicitly.

SGIs are targeted through ICC_SGI1R_EL1 (and its siblings), whose layout encodes a cluster and a 16-bit target list within it:

FieldBitsMeaning
TargetList[15:0]Bit n targets the PE with Aff0 = n (+16×RS) in the named cluster
Aff1[23:16]Cluster affinity
INTID[27:24]SGI number 0–15
Aff2[39:32]
IRM401: all PEs except self (TargetList ignored)
RS[47:44]Range selector, for Aff0 values above 15 (if ICC_CTLR_EL1.RSS == 1)
Aff3[55:48]

So one write reaches at most 16 PEs that share Aff3.Aff2.Aff1. A broadcast to a large multi-cluster system is several writes, or one IRM = 1 write. Note what this means for DynamIQ parts, where each core usually has a distinct Aff1 and Aff0 = 0: each SGI write reaches exactly one core unless IRM is used.

Versions in brief

VersionAdds (summary; IHI0069 is authoritative)
GICv3.0Affinity routing, System-register CPU interface, LPIs and ITS, Secure Group 1
GICv3.1Extended SPI (INTIDs 4096–5119) and extended PPI (1056–1119) ranges, Secure EL2 support
GICv3.3NMIs (“superpriority”), for use with FEAT_NMI
GICv4.0 / 4.1Direct injection of vLPIs; v4.1 adds direct vSGIs (11.4)

Read GICD_PIDR2.ArchRev and GICD_TYPER (ESPI, NMI, LPIS, MBIS, DVIS, RSS) rather than assuming a version from the IP name.

GICv5 and what it means for firmware ports

GICv5 (Arm document AES0070, first published in 2025) is not a compatible extension of GICv3. Its main changes:

  • The Distributor and Redistributors are replaced by an Interrupt Routing Service (IRS). The IRS holds the configuration and state of SPIs and LPIs, mostly in memory-resident tables, instead of banks of globally synchronised MMIO registers. An ITS still translates MSIs, and an Interrupt Wire Bridge (IWB) converts wired interrupts into messages.
  • The CPU interface is driven by new GIC system instructions (the GIC / GICR instruction space, for example GIC CDEN to enable and GICR CDIA to acknowledge), discovered through ID_AA64PFR2_EL1 as FEAT_GCIE. ICC_* System registers still exist but have a different set and layout.
  • The model is LPI-centric. There are only PPIs, SPIs and LPIs, and there is no SGI type: inter-processor interrupts are LPIs.
  • Virtualization is designed in. Virtual interrupts can be delivered to a running vPE without a list-register round trip through the hypervisor, and guest IPIs and interrupt configuration are meant not to need EL2 traps (check AES0070 for exactly which interrupt types and operations this covers).
  • Interrupts belong to interrupt domains (EL3, Secure, Non-secure, Realm) instead of to GICv3 “groups”.

For a firmware port this is a rewrite, not a driver tweak. TF-A’s GICv3 driver, the group-to-FIQ/IRQ reasoning in 4.3, the GICR_WAKER power handshake and the ITS command sequences in 4.4 all change. The PE-side concepts carry over unchanged: exception routing, PSTATE masking, and the need for context synchronization after control writes. Treat the GICv5 statements above as a summary of the published specification, and check AES0070 before relying on them.

Checkpoint

Q4.1.1 A platform port computes each CPU’s Redistributor as GICR_base + cpu_index * 128KB and then checks that GICR_TYPER.Affinity_Value matches the CPU’s MPIDR_EL1. On the real GIC (GICv4.1-capable IP), CPU 0 boots fine but CPUs 1–3 report “no Redistributor found”. What is the most likely cause?

  • A. The Redistributors of CPUs 1–3 are still asleep (GICR_WAKER.ProcessorSleep == 1), so GICR_TYPER reads as zero
  • B. Affinity routing is disabled, so GICR_TYPER.Affinity_Value is not populated
  • C. Each Redistributor is 256KB (GICR_TYPER.VLPIS == 1), so CPUs 1 and 3 land in VLPI_base frames and CPU 2 lands on Redistributor 1, and none of those holds a matching affinity
  • D. ICC_SRE_EL1.SRE is 0 on CPUs 1–3, so they cannot read Redistributor registers
Answer

C. With GICv4 the Redistributor has four 64KB frames. CPU 0 matches at offset 0. CPU 1’s address (0x20000) is Redistributor 0’s VLPI_base frame, where offset 0x8 is not GICR_TYPER. CPU 2’s address (0x40000) is Redistributor 1, which holds CPU 1’s affinity. CPU 3 lands in Redistributor 1’s VLPI_base. A walk that steps by 128KB and stops at GICR_TYPER.Last fails in a different way, which is why software reads VLPIS in each frame rather than using a constant. Option A is tempting, but GICR_TYPER is readable whatever the GICR_WAKER state: the wake handshake controls interrupt forwarding, not discovery. ICC_SRE controls the CPU interface, not MMIO access to GICR_*.

Read more: GIC Architecture Specification (IHI0069), Redistributor register map; GICR_TYPER

Q4.1.2 A system has 4 clusters with Aff1 = 0..3 and 8 cores each with Aff0 = 0..7. Firmware wants to send SGI 5 to core 2 in every cluster. What is the minimum number of ICC_SGI1R_EL1 writes, and why?

  • A. Four, because one write names a single Aff3.Aff2.Aff1 cluster and a TargetList within it
  • B. One, with TargetList = 0x0004 and Aff1 left as 0, since TargetList applies to all clusters
  • C. One, with IRM = 1, because IRM broadcasts to the set named in TargetList across all clusters
  • D. Two, because RS lets one write cover 16 clusters at a time
Answer

A. TargetList selects Aff0 values within the one cluster named by the Aff3/Aff2/Aff1 fields of that write. IRM = 1 means “all PEs except self” and ignores TargetList, so it would hit 31 cores, not the 4 wanted. RS extends the Aff0 range in steps of 16 (for clusters with more than 16 PEs). It does not select clusters.

Read more: GIC Architecture Specification (IHI0069), ICC_SGI1R_EL1

Q4.1.3 Which statement correctly says why GICv3 split the Redistributor from the CPU interface, and what that means for power management?

  • A. The Redistributor holds the PE’s acknowledge state, so it must be saved and restored by firmware on every power-down
  • B. The CPU interface is in the GIC power domain, so ICC_* registers keep their values across a core power-down
  • C. The split only exists to support legacy GICv2 software, and has no effect on power sequencing
  • D. The Redistributor stays in the GIC’s power domain and keeps SGI/PPI/LPI configuration while the PE is off, so the PE must quiesce its interface with the GICR_WAKER handshake before power is removed
Answer

D. The Redistributor is the GIC’s per-PE agent and can stay powered when the core is off. That is what allows wake-up on an interrupt targeting an off core. The CPU interface usually lives in the core, so its ICC_* state (PMR, group enables, active priorities) is lost and must be restored. B has the domains reversed. A puts the acknowledge and active-priority state on the wrong side.

Read more: GIC Architecture Specification (IHI0069), Power management, GICR_WAKER