</>EmbeddedInterview

What is ARM GIC?

MediumARM Architecture

Short answer: The Generic Interrupt Controller routes and prioritizes interrupts. GICv3 uses a distributor, redistributors and CPU interfaces; an interrupt handler acknowledges and completes interrupts.

PeripheralIRQGICRoute / priorityCPUException handler
MRS X0, ICC_IAR1_EL1 // acknowledge Group 1
// handle valid interrupt
MSR ICC_EOIR1_EL1, X0 // end priority

1. Interrupt path: A peripheral asserts an interrupt. The GIC decides its priority and target CPU. The CPU receives an IRQ exception if permitted.

2. GICv3 components

Component Role
Distributor Configures shared peripheral interrupts
Redistributor Per-core interrupt configuration
CPU interface Acknowledge, prioritize and signal completion

3. Interrupt classes: SGIs support interprocessor signaling; PPIs are private to a CPU; SPIs are shared peripheral interrupts.

4. Handler: Acknowledge the interrupt, service its source, then signal end of interrupt. Depending on configuration, a separate deactivate operation is required. Linux normally handles these details via its IRQ subsystem.

Interview takeaway: The GIC routes and prioritizes interrupts; the device driver handles the interrupt source.

End-to-end interrupt flow in Linux

Assume an I2C-connected touch controller asserts a GPIO interrupt. The GPIO controller may route or cascade that interrupt through a parent interrupt controller; the GIC presents the relevant interrupt to the CPU.

Peripheral IRQ -> GPIO / interrupt routing -> GIC
    -> CPU exception vector -> Linux IRQ subsystem
    -> device driver's registered handler
    -> acknowledge device and complete interrupt

GICv3's distributor handles shared interrupt configuration, redistributors hold per-processor SGI/PPI configuration and related state, and CPU system-register interfaces handle acknowledgement and priority operations. For MSI-based devices, an ITS can translate device/event identifiers to LPIs when that facility is implemented.

A level-triggered device interrupt generally requires its source to be serviced or deasserted before it is allowed to retrigger. Otherwise, repeated interrupts may occur even after end-of-interrupt at the GIC. Read /proc/interrupts to examine interrupt counts and CPU distribution, and inspect the device's own status registers when diagnosing missing or repeated interrupts.

The raw assembly illustration assumes a valid acknowledged interrupt and a suitable GIC configuration; spurious INTIDs and split EOI/deactivate mode require their documented handling. Ordinary Linux device drivers use request_irq or request_threaded_irq instead of manipulating the GIC directly.