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.5 GIC bring-up and the interrupt-never-arrives checklist

An interrupt that never arrives has no fault, syndrome or log. It is a state somewhere along the Distributor, Redistributor and CPU interface path that stops propagation. This section gives the initialisation order that removes those states, then a checklist that walks the same path backwards when something is still silent. The architecture is in 4.1, lifecycle in 4.2, groups and priority views in 4.3, and LPIs in 4.4.

The bring-up order

GICv3 initialisation splits into global work, done once by the boot PE, and per-PE work, done by every PE as it comes up (in TF-A, gicv3_distif_init() and then gicv3_rdistif_init() / gicv3_cpuif_enable() per core).

StepWhoRegistersWhy
1Each PE, EL3 then EL2 then EL1ICC_SRE_EL3, ICC_SRE_EL2, ICC_SRE_EL1Select the system-register CPU interface
2Boot PE, SecureGICD_CTLR.ARE_S, ARE_NS, DS; wait on RWPTurn on affinity routing (and decide the security model)
3Boot PEGICD_IGROUPR<n>, GICD_IGRPMODR<n>, GICD_IPRIORITYR<n>, GICD_ICFGR<n>, GICD_IROUTER<n>Configure each SPI before enabling it
4Boot PEGICD_CTLR.EnableGrp0/EnableGrp1NS/EnableGrp1S; wait on RWPLet the Distributor forward
5Each PE, SecureGICR_WAKER.ProcessorSleep = 0, poll ChildrenAsleep == 0Wake the Redistributor-to-CPU-interface link
6Each PESGI_base frame: GICR_IGROUPR0, GICR_IGRPMODR0, GICR_IPRIORITYR<n>, GICR_ICFGR1, GICR_ISENABLER0Configure SGIs and PPIs (timer, PMU, maintenance)
7Each PEICC_PMR_EL1, ICC_BPR*, ICC_CTLR_EL1/EL3, ICC_IGRPEN0_EL1, ICC_IGRPEN1_EL1 / ICC_IGRPEN1_EL3Unmask and enable groups at the CPU interface
8Each PESCR_EL3.IRQ/FIQ, HCR_EL2.IMO/FMO, PSTATE.{I,F}Exception routing and masking (3.3)

The order matters at two points. Group and routing configuration for an SPI should be written while the interrupt is disabled, because the GIC architecture does not guarantee when, or whether, a change to an enabled interrupt’s group, priority or routing takes effect for an instance that is already pending. And GICD_CTLR.ARE_* should be set while the Distributor group enables are still clear: changing ARE with groups enabled is not something the architecture makes predictable (see the GICD_CTLR description in IHI0069).

ICC_SRE_ELx: making the system registers reachable

ICC_SRE_ELx has SRE (bit 0), DFB (bit 1), DIB (bit 2) and, at EL3 and EL2 only, Enable (bit 3).

  • SRE = 1 selects the system-register interface for that EL. With SRE = 0, the EL uses the legacy memory-mapped GICC interface (if the implementation supports it at all; many GIC-600-class systems do not), and ICC_* accesses at that EL are UNDEFINED or trapped.
  • ICC_SRE_EL3.Enable = 1 lets EL2 access ICC_SRE_EL2; ICC_SRE_EL2.Enable = 1 lets EL1 access ICC_SRE_EL1. If the higher EL leaves Enable = 0, the lower EL’s access to its own ICC_SRE traps upward.
  • Write from the top down, with an ISB after each write. A write to ICC_SRE_ELx is a system-register write that later instructions only see after a context synchronization event (7.8); reading back SRE after the ISB confirms that the bit is not RAO/WI or RAZ/WI on this implementation.
    // EL3, per PE
    mrs     x0, ICC_SRE_EL3
    orr     x0, x0, #0xf          // Enable | DIB | DFB | SRE
    msr     ICC_SRE_EL3, x0
    isb
    mrs     x0, ICC_SRE_EL3
    tbz     x0, #0, sre_failed    // SRE stuck at 0: no system-register interface

Older assemblers need the encoded name (S3_6_C12_C12_5 for ICC_SRE_EL3). Linux’s boot protocol requires firmware to set ICC_SRE_EL3.SRE and ICC_SRE_EL3.Enable, and, if the kernel is entered at EL1, ICC_SRE_EL2.SRE and ICC_SRE_EL2.Enable too (a kernel entered at EL2 programs ICC_SRE_EL2 itself). If firmware skips this, the kernel traps or dies in early GIC probe.

GICD_CTLR: ARE and DS

The Secure view of GICD_CTLR holds EnableGrp0 (bit 0), EnableGrp1NS (bit 1), EnableGrp1S (bit 2), ARE_S (bit 4), ARE_NS (bit 5), DS (bit 6) and RWP (bit 31). The Non-secure view shows EnableGrp1 and EnableGrp1A in bits 0–1 and ARE_NS in bit 4.

  • ARE_S / ARE_NS. With affinity routing off, GICD_IROUTER<n> is unused and the legacy 8-target GICD_ITARGETSR model applies, which cannot address more than 8 PEs and does not exist at all for LPIs. A modern system sets both bits. Some implementations make them RAO/WI.
  • DS (Disable Security). With DS = 0 the GIC has two Security states: Secure-only registers and bits are RAZ/WI to Non-secure accesses, and Non-secure priority writes use the shifted view (4.3). With DS = 1 there is one Security state, all registers are accessible to any access, and Secure Group 1 does not exist. Once DS is 1 it can only be cleared by a hardware reset, and setting it while any group is enabled is UNPREDICTABLE. A system running TF-A with a Secure world must leave DS = 0.
  • RWP. Writes to GICD_CTLR and to GICD_ICENABLER<n> do not take effect immediately. Poll GICD_CTLR.RWP until it is 0 before relying on the new state; the per-Redistributor equivalent is GICR_CTLR.RWP for GICR_ICENABLER0 and GICR_CTLR.EnableLPIs.

GICR_WAKER: the per-PE gate

Every Redistributor powers up “asleep”. GICR_WAKER.ProcessorSleep (bit 1) is set at reset, and ChildrenAsleep (bit 2) reads 1 while the interface to the PE is quiescent. While ProcessorSleep = 1, the Redistributor does not forward interrupts to the CPU interface. If an interrupt targeting that PE becomes pending, the GIC asserts a wake request towards the power controller instead (the signal and what the power controller does with it are IMPLEMENTATION DEFINED).

Bring-up must clear ProcessorSleep and then poll until ChildrenAsleep reads 0. Clearing the bit only starts the handshake: until ChildrenAsleep = 0 the link is not guaranteed to be up, and interrupts can be held back. On power-down, the reverse sequence (set ProcessorSleep, poll ChildrenAsleep = 1) runs before the core is turned off (17.4). GIC-600 and later also have an IMPLEMENTATION DEFINED GICR_PWRR that must power up the Redistributor before GICR_WAKER responds at all; TF-A’s gic600 driver handles this.

When GICD_CTLR.DS = 0, GICR_WAKER is accessible only to Secure accesses. In a TF-A system the wake-up is therefore EL3’s job, in the PSCI CPU_ON and warm-boot path. A Non-secure OS that writes it sees no effect.

To find the right Redistributor, walk the frames from GICR_BASE and compare GICR_TYPER[63:32] (Affinity_Value, Aff3.Aff2.Aff1.Aff0) against MPIDR_EL1. Each frame is 128 KB (RD_base and SGI_base) in GICv3, and 256 KB if GICR_TYPER.VLPIS is set (GICv4). GICR_TYPER.Last (bit 4) marks the end of a contiguous region.

Group, enable, priority and PMR

For an interrupt to be signalled, every one of these must hold:

  1. Group. IGROUPR and IGRPMODR together select the group: (0,0) Group 0, (0,1) Secure Group 1, (1,0) Non-secure Group 1. The group decides whether the PE sees IRQ or FIQ in the current state (4.3). Getting it wrong does not lose the interrupt: it usually shows up as an FIQ taken to EL3 instead of an IRQ at EL1.
  2. Distributor group enable for that group in GICD_CTLR. This is not an SPI-only gate: with affinity routing, the group enables also govern forwarding of SGIs and PPIs held in the Redistributors, and EnableGrp1NS controls whether LPIs are forwarded.
  3. Interrupt enable: GICD_ISENABLER<n> for SPIs, GICR_ISENABLER0 for SGIs and PPIs, the LPI property table entry for LPIs.
  4. CPU interface group enable: ICC_IGRPEN0_EL1 or ICC_IGRPEN1_EL1 (with ICC_IGRPEN1_EL3.EnableGrp1NS/EnableGrp1S controlling both Security states from EL3).
  5. Priority higher than the mask. The interrupt is signalled only if its priority value is numerically lower than ICC_PMR_EL1 and higher than the running priority (ICC_RPR_EL1). ICC_PMR_EL1 resets to 0, which masks everything. An interrupt with priority 0xFF can never be signalled, whatever PMR is. Remember the Non-secure view: with DS = 0, a Non-secure write of 0xA0 to a priority register stores 0xD0.
  6. Exception masking and routing: PSTATE.I/F, and the SCR_EL3 / HCR_EL2 routing bits.

Configuration matters too. A level-sensitive SPI that is configured as edge (GICD_ICFGR) latches one pending edge and then never fires again if the line stays high across the acknowledge.

IROUTER, and an SPI routed to a powered-off core

GICD_IROUTER<n> (64-bit, at GICD_BASE + 0x6000 + 8n, valid for n ≥ 32) holds Aff3 [39:32], Aff2 [23:16], Aff1 [15:8], Aff0 [7:0] and Interrupt_Routing_Mode (bit 31).

  • IRM = 0 (targeted). The SPI goes only to the PE whose affinity matches exactly. If no Redistributor matches, because of a typo in the affinity or an MPIDR layout that differs from what the code assumed (for example MT = 1 cores, where Aff0 is the thread), the interrupt stays pending in the Distributor indefinitely.
  • IRM = 1 (1-of-N). The Distributor chooses any participating PE. Participation per group is controlled by GICR_CTLR.DPG0/DPG1NS/DPG1S, and GICD_TYPER.No1N = 1 means 1-of-N is not supported. Which PE is chosen is IMPLEMENTATION DEFINED.

A targeted SPI is not rerouted when its target is powered off. It stays pending. If that core went down through CPU_OFF with ProcessorSleep = 1, the GIC may raise a wake request. Whether the power controller acts on it for a core in the OFF state (as opposed to retention or suspend) is platform policy, and in many systems it does not. The interrupt then waits until the core comes back. Operating systems migrate SPI affinity away from a core before hot-unplug for this reason. In firmware-only stacks (FreeRTOS on one core, a secure partition on another), this is a common cause of interrupts that work until the first power transition.

Multi-chip GICs

The GICv3 architecture describes one logical GIC. A multi-chip or multi-chiplet system keeps that illusion with an IMPLEMENTATION DEFINED multichip scheme. On Arm’s GIC-600 and GIC-700 it is driven by GICD_CHIPSR, GICD_DCHIPR and GICD_CHIPR<n> at GICD_BASE + 0xC000, 0xC004 and 0xC008 + 8n. TF-A’s gic600_multichip_init() shows the required sequence:

  1. On the routing-table owner chip, check that the Distributor group enables and RWP are all clear, and that GICD_CHIPSR.RTS reports the disconnected state. Multichip configuration must come before any Distributor enable.
  2. Write the owner chip number into GICD_DCHIPR, polling GICD_DCHIPR.PUP (update in progress) before and after the write.
  3. For the owner first and then each other chip, write GICD_CHIPR<n> with that chip’s chip-to-chip address, the range of SPI blocks (blocks of 32 SPIs) it owns, and the socket-state bit that brings it online. Poll PUP around each write, read the register back, and check that RTS reports the consistent state.

The consequences for routing:

  • SPIs are owned by the chip whose block range contains them. The owning Distributor fragment holds their state, and delivering one to a PE on another chip is a chip-to-chip message. Overlapping or missing SPI ranges show up as SPIs that are pending on one chip and invisible on another.
  • SGIs and LPIs go to the target Redistributor through the same links. An ITS on chip 0 that translates an MSI for a collection whose target is a Redistributor on chip 1 sends the LPI across. The target is a physical address or a processor number, depending on GITS_TYPER.PTA (4.4), so the Redistributor map must already be consistent.
  • Affinity is not topology. IROUTER uses MPIDR affinity, and the mapping from affinity to die is a platform decision (17.5).

If a remote chip’s link is down or not yet configured, interrupts addressed there simply do not arrive. GIC-600/700 report this through IMPLEMENTATION DEFINED error records, not through anything in the GICv3 programmer’s model.

Checking state: walk backwards from the PE

When an interrupt does not arrive, check state in this order:

QuestionWhere to look
Is it pending at all?SPI: GICD_ISPENDR<n>. SGI/PPI: GICR_ISPENDR0 (SGI_base + 0x200) of the target PE. LPI: pending table bit (in memory, IMPLEMENTATION DEFINED caching)
Is it stuck active?GICD_ISACTIVER<n> / GICR_ISACTIVER0. An active interrupt with no EOI or deactivate blocks itself (4.2)
Is it enabled and in the right group?ISENABLER, IGROUPR, IGRPMODR
Is it routed to a live PE?GICD_IROUTER<n> vs MPIDR_EL1 of the target; that PE’s GICR_WAKER
Does the CPU interface see it?On the target PE: ICC_HPPIR0_EL1 / ICC_HPPIR1_EL1; a special INTID (1023, or 1020/1021 at EL3) means the highest-priority pending interrupt at this interface is not of that group, or nothing is pending
Is it masked?ICC_PMR_EL1, ICC_RPR_EL1, ICC_IGRPEN*, PSTATE.DAIF
Is it routed to another EL?SCR_EL3.IRQ/FIQ, HCR_EL2.IMO/FMO/TGE

Two active tests separate the source from the GIC. Writing the INTID’s bit in GICD_ISPENDR<n> (or GICR_ISPENDR0) makes it pending without the device: if that delivers, the GIC path is fine and the device or wire is at fault. For an SGI, ICC_SGI1R_EL1 from another PE tests Redistributor wake-up and the CPU interface without depending on any SPI configuration (the Distributor group enable still applies, and in GIC-600-class implementations the SGI message itself passes through the Distributor).

Bring-up note: In pre-silicon models, check the GIC configuration parameters (number of SPIs in GICD_TYPER.ITLinesNumber, Redistributor count, GICR_TYPER.Last) against the RTL. A Redistributor walk that runs off the end because Last is never set looks like a hang in early boot, not like an interrupt problem.

Validation note: For each interrupt source, test with a forced pending write (ISPENDR) and with a real device assertion. Then repeat both after a CPU_SUSPEND/CPU_OFF cycle of the target PE and, on multi-chip parts, with the target on each die. The usual failure is that an interrupt is delivered once and then never again. GICD_ISACTIVER shows a stuck-active interrupt (missing deactivate with EOImode = 1), and GICD_ISPENDR with an unchanged IROUTER points to a sleeping or offline target.

Checkpoint

Q4.5.1 In a TF-A + Linux system, a device SPI is enabled, Non-secure Group 1, priority 0xA0, and GICD_ISPENDR<n> shows it pending. Its GICD_IROUTER<n> (IRM = 0) names a core that Linux took offline with PSCI CPU_OFF a minute ago. What happens to the interrupt?

  • A. The Distributor reroutes it to another participating PE, because the target’s GICR_WAKER.ProcessorSleep is 1
  • B. It is discarded when the target Redistributor is powered off, so it needs to be retriggered
  • C. It stays pending in the Distributor. The GIC may request a wake-up for the target, and it is delivered only if and when that core is woken or the routing is changed
  • D. It is delivered to the boot PE, since affinity 0.0.0.0 is the default target for unroutable SPIs
Answer

C. With Interrupt_Routing_Mode = 0, the SPI is targeted at one affinity, and the GIC does not reroute it. Pending state is held in the Distributor regardless of the target’s power state. A wake request is raised towards the power controller, but whether an OFF core is woken by it is a platform decision. Option A describes 1-of-N routing (IRM = 1), which only chooses among participating PEs and is not a fallback for targeted SPIs. There is no default target (D), and pending state is not lost (B).

Read more: GICv3/4 (IHI0069), GICD_IROUTER<n> and power management (GICR_WAKER)

Q4.5.2 Warm-boot code in BL31 clears GICR_WAKER.ProcessorSleep and immediately enables ICC_IGRPEN1_EL3. On silicon, a PPI pending at that moment is sometimes delivered late, while on the FVP it never is. What is the most likely fix?

  • A. Poll GICR_WAKER.ChildrenAsleep until it reads 0 after clearing ProcessorSleep, and only then rely on delivery
  • B. Add a DSB SY after the GICR_WAKER write; the write was still buffered
  • C. Set GICD_CTLR.DS = 1 so that the Non-secure world can wake the Redistributor itself
  • D. Write ICC_PMR_EL1 before ICC_SRE_EL3
Answer

A. Clearing ProcessorSleep only starts the quiescence handshake between the Redistributor and the CPU interface, and ChildrenAsleep = 0 is the architectural signal that it has finished. Models often complete it instantly, which hides the missing poll. A DSB (B) makes the store complete at the Redistributor but does not wait for the handshake it starts, so the window remains. DS = 1 (C) removes the Security model and does not change the handshake. D is a misordering, because ICC_PMR_EL1 is not accessible through the system-register interface until SRE is set.

Read more: GICv3/4 (IHI0069), GICR_WAKER; TF-A gicv3_rdistif_mark_core_awake()

Q4.5.3 A new driver’s SPI never reaches its Linux handler, but EL3 starts logging unexpected FIQs at the same rate as the device’s interrupts. SCR_EL3.FIQ = 1. Which configuration error best explains this?

  • A. ICC_PMR_EL1 is 0 on the target core
  • B. GICD_CTLR.ARE_NS is 0, so the SPI uses legacy targeting
  • C. The SPI is configured edge-triggered while the device is level-sensitive
  • D. GICD_IGROUPR<n> and GICD_IGRPMODR<n> bits are both 0 for that INTID, so it is Group 0
Answer

D. Group 0 interrupts are always signalled as FIQ. With SCR_EL3.FIQ = 1 they are taken to EL3 whatever EL the PE is running at, which matches what EL3 sees. SPIs commonly reset to Group 0 in a GIC with two Security states (the reset value is implementation-specific, so check), and firmware that never sets the group bit for a new INTID produces exactly this. A PMR of 0 (A) would mask the interrupt completely, not move it to EL3. B and C affect whether and how often it is delivered, not which exception type it becomes.

Read more: GICv3/4 (IHI0069), interrupt grouping and GICD_IGROUPR<n>/GICD_IGRPMODR<n>; Arm ARM (DDI0487), SCR_EL3.FIQ