1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Chapter 2. Rationale</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux generic IRQ handling"><link rel="up" href="index.html" title="Linux generic IRQ handling"><link rel="prev" href="intro.html" title="Chapter 1. Introduction"><link rel="next" href="bugs.html" title="Chapter 3. Known Bugs And Assumptions"></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">Chapter 2. Rationale</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="intro.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="bugs.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="rationale"></a>Chapter 2. Rationale</h1></div></div></div><p> 2 The original implementation of interrupt handling in Linux uses 3 the __do_IRQ() super-handler, which is able to deal with every 4 type of interrupt logic. 5 </p><p> 6 Originally, Russell King identified different types of handlers to 7 build a quite universal set for the ARM interrupt handler 8 implementation in Linux 2.5/2.6. He distinguished between: 9 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Level type</p></li><li class="listitem"><p>Edge type</p></li><li class="listitem"><p>Simple type</p></li></ul></div><p> 10 During the implementation we identified another type: 11 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Fast EOI type</p></li></ul></div><p> 12 In the SMP world of the __do_IRQ() super-handler another type 13 was identified: 14 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Per CPU type</p></li></ul></div><p> 15 </p><p> 16 This split implementation of high-level IRQ handlers allows us to 17 optimize the flow of the interrupt handling for each specific 18 interrupt type. This reduces complexity in that particular code path 19 and allows the optimized handling of a given type. 20 </p><p> 21 The original general IRQ implementation used hw_interrupt_type 22 structures and their ->ack(), ->end() [etc.] callbacks to 23 differentiate the flow control in the super-handler. This leads to 24 a mix of flow logic and low-level hardware logic, and it also leads 25 to unnecessary code duplication: for example in i386, there is an 26 ioapic_level_irq and an ioapic_edge_irq IRQ-type which share many 27 of the low-level details but have different flow handling. 28 </p><p> 29 A more natural abstraction is the clean separation of the 30 'irq flow' and the 'chip details'. 31 </p><p> 32 Analysing a couple of architecture's IRQ subsystem implementations 33 reveals that most of them can use a generic set of 'irq flow' 34 methods and only need to add the chip-level specific code. 35 The separation is also valuable for (sub)architectures 36 which need specific quirks in the IRQ flow itself but not in the 37 chip details - and thus provides a more transparent IRQ subsystem 38 design. 39 </p><p> 40 Each interrupt descriptor is assigned its own high-level flow 41 handler, which is normally one of the generic 42 implementations. (This high-level flow handler implementation also 43 makes it simple to provide demultiplexing handlers which can be 44 found in embedded platforms on various architectures.) 45 </p><p> 46 The separation makes the generic interrupt handling layer more 47 flexible and extensible. For example, an (sub)architecture can 48 use a generic IRQ-flow implementation for 'level type' interrupts 49 and add a (sub)architecture specific 'edge type' implementation. 50 </p><p> 51 To make the transition to the new model easier and prevent the 52 breakage of existing implementations, the __do_IRQ() super-handler 53 is still available. This leads to a kind of duality for the time 54 being. Over time the new model should be used in more and more 55 architectures, as it enables smaller and cleaner IRQ subsystems. 56 It's deprecated for three years now and about to be removed. 57 </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="intro.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="bugs.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 1. Introduction </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 3. Known Bugs And Assumptions</td></tr></table></div></body></html> 58