Linux generic IRQ handling

Thomas Gleixner


      
     

Ingo Molnar


      
     

This documentation is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

For more details see the file COPYING in the source distribution of Linux.


Table of Contents

1. Introduction
2. Rationale
3. Known Bugs And Assumptions
4. Abstraction layers
Interrupt control flow
High-level Driver API
High-level IRQ flow handlers
Default flow implementations
Default flow handler implementations
Quirks and optimizations
Delayed interrupt disable
Chip-level hardware encapsulation
5. __do_IRQ entry point
6. Locking on SMP
7. Generic interrupt chip
irq_gc_mask_set_bit — Mask chip via setting bit in mask register
irq_gc_mask_clr_bit — Mask chip via clearing bit in mask register
irq_gc_ack_set_bit — Ack pending interrupt via setting bit
irq_alloc_generic_chip — Allocate a generic chip and initialize it
__irq_alloc_domain_generic_chips — Allocate generic chips for an irq domain
irq_get_domain_generic_chip — Get a pointer to the generic chip of a hw_irq
irq_setup_generic_chip — Setup a range of interrupts with a generic chip
irq_setup_alt_chip — Switch to alternative chip
irq_remove_generic_chip — Remove a chip
8. Structures
struct irq_common_data — per irq data shared by all irqchips
struct irq_data — per irq chip data passed down to chip functions
struct irq_chip — hardware interrupt chip descriptor
struct irq_chip_regs — register offsets for struct irq_gci
struct irq_chip_type — Generic interrupt chip instance for a flow type
struct irq_chip_generic — Generic irq chip data structure
enum irq_gc_flags — Initialization flags for generic irq chips
struct irqaction — per interrupt action descriptor
struct irq_affinity_notify — context for notification of IRQ affinity changes
struct irq_affinity — Description for automatic irq affinity assignements
irq_set_affinity — Set the irq affinity of a given irq
irq_force_affinity — Force the irq affinity of a given irq
9. Public Functions Provided
synchronize_hardirq — wait for pending hard IRQ handlers (on other CPUs)
synchronize_irq — wait for pending IRQ handlers (on other CPUs)
irq_set_affinity_notifier — control notification of IRQ affinity changes
irq_set_vcpu_affinity — Set vcpu affinity for the interrupt
disable_irq_nosync — disable an irq without waiting
disable_irq — disable an irq and wait for completion
disable_hardirq — disables an irq and waits for hardirq completion
enable_irq — enable handling of an irq
irq_set_irq_wake — control irq power management wakeup
irq_wake_thread — wake the irq thread for the action identified by dev_id
setup_irq — setup an interrupt
remove_irq — free an interrupt
free_irq — free an interrupt allocated with request_irq
request_threaded_irq — allocate an interrupt line
request_any_context_irq — allocate an interrupt line
irq_percpu_is_enabled — Check whether the per cpu irq is enabled
free_percpu_irq — free an interrupt allocated with request_percpu_irq
request_percpu_irq — allocate a percpu interrupt line
irq_get_irqchip_state — returns the irqchip state of a interrupt.
irq_set_irqchip_state — set the state of a forwarded interrupt.
irq_set_chip — set the irq chip for an irq
irq_set_irq_type — set the irq trigger type for an irq
irq_set_handler_data — set irq handler data for an irq
irq_set_chip_data — set irq chip data for an irq
handle_simple_irq — Simple and software-decoded IRQs.
handle_untracked_irq — Simple and software-decoded IRQs.
handle_level_irq — Level type irq handler
handle_fasteoi_irq — irq handler for transparent controllers
handle_edge_irq — edge type IRQ handler
irq_chip_ack_parent — Acknowledge the parent interrupt
irq_chip_mask_parent — Mask the parent interrupt
irq_chip_unmask_parent — Unmask the parent interrupt
irq_chip_eoi_parent — Invoke EOI on the parent interrupt
irq_chip_set_type_parent — Set IRQ type on the parent interrupt
10. Internal Functions Provided
__handle_domain_irq — Invoke the handler for a HW irq belonging to a domain
irq_get_next_irq — get next allocated irq number
kstat_irqs_cpu — Get the statistics for an interrupt on a cpu
kstat_irqs — Get the statistics for an interrupt
kstat_irqs_usr — Get the statistics for an interrupt
kernel/irq/handle.c — Document generation inconsistency
irq_set_msi_desc_off — set MSI descriptor data for an irq at offset
irq_set_msi_desc — set MSI descriptor data for an irq
irq_disable — Mark interrupt disabled
handle_edge_eoi_irq — edge eoi type IRQ handler
handle_percpu_irq — Per CPU local irq handler
handle_percpu_devid_irq — Per CPU local irq handler with per cpu dev ids
irq_cpu_online — Invoke all irq_cpu_online functions.
irq_cpu_offline — Invoke all irq_cpu_offline functions.
irq_chip_enable_parent — Enable the parent interrupt (defaults to unmask if NULL)
irq_chip_disable_parent — Disable the parent interrupt (defaults to mask if NULL)
irq_chip_set_affinity_parent — Set affinity on the parent interrupt
irq_chip_retrigger_hierarchy — Retrigger an interrupt in hardware
irq_chip_set_vcpu_affinity_parent — Set vcpu affinity on the parent interrupt
irq_chip_set_wake_parent — Set/reset wake-up on the parent interrupt
irq_chip_compose_msi_msg — Componse msi message for a irq chip
irq_chip_pm_get — Enable power for an IRQ chip
irq_chip_pm_put — Disable power for an IRQ chip
11. Credits