4.4 LPIs and the ITS
SPIs do not scale. Each one needs a wire, a set of Distributor register bits, and a globally synchronised MMIO configuration. PCIe and other modern devices signal interrupts by writing to an address (MSI/MSI-X). GICv3’s answer has two layers. LPIs are message-based interrupts whose configuration and pending state live in normal memory. The Interrupt Translation Service (ITS) turns a device’s write into an LPI on a chosen Redistributor. This section covers the physical model. GICv4’s vLPIs and the vPE tables are in 11.4.
LPI properties
- INTIDs from 8192 upwards. The maximum is set by
GICD_TYPER.IDbits(the hardware maximum) and byGICR_PROPBASER.IDbits(what software provides tables for). - Always Non-secure Group 1, always edge-triggered (message-based), and with no active state (4.2).
- LPIs are supported if
GICD_TYPER.LPIS == 1and, per Redistributor, ifGICR_TYPER.PLPIS == 1. - They can be generated by an ITS, or directly by writing
GICR_SETLPIRifGICR_TYPER.DirectLPI == 1. Direct LPIs are rare in Arm IP.
The two Redistributor tables
GICR_PROPBASER --> LPI Configuration table (1 byte per LPI, indexed by INTID - 8192)
bit [7:2] priority (top 6 bits; bits [1:0] of priority are 0)
bit [1] RES1
bit [0] Enable
GICR_PENDBASER --> LPI Pending table (1 bit per INTID, including 0..8191; per Redistributor)
first 1KB (INTIDs 0..8191): IMPLEMENTATION DEFINED use, must start zeroed
| Register | Key fields | Notes |
|---|---|---|
GICR_PROPBASER | Physical_Address, IDbits (supported INTID bits = IDbits+1), InnerCache, OuterCache, Shareability | Table size is 2^(IDbits+1) − 8192 bytes. Normally the same table for all Redistributors; GICR_TYPER.CommonLPIAff says which Redistributors must share one |
GICR_PENDBASER | Physical_Address (64KB aligned), PTZ (Pending Table Zero), cache and shareability attributes | One table per Redistributor, 2^(IDbits+1) bits. PTZ = 1 tells the GIC the table is all zeros, so it can skip reading it |
GICR_CTLR.EnableLPIs | — | Writing either BASER while EnableLPIs == 1 is UNPREDICTABLE. It is IMPLEMENTATION DEFINED whether EnableLPIs can be cleared once set |
These tables are owned by the GIC once LPIs are enabled. Software never writes the pending table. Software does write the configuration table, but the Redistributor may cache entries, so an update (enable, disable, priority change) must be followed by an invalidate. That is the ITS INV/INVALL command, or GICR_INVLPIR/GICR_INVALLR where implemented (GICv4.1, or DirectLPI).
Bring-up note: Because
EnableLPIscan be one-way, firmware that enables LPIs in a Redistributor (for example a BL33 doing PCIe boot) leaves the next stage unable to move the tables. Linux has a whole mechanism for kexec and firmware handover (it reuses the pre-programmed tables and marks them reserved, seeits_cpu_init_lpis()and theRDIST_FLAGS_RD_TABLES_PREALLOCATEDlogic). Hand over with LPIs disabled, or record in the handoff where the tables are.
The ITS: three tables and a command queue
An ITS translates a pair (DeviceID, EventID) into an (LPI INTID, target Redistributor) pair. The device supplies only the EventID, as the data of a 32-bit write to GITS_TRANSLATER. The interconnect supplies the DeviceID as sideband information: the PCIe Requester ID mapped through the root complex, or the SMMU StreamID. Firmware describes that mapping in ACPI IORT or in device-tree msi-map/msi-parent.
MSI write: data = EventID --> GITS_TRANSLATER (ITS_base + 0x10040), DeviceID from sideband
|
v
Device table [DeviceID] -> ITT base address, number of EventID bits (GITS_BASER<n>, Type = Devices)
|
v
ITT of that device [EventID] -> pINTID (LPI), ICID (memory, allocated per device)
|
v
Collection table [ICID] -> RDbase (target Redistributor) (GITS_BASER<n>, Type = Collections,
| or held in the ITS: GITS_TYPER.HCC)
v
Target Redistributor sets pINTID pending, reads its Configuration entry (Enable, priority), forwards to the CPU interface
A collection is one level of indirection between interrupts and PEs. Moving every LPI of a collection to another PE (CPU hotplug, affinity change) is one MOVALL (plus remapping the collection with MAPC), not one command per interrupt. Linux uses one collection per CPU.
Discovery and table setup
GITS_TYPER describes the ITS:
| Field | Meaning |
|---|---|
ITT_entry_size | Bytes per ITT entry minus 1 (software allocates ITTs with this) |
ID_bits | EventID bits minus 1 supported |
Devbits | DeviceID bits minus 1 supported |
PTA | Target address format: 1 = RDbase is the Redistributor’s physical address, 0 = it is GICR_TYPER.Processor_Number |
HCC | Number of collections held in the ITS without a memory table |
Physical, Virtual | Physical LPIs supported; GICv4 vLPIs supported |
Each GITS_BASER<n> (n = 0–7) has a read-only Type (0 unimplemented, 1 Devices, 2 vPEs, 4 Collections) and Entry_Size. Software must probe them rather than assume an order. Software chooses Physical_Address, Page_Size (4K, 16K or 64K), Size (in pages), the cache and shareability attributes, and Indirect. Indirect (two-level) tables use a first level of 8-byte pointers to pages, which matters when Devbits is large but DeviceIDs are sparse, as with PCIe bus/device/function. Then Valid is set.
The command queue
GITS_CBASER describes a ring buffer in memory (base address, Size in 4KB pages, attributes, Valid). Each command is 32 bytes. Software writes commands at GITS_CWRITER and advances it. The ITS consumes them and advances GITS_CREADR. The queue is empty when the two are equal, and full when advancing CWRITER would make it equal CREADR.
| Command | Code | Effect |
|---|---|---|
MAPD | 0x08 | Map DeviceID to an ITT (address, EventID size), or unmap if V = 0 |
MAPC | 0x09 | Map ICID to a target RDbase, or unmap |
MAPTI | 0x0A | Map (DeviceID, EventID) to (pINTID, ICID) |
MAPI | 0x0B | MAPTI with pINTID = EventID |
MOVI | 0x01 | Move one (DeviceID, EventID) to another collection |
DISCARD | 0x0F | Remove the mapping and clear any pending state |
INV | 0x0C | Re-read the configuration entry for the LPI that (DeviceID, EventID) maps to |
INVALL | 0x0D | Re-read all configuration for a collection |
INT / CLEAR | 0x03 / 0x04 | Set / clear pending, as if the device had written (useful for testing) |
MOVALL | 0x0E | Move all pending LPIs from one Redistributor to another |
SYNC | 0x05 | Wait until all earlier commands’ effects for a Redistributor are globally visible |
The ITS processes commands in order, but completion of their effects at the Redistributors is only guaranteed after a SYNC for that target (or VSYNC for GICv4) has itself been consumed, meaning GITS_CREADR has moved past it. Watching CREADR advance past a MAPTI does not mean an MSI will already be delivered.
A minimal bring-up sequence for one device with one MSI:
/* once per Redistributor (with GICR_CTLR.EnableLPIs == 0): */
/* GICR_PROPBASER, GICR_PENDBASER (zeroed table), then set GICR_CTLR.EnableLPIs */
/* once per ITS */
alloc_and_program(GITS_BASER_n /* Type == Devices */);
alloc_and_program(GITS_BASER_m /* Type == Collections, unless HCC covers it */);
write64(GITS_CBASER, cmdq_pa | size_pages_minus_1 | attrs | VALID);
write64(GITS_CWRITER, 0);
write32(GITS_CTLR, GITS_CTLR_ENABLED);
its_cmd(MAPC, .icid = cpu, .rdbase = PTA ? gicr_pa(cpu) : proc_num(cpu), .v = 1);
its_cmd(SYNC, .rdbase = ...);
/* per device: DeviceID 0x100, EventID 0 -> LPI 8192 on CPU 0 */
prop_table[8192 - 8192] = (prio & 0xfc) | 0x2 /*RES1*/ | 0x1 /*Enable*/;
clean_dcache_to_poc_if_noncoherent(&prop_table[0], 1);
its_cmd(MAPD, .devid = 0x100, .itt = itt_pa, .size = event_bits - 1, .v = 1);
its_cmd(MAPTI, .devid = 0x100, .eventid = 0, .pintid = 8192, .icid = 0);
its_cmd(INV, .devid = 0x100, .eventid = 0);
its_cmd(SYNC, .rdbase = ...);
/* now program the device's MSI address = GITS_TRANSLATER PA, data = 0 */
its_cmd() writes 32 bytes to the queue slot, makes them visible to the ITS (a DSB for coherent ITS, or a clean to PoC first for a non-coherent one), advances GITS_CWRITER, and for SYNC polls GITS_CREADR.
Bring-up note: Write
Shareability/InnerCacheinGITS_BASER<n>,GITS_CBASER,GICR_PROPBASERandGICR_PENDBASER, then read them back. An ITS or Redistributor that cannot snoop the PE caches reports Non-shareable or non-cacheable. Software must then use Non-cacheable mappings for these tables, or clean to the Point of Coherency before every command or table update (8.5, 8.7). Linux does this (GITS_FLAGS_CMDQ_NEEDS_FLUSHING). Forgetting it produces commands the ITS reads as stale zeros.
Bring-up note: If a command is malformed or out of range (DeviceID above
Devbits, an unmapped collection), the ITS may stall:GITS_CREADR.Stalled= 1 andCREADRstops. How the error is reported is IMPLEMENTATION DEFINED. After fixing the command, software can restart processing withGITS_CWRITER.Retrywhere the stall model supports it. A queue that never drains is the first thing to check when MSIs never arrive.
Security and isolation
The ITS and LPIs are Non-secure only. Isolation between devices rests on the DeviceID being unforgeable. A device can only choose an EventID, which indexes its own ITT. Firmware must therefore make sure DeviceIDs are generated by hardware (the root complex or SMMU), not by the device, and that the ITS tables, ITTs and command queue are not reachable by device DMA. They are normally kept outside any SMMU mapping given to a device (11.5). GITS_TRANSLATER itself must be mapped for the devices that send MSIs.
Checkpoint
Q4.4.1 A driver disables an LPI by clearing bit 0 of its configuration-table byte and executes DSB SY. The LPI keeps being delivered. What is missing?
- A. An
ISB, so that the CPU interface sees the new configuration - B. Nothing in software. LPIs cannot be disabled once mapped, so a
DISCARDis the only way - C. An invalidation (
INVfor that DeviceID/EventID followed bySYNC, orGICR_INVLPIRwhere supported), because the Redistributor may have cached the old configuration - D. A write to
GICR_PENDBASERto clear the pending bit
Answer
C. The configuration table is memory that the Redistributor may cache. The DSB makes the store visible at the PE’s side, but the GIC need not re-read it until told to with an invalidate. A misplaces the problem: the cached state is in the GIC, not the PE’s context. D is wrong twice over: software never writes the pending table, and rewriting GICR_PENDBASER with LPIs enabled is UNPREDICTABLE.
Read more: GIC Architecture Specification (IHI0069), LPI Configuration tables; ITS commands INV, SYNC
Q4.4.2 After MAPD, MAPTI and INV, the driver sees GITS_CREADR pass the INV and immediately triggers the device. The first MSI is sometimes lost, but later ones work. What is the most defensible fix?
- A. Insert
DSB SY; ISBafter observingGITS_CREADR - B. Issue a
SYNCtargeting the collection’s Redistributor and wait forGITS_CREADRto pass it before enabling the device - C. Replace
MAPTIwithMAPI, which completes synchronously - D. Set
GICR_PENDBASER.PTZ, so the Redistributor does not need to read the pending table
Answer
B. CREADR advancing only means the ITS has consumed a command. A SYNC is what guarantees that the effects of earlier commands on that Redistributor are complete. PE barriers (A) cannot order the ITS’s internal work. MAPI differs only in using pINTID = EventID. PTZ is a one-time initialisation hint and is unrelated.
Read more: GIC Architecture Specification (IHI0069), The ITS command queue; SYNC
Q4.4.3 A malicious PCIe endpoint wants to raise an LPI that belongs to another device. Which property of the architecture prevents it, and what must the platform get right for that to hold?
- A. LPIs are Secure-only, so endpoints cannot raise them without TrustZone permission
- B. The ITS checks the EventID against an allow-list in
GITS_CTLR - C. Each LPI’s configuration byte records the owning DeviceID, and the Redistributor checks it
- D. Translation is indexed by a DeviceID supplied as sideband by the root complex or SMMU, so the device can only select EventIDs within its own ITT. The platform must generate DeviceIDs in hardware and keep ITS tables and ITTs out of device-reachable memory
Answer
D. The DeviceID selects which ITT is used, and the device controls only the EventID. If a device could choose its DeviceID, or overwrite an ITT by DMA, isolation would be lost. A is wrong because LPIs are Non-secure Group 1 only. The configuration table holds just priority and enable, which rules out C.
Read more: GIC Architecture Specification (IHI0069), The ITS, DeviceID and EventID; Arm IORT specification (DEN0049)