1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Linux generic IRQ handling</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux generic IRQ handling"><link rel="next" href="intro.html" title="Chapter 1. Introduction"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Linux generic IRQ handling</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="intro.html">Next</a></td></tr></table><hr></div><div class="book"><div class="titlepage"><div><div><h1 class="title"><a name="Generic-IRQ-Guide"></a>Linux generic IRQ handling</h1></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Thomas</span> <span class="surname">Gleixner</span></h3><div class="affiliation"><div class="address"><p><br> 2      <code class="email"><<a class="email" href="mailto:tglx@linutronix.de">tglx@linutronix.de</a>></code><br> 3     </p></div></div></div><div class="author"><h3 class="author"><span class="firstname">Ingo</span> <span class="surname">Molnar</span></h3><div class="affiliation"><div class="address"><p><br> 4      <code class="email"><<a class="email" href="mailto:mingo@elte.hu">mingo@elte.hu</a>></code><br> 5     </p></div></div></div></div></div><div><p class="copyright">Copyright © 2005-2010 Thomas Gleixner</p></div><div><p class="copyright">Copyright © 2005-2006 Ingo Molnar</p></div><div><div class="legalnotice"><a name="idp1102342300"></a><p> 6 This documentation is free software; you can redistribute 7 it and/or modify it under the terms of the GNU General Public 8 License version 2 as published by the Free Software Foundation. 9 </p><p> 10 This program is distributed in the hope that it will be 11 useful, but WITHOUT ANY WARRANTY; without even the implied 12 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 See the GNU General Public License for more details. 14 </p><p> 15 You should have received a copy of the GNU General Public 16 License along with this program; if not, write to the Free 17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 18 MA 02111-1307 USA 19 </p><p> 20 For more details see the file COPYING in the source 21 distribution of Linux. 22 </p></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="chapter"><a href="intro.html">1. Introduction</a></span></dt><dt><span class="chapter"><a href="rationale.html">2. Rationale</a></span></dt><dt><span class="chapter"><a href="bugs.html">3. Known Bugs And Assumptions</a></span></dt><dt><span class="chapter"><a href="Abstraction.html">4. Abstraction layers</a></span></dt><dd><dl><dt><span class="sect1"><a href="Abstraction.html#Interrupt_control_flow">Interrupt control flow</a></span></dt><dt><span class="sect1"><a href="Highlevel_Driver_API.html">High-level Driver API</a></span></dt><dt><span class="sect1"><a href="Highlevel_IRQ_flow_handlers.html">High-level IRQ flow handlers</a></span></dt><dd><dl><dt><span class="sect2"><a href="Highlevel_IRQ_flow_handlers.html#Default_flow_implementations">Default flow implementations</a></span></dt><dt><span class="sect2"><a href="Highlevel_IRQ_flow_handlers.html#Default_flow_handler_implementations">Default flow handler implementations</a></span></dt><dt><span class="sect2"><a href="Highlevel_IRQ_flow_handlers.html#Quirks_and_optimizations">Quirks and optimizations</a></span></dt><dt><span class="sect2"><a href="Highlevel_IRQ_flow_handlers.html#Delayed_interrupt_disable">Delayed interrupt disable</a></span></dt></dl></dd><dt><span class="sect1"><a href="Chiplevel_hardware_encapsulation.html">Chip-level hardware encapsulation</a></span></dt></dl></dd><dt><span class="chapter"><a href="doirq.html">5. __do_IRQ entry point</a></span></dt><dt><span class="chapter"><a href="locking.html">6. Locking on SMP</a></span></dt><dt><span class="chapter"><a href="genericchip.html">7. Generic interrupt chip</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="API-irq-gc-mask-set-bit.html"><span class="phrase">irq_gc_mask_set_bit</span></a></span><span class="refpurpose"> — 23 Mask chip via setting bit in mask register 24 </span></dt><dt><span class="refentrytitle"><a href="API-irq-gc-mask-clr-bit.html"><span class="phrase">irq_gc_mask_clr_bit</span></a></span><span class="refpurpose"> — 25 Mask chip via clearing bit in mask register 26 </span></dt><dt><span class="refentrytitle"><a href="API-irq-gc-ack-set-bit.html"><span class="phrase">irq_gc_ack_set_bit</span></a></span><span class="refpurpose"> — 27 Ack pending interrupt via setting bit 28 </span></dt><dt><span class="refentrytitle"><a href="API-irq-alloc-generic-chip.html"><span class="phrase">irq_alloc_generic_chip</span></a></span><span class="refpurpose"> — 29 Allocate a generic chip and initialize it 30 </span></dt><dt><span class="refentrytitle"><a href="API-irq-alloc-domain-generic-chips.html"><span class="phrase">irq_alloc_domain_generic_chips</span></a></span><span class="refpurpose"> — 31 Allocate generic chips for an irq domain 32 </span></dt><dt><span class="refentrytitle"><a href="API-irq-get-domain-generic-chip.html"><span class="phrase">irq_get_domain_generic_chip</span></a></span><span class="refpurpose"> — 33 Get a pointer to the generic chip of a hw_irq 34 </span></dt><dt><span class="refentrytitle"><a href="API-irq-setup-generic-chip.html"><span class="phrase">irq_setup_generic_chip</span></a></span><span class="refpurpose"> — 35 Setup a range of interrupts with a generic chip 36 </span></dt><dt><span class="refentrytitle"><a href="API-irq-setup-alt-chip.html"><span class="phrase">irq_setup_alt_chip</span></a></span><span class="refpurpose"> — 37 Switch to alternative chip 38 </span></dt><dt><span class="refentrytitle"><a href="API-irq-remove-generic-chip.html"><span class="phrase">irq_remove_generic_chip</span></a></span><span class="refpurpose"> — 39 Remove a chip 40 </span></dt></dl></dd><dt><span class="chapter"><a href="structs.html">8. Structures</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="API-struct-irq-data.html"><span class="phrase">struct irq_data</span></a></span><span class="refpurpose"> — 41 per irq and irq chip data passed down to chip functions 42 </span></dt><dt><span class="refentrytitle"><a href="API-struct-irq-chip.html"><span class="phrase">struct irq_chip</span></a></span><span class="refpurpose"> — 43 hardware interrupt chip descriptor 44 </span></dt><dt><span class="refentrytitle"><a href="API-struct-irq-chip-regs.html"><span class="phrase">struct irq_chip_regs</span></a></span><span class="refpurpose"> — 45 register offsets for struct irq_gci 46 </span></dt><dt><span class="refentrytitle"><a href="API-struct-irq-chip-type.html"><span class="phrase">struct irq_chip_type</span></a></span><span class="refpurpose"> — 47 Generic interrupt chip instance for a flow type 48 </span></dt><dt><span class="refentrytitle"><a href="API-struct-irq-chip-generic.html"><span class="phrase">struct irq_chip_generic</span></a></span><span class="refpurpose"> — 49 Generic irq chip data structure 50 </span></dt><dt><span class="refentrytitle"><a href="API-enum-irq-gc-flags.html"><span class="phrase">enum irq_gc_flags</span></a></span><span class="refpurpose"> — 51 Initialization flags for generic irq chips 52 </span></dt><dt><span class="refentrytitle"><a href="API-struct-irqaction.html"><span class="phrase">struct irqaction</span></a></span><span class="refpurpose"> — 53 per interrupt action descriptor 54 </span></dt><dt><span class="refentrytitle"><a href="API-struct-irq-affinity-notify.html"><span class="phrase">struct irq_affinity_notify</span></a></span><span class="refpurpose"> — 55 context for notification of IRQ affinity changes 56 </span></dt><dt><span class="refentrytitle"><a href="API-irq-set-affinity.html"><span class="phrase">irq_set_affinity</span></a></span><span class="refpurpose"> — 57 Set the irq affinity of a given irq 58 </span></dt><dt><span class="refentrytitle"><a href="API-irq-force-affinity.html"><span class="phrase">irq_force_affinity</span></a></span><span class="refpurpose"> — 59 Force the irq affinity of a given irq 60 </span></dt></dl></dd><dt><span class="chapter"><a href="pubfunctions.html">9. Public Functions Provided</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="API-synchronize-hardirq.html"><span class="phrase">synchronize_hardirq</span></a></span><span class="refpurpose"> — 61 wait for pending hard IRQ handlers (on other CPUs) 62 </span></dt><dt><span class="refentrytitle"><a href="API-synchronize-irq.html"><span class="phrase">synchronize_irq</span></a></span><span class="refpurpose"> — 63 wait for pending IRQ handlers (on other CPUs) 64 </span></dt><dt><span class="refentrytitle"><a href="API-irq-set-affinity-notifier.html"><span class="phrase">irq_set_affinity_notifier</span></a></span><span class="refpurpose"> — 65 control notification of IRQ affinity changes 66 </span></dt><dt><span class="refentrytitle"><a href="API-disable-irq-nosync.html"><span class="phrase">disable_irq_nosync</span></a></span><span class="refpurpose"> — 67 disable an irq without waiting 68 </span></dt><dt><span class="refentrytitle"><a href="API-disable-irq.html"><span class="phrase">disable_irq</span></a></span><span class="refpurpose"> — 69 disable an irq and wait for completion 70 </span></dt><dt><span class="refentrytitle"><a href="API-disable-hardirq.html"><span class="phrase">disable_hardirq</span></a></span><span class="refpurpose"> — 71 disables an irq and waits for hardirq completion 72 </span></dt><dt><span class="refentrytitle"><a href="API-enable-irq.html"><span class="phrase">enable_irq</span></a></span><span class="refpurpose"> — 73 enable handling of an irq 74 </span></dt><dt><span class="refentrytitle"><a href="API-irq-set-irq-wake.html"><span class="phrase">irq_set_irq_wake</span></a></span><span class="refpurpose"> — 75 control irq power management wakeup 76 </span></dt><dt><span class="refentrytitle"><a href="API-irq-wake-thread.html"><span class="phrase">irq_wake_thread</span></a></span><span class="refpurpose"> — 77 wake the irq thread for the action identified by dev_id 78 </span></dt><dt><span class="refentrytitle"><a href="API-setup-irq.html"><span class="phrase">setup_irq</span></a></span><span class="refpurpose"> — 79 setup an interrupt 80 </span></dt><dt><span class="refentrytitle"><a href="API-remove-irq.html"><span class="phrase">remove_irq</span></a></span><span class="refpurpose"> — 81 free an interrupt 82 </span></dt><dt><span class="refentrytitle"><a href="API-free-irq.html"><span class="phrase">free_irq</span></a></span><span class="refpurpose"> — 83 free an interrupt allocated with request_irq 84 </span></dt><dt><span class="refentrytitle"><a href="API-request-threaded-irq.html"><span class="phrase">request_threaded_irq</span></a></span><span class="refpurpose"> — 85 allocate an interrupt line 86 </span></dt><dt><span class="refentrytitle"><a href="API-request-any-context-irq.html"><span class="phrase">request_any_context_irq</span></a></span><span class="refpurpose"> — 87 allocate an interrupt line 88 </span></dt><dt><span class="refentrytitle"><a href="API-irq-set-chip.html"><span class="phrase">irq_set_chip</span></a></span><span class="refpurpose"> — 89 set the irq chip for an irq 90 </span></dt><dt><span class="refentrytitle"><a href="API-irq-set-irq-type.html"><span class="phrase">irq_set_irq_type</span></a></span><span class="refpurpose"> — 91 set the irq trigger type for an irq 92 </span></dt><dt><span class="refentrytitle"><a href="API-irq-set-handler-data.html"><span class="phrase">irq_set_handler_data</span></a></span><span class="refpurpose"> — 93 set irq handler data for an irq 94 </span></dt><dt><span class="refentrytitle"><a href="API-irq-set-chip-data.html"><span class="phrase">irq_set_chip_data</span></a></span><span class="refpurpose"> — 95 set irq chip data for an irq 96 </span></dt><dt><span class="refentrytitle"><a href="API-handle-simple-irq.html"><span class="phrase">handle_simple_irq</span></a></span><span class="refpurpose"> — 97 Simple and software-decoded IRQs. 98 </span></dt><dt><span class="refentrytitle"><a href="API-handle-level-irq.html"><span class="phrase">handle_level_irq</span></a></span><span class="refpurpose"> — 99 Level type irq handler 100 </span></dt><dt><span class="refentrytitle"><a href="API-handle-fasteoi-irq.html"><span class="phrase">handle_fasteoi_irq</span></a></span><span class="refpurpose"> — 101 irq handler for transparent controllers 102 </span></dt><dt><span class="refentrytitle"><a href="API-handle-edge-irq.html"><span class="phrase">handle_edge_irq</span></a></span><span class="refpurpose"> — 103 edge type IRQ handler 104 </span></dt></dl></dd><dt><span class="chapter"><a href="intfunctions.html">10. Internal Functions Provided</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="API---handle-domain-irq.html"><span class="phrase">__handle_domain_irq</span></a></span><span class="refpurpose"> — 105 Invoke the handler for a HW irq belonging to a domain 106 </span></dt><dt><span class="refentrytitle"><a href="API-irq-get-next-irq.html"><span class="phrase">irq_get_next_irq</span></a></span><span class="refpurpose"> — 107 get next allocated irq number 108 </span></dt><dt><span class="refentrytitle"><a href="API-kstat-irqs-cpu.html"><span class="phrase">kstat_irqs_cpu</span></a></span><span class="refpurpose"> — 109 Get the statistics for an interrupt on a cpu 110 </span></dt><dt><span class="refentrytitle"><a href="API-kstat-irqs.html"><span class="phrase">kstat_irqs</span></a></span><span class="refpurpose"> — 111 Get the statistics for an interrupt 112 </span></dt><dt><span class="refentrytitle"><a href="API-kstat-irqs-usr.html"><span class="phrase">kstat_irqs_usr</span></a></span><span class="refpurpose"> — 113 Get the statistics for an interrupt 114 </span></dt><dt><span class="refentrytitle"><a href="API-handle-bad-irq.html"><span class="phrase">handle_bad_irq</span></a></span><span class="refpurpose"> — 115 handle spurious and unhandled irqs 116 </span></dt><dt><span class="refentrytitle"><a href="API-irq-set-msi-desc-off.html"><span class="phrase">irq_set_msi_desc_off</span></a></span><span class="refpurpose"> — 117 set MSI descriptor data for an irq at offset 118 </span></dt><dt><span class="refentrytitle"><a href="API-irq-set-msi-desc.html"><span class="phrase">irq_set_msi_desc</span></a></span><span class="refpurpose"> — 119 set MSI descriptor data for an irq 120 </span></dt><dt><span class="refentrytitle"><a href="API-irq-disable.html"><span class="phrase">irq_disable</span></a></span><span class="refpurpose"> — 121 Mark interrupt disabled 122 </span></dt><dt><span class="refentrytitle"><a href="API-handle-edge-eoi-irq.html"><span class="phrase">handle_edge_eoi_irq</span></a></span><span class="refpurpose"> — 123 edge eoi type IRQ handler 124 </span></dt><dt><span class="refentrytitle"><a href="API-handle-percpu-irq.html"><span class="phrase">handle_percpu_irq</span></a></span><span class="refpurpose"> — 125 Per CPU local irq handler 126 </span></dt><dt><span class="refentrytitle"><a href="API-handle-percpu-devid-irq.html"><span class="phrase">handle_percpu_devid_irq</span></a></span><span class="refpurpose"> — 127 Per CPU local irq handler with per cpu dev ids 128 </span></dt><dt><span class="refentrytitle"><a href="API-irq-cpu-online.html"><span class="phrase">irq_cpu_online</span></a></span><span class="refpurpose"> — 129 Invoke all irq_cpu_online functions. 130 </span></dt><dt><span class="refentrytitle"><a href="API-irq-cpu-offline.html"><span class="phrase">irq_cpu_offline</span></a></span><span class="refpurpose"> — 131 Invoke all irq_cpu_offline functions. 132 </span></dt><dt><span class="refentrytitle"><a href="API-irq-chip-ack-parent.html"><span class="phrase">irq_chip_ack_parent</span></a></span><span class="refpurpose"> — 133 Acknowledge the parent interrupt 134 </span></dt><dt><span class="refentrytitle"><a href="API-irq-chip-mask-parent.html"><span class="phrase">irq_chip_mask_parent</span></a></span><span class="refpurpose"> — 135 Mask the parent interrupt 136 </span></dt><dt><span class="refentrytitle"><a href="API-irq-chip-unmask-parent.html"><span class="phrase">irq_chip_unmask_parent</span></a></span><span class="refpurpose"> — 137 Unmask the parent interrupt 138 </span></dt><dt><span class="refentrytitle"><a href="API-irq-chip-eoi-parent.html"><span class="phrase">irq_chip_eoi_parent</span></a></span><span class="refpurpose"> — 139 Invoke EOI on the parent interrupt 140 </span></dt><dt><span class="refentrytitle"><a href="API-irq-chip-set-affinity-parent.html"><span class="phrase">irq_chip_set_affinity_parent</span></a></span><span class="refpurpose"> — 141 Set affinity on the parent interrupt 142 </span></dt><dt><span class="refentrytitle"><a href="API-irq-chip-set-type-parent.html"><span class="phrase">irq_chip_set_type_parent</span></a></span><span class="refpurpose"> — 143 Set IRQ type on the parent interrupt 144 </span></dt><dt><span class="refentrytitle"><a href="API-irq-chip-retrigger-hierarchy.html"><span class="phrase">irq_chip_retrigger_hierarchy</span></a></span><span class="refpurpose"> — 145 Retrigger an interrupt in hardware 146 </span></dt><dt><span class="refentrytitle"><a href="API-irq-chip-set-wake-parent.html"><span class="phrase">irq_chip_set_wake_parent</span></a></span><span class="refpurpose"> — 147 Set/reset wake-up on the parent interrupt 148 </span></dt><dt><span class="refentrytitle"><a href="API-irq-chip-compose-msi-msg.html"><span class="phrase">irq_chip_compose_msi_msg</span></a></span><span class="refpurpose"> — 149 Componse msi message for a irq chip 150 </span></dt></dl></dd><dt><span class="chapter"><a href="credits.html">11. Credits</a></span></dt></dl></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="intro.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"> </td><td width="40%" align="right" valign="top"> Chapter 1. Introduction</td></tr></table></div></body></html> 151