Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 14: Kernel Activities


nextis used to implement shared IRQ handlers. Severalirqactioninstances are grouped into a linked
list. All elements of a linked list must handle the same IRQ number (instances for different numbers
are located at various positions in theirq_descarray). As discussed in Section 14.1.7, the kernel scans
the list when a shared interrupt is issued to find out for which device the interrupt is actually intended.
Particularly on laptops that integrate many different devices (network, USB, FireWire, sound card, etc.)
on a single chip (with just one interrupt), handler chains of this kind can consist of about five elements.
However, the desirable situation is that only a single device is registered for each IRQ.

Figure 14-4 shows an overview of the data structures described to illustrate how they interact. Because
one type of interrupt controller normally dominates on a system (there is nothing preventing the coex-
istence of multiple handlers, though), thehandlerelements of allirq_descentries point to the same
instance ofirq_chip.

irq_chip

irq_desc[]

struct
irqaction

action
chip next next next

next

next

next

action
chip

action
chip
.
.
.
action
chip

Figure 14-4: Data structures in IRQ management.

14.1.5 Interrupt Flow Handling


Now let’s examine how flow handling is implemented. The situation in this area was quite painful before
the interrupt rework in 2.6, and architecture-specific code was heavily involved in flow handling. Thank-
fully, the situation is now much improved, and a generic framework that accounts for nearly all available
hardware with only very few exceptions is available.

Setting ControllerHardware


First of all, I need to mention some standard functions that are provided by the kernel to register
irq_chips and set flow handlers:

<irq.h>
int set_irq_chip(unsigned int irq, struct irq_chip *chip);
void set_irq_handler(unsigned int irq, irq_flow_handler_t handle);
void set_irq_chained_handler(unsigned int irq, irq_flow_handler_t handle)
void set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
irq_flow_handler_t handle);
void set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
irq_flow_handler_t handle, const char
*name);
Free download pdf