IRQ number and Interrupt Descriptor
An IRQ is an interrupt request from a device. Currently they can come in over a pin, or over a packet. Several devices may be connected to the same pin thus sharing an IRQ. An IRQ number is a kernel identifier used to talk about a hardware interrupt source. An IRQ number is an enumeration of the possible interrupt sources on a machine. What is enumerated is the number of input pins on all of the interrupt controller in the system, which is an index into the global irq_desc array.
In the linux kernel, for each peripheral IRQ, interrupt descriptor (struct irq_desc) are used to describe the key information related to an IRQ. When an interrupt occurs, the architecture specific handle_arch_irq handler is triggered which identifies the corresponding hardware interrupt number, then the hw interrupt number is translated to a logical IRQ number using a IRQ domain, then we can get through the IRQ number corresponding interrupt descriptor. Then the interrupt descriptor highlevel irq-event handler is called for interrupt handling.
The highlevel irq-event handler mainly does two operations:
- call the interrupt descriptor’s underlying irq chip driver to perform interrupt flow control like mask, unmask, ack and other callback functions.
- call the interrupt descriptor’s underlying all the irqaction’s device/peripheral handler.