<!DOCTYPE html>
<html lang="en" data-content_root="../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Interrupts — The Linux Kernel documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=3918102e" />
<script src="../../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../../_static/doctools.js?v=9bcbadda"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Kernel mode NEON" href="kernel_mode_neon.html" />
<link rel="prev" title="Interface for registering and calling firmware-specific operations for ARM" href="firmware.html" />
<link rel="stylesheet" href="../../_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/logo.svg" alt="Logo of The Linux Kernel"/>
</a></p>
<h1 class="logo"><a href="../../index.html">The Linux Kernel</a></h1>
<p class="blurb">6.18.50</p>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<p>
<h3 class="kernel-toc-contents">Contents</h3>
<input type="checkbox" class="kernel-toc-toggle" id = "kernel-toc-toggle" checked>
<label class="kernel-toc-title" for="kernel-toc-toggle"></label>
<div class="kerneltoc" id="kerneltoc">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../process/development-process.html">Development process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/submitting-patches.html">Submitting patches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/code-of-conduct.html">Code of conduct</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../maintainer/index.html">Maintainer handbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/index.html">All development-process docs</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../core-api/index.html">Core API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../driver-api/index.html">Driver APIs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../subsystem-apis.html">Subsystems</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../locking/index.html">Locking</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../process/license-rules.html">Licensing rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../doc-guide/index.html">Writing documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev-tools/index.html">Development tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev-tools/testing-overview.html">Testing guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../kernel-hacking/index.html">Hacking guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../trace/index.html">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../fault-injection/index.html">Fault injection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../livepatch/index.html">Livepatching</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rust/index.html">Rust</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../admin-guide/index.html">Administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../kbuild/index.html">Build system</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../admin-guide/reporting-issues.html">Reporting issues</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../tools/index.html">Userspace tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../userspace-api/index.html">Userspace API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../firmware-guide/index.html">Firmware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../devicetree/index.html">Firmware and Devicetree</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">CPU architectures</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../arc/index.html">ARC architecture</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="index.html">ARM Architecture</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="arm.html">ARM Linux 2.6 and upper</a></li>
<li class="toctree-l3"><a class="reference internal" href="booting.html">Booting ARM Linux</a></li>
<li class="toctree-l3"><a class="reference internal" href="cluster-pm-race-avoidance.html">Cluster-wide Power-up/power-down race avoidance algorithm</a></li>
<li class="toctree-l3"><a class="reference internal" href="firmware.html">Interface for registering and calling firmware-specific operations for ARM</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">Interrupts</a></li>
<li class="toctree-l3"><a class="reference internal" href="kernel_mode_neon.html">Kernel mode NEON</a></li>
<li class="toctree-l3"><a class="reference internal" href="kernel_user_helpers.html">Kernel-provided User Helpers</a></li>
<li class="toctree-l3"><a class="reference internal" href="memory.html">Kernel Memory Layout on ARM Linux</a></li>
<li class="toctree-l3"><a class="reference internal" href="mem_alignment.html">Memory alignment</a></li>
<li class="toctree-l3"><a class="reference internal" href="tcm.html">ARM TCM (Tightly-Coupled Memory) handling in Linux</a></li>
<li class="toctree-l3"><a class="reference internal" href="setup.html">Kernel initialisation parameters on ARM Linux</a></li>
<li class="toctree-l3"><a class="reference internal" href="swp_emulation.html">Software emulation of deprecated SWP instruction (CONFIG_SWP_EMULATE)</a></li>
<li class="toctree-l3"><a class="reference internal" href="uefi.html">The Unified Extensible Firmware Interface (UEFI)</a></li>
<li class="toctree-l3"><a class="reference internal" href="vlocks.html">vlocks for Bare-Metal Mutual Exclusion</a></li>
<li class="toctree-l3"><a class="reference internal" href="porting.html">Porting</a></li>
<li class="toctree-l3"><a class="reference internal" href="features.html">Feature status on arm architecture</a></li>
<li class="toctree-l3"><a class="reference internal" href="index.html#soc-specific-documents">SoC-specific documents</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../arm64/index.html">ARM64 Architecture</a></li>
<li class="toctree-l2"><a class="reference internal" href="../loongarch/index.html">LoongArch Architecture</a></li>
<li class="toctree-l2"><a class="reference internal" href="../m68k/index.html">m68k Architecture</a></li>
<li class="toctree-l2"><a class="reference internal" href="../mips/index.html">MIPS-specific Documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="../nios2/index.html">Nios II Specific Documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="../openrisc/index.html">OpenRISC Architecture</a></li>
<li class="toctree-l2"><a class="reference internal" href="../parisc/index.html">PA-RISC Architecture</a></li>
<li class="toctree-l2"><a class="reference internal" href="../powerpc/index.html">powerpc</a></li>
<li class="toctree-l2"><a class="reference internal" href="../riscv/index.html">RISC-V architecture</a></li>
<li class="toctree-l2"><a class="reference internal" href="../s390/index.html">s390 Architecture</a></li>
<li class="toctree-l2"><a class="reference internal" href="../sh/index.html">SuperH Interfaces Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="../sparc/index.html">Sparc Architecture</a></li>
<li class="toctree-l2"><a class="reference internal" href="../x86/index.html">x86-specific Documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="../xtensa/index.html">Xtensa Architecture</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../staging/index.html">Unsorted documentation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../translations/index.html">Translations</a></li>
</ul>
</div>
<script type="text/javascript"> <!--
var sbar = document.getElementsByClassName("sphinxsidebar")[0];
let currents = document.getElementsByClassName("current")
if (currents.length) {
sbar.scrollTop = currents[currents.length - 1].offsetTop;
}
--> </script>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../_sources/arch/arm/interrupts.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="interrupts">
<h1>Interrupts<a class="headerlink" href="#interrupts" title="Link to this heading">¶</a></h1>
<dl class="simple">
<dt>2.5.2-rmk5:</dt><dd><p>This is the first kernel that contains a major shake up of some of the
major architecture-specific subsystems.</p>
</dd>
</dl>
<p>Firstly, it contains some pretty major changes to the way we handle the
MMU TLB. Each MMU TLB variant is now handled completely separately -
we have TLB v3, TLB v4 (without write buffer), TLB v4 (with write buffer),
and finally TLB v4 (with write buffer, with I TLB invalidate entry).
There is more assembly code inside each of these functions, mainly to
allow more flexible TLB handling for the future.</p>
<p>Secondly, the IRQ subsystem.</p>
<p>The 2.5 kernels will be having major changes to the way IRQs are handled.
Unfortunately, this means that machine types that touch the irq_desc[]
array (basically all machine types) will break, and this means every
machine type that we currently have.</p>
<p>Lets take an example. On the Assabet with Neponset, we have:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> GPIO25 IRR:2
SA1100 ------------> Neponset -----------> SA1111
IIR:1
-----------> USAR
IIR:0
-----------> SMC9196
</pre></div>
</div>
<p>The way stuff currently works, all SA1111 interrupts are mutually
exclusive of each other - if you’re processing one interrupt from the
SA1111 and another comes in, you have to wait for that interrupt to
finish processing before you can service the new interrupt. Eg, an
IDE PIO-based interrupt on the SA1111 excludes all other SA1111 and
SMC9196 interrupts until it has finished transferring its multi-sector
data, which can be a long time. Note also that since we loop in the
SA1111 IRQ handler, SA1111 IRQs can hold off SMC9196 IRQs indefinitely.</p>
<p>The new approach brings several new ideas...</p>
<p>We introduce the concept of a “parent” and a “child”. For example,
to the Neponset handler, the “parent” is GPIO25, and the “children”d
are SA1111, SMC9196 and USAR.</p>
<p>We also bring the idea of an IRQ “chip” (mainly to reduce the size of
the irqdesc array). This doesn’t have to be a real “IC”; indeed the
SA11x0 IRQs are handled by two separate “chip” structures, one for
GPIO0-10, and another for all the rest. It is just a container for
the various operations (maybe this’ll change to a better name).
This structure has the following operations:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct irqchip {
/*
* Acknowledge the IRQ.
* If this is a level-based IRQ, then it is expected to mask the IRQ
* as well.
*/
void (*ack)(unsigned int irq);
/*
* Mask the IRQ in hardware.
*/
void (*mask)(unsigned int irq);
/*
* Unmask the IRQ in hardware.
*/
void (*unmask)(unsigned int irq);
/*
* Re-run the IRQ
*/
void (*rerun)(unsigned int irq);
/*
* Set the type of the IRQ.
*/
int (*type)(unsigned int irq, unsigned int, type);
};
</pre></div>
</div>
<dl class="simple">
<dt>ack</dt><dd><ul class="simple">
<li><p>required. May be the same function as mask for IRQs
handled by do_level_IRQ.</p></li>
</ul>
</dd>
<dt>mask</dt><dd><ul class="simple">
<li><p>required.</p></li>
</ul>
</dd>
<dt>unmask</dt><dd><ul class="simple">
<li><p>required.</p></li>
</ul>
</dd>
<dt>rerun</dt><dd><ul class="simple">
<li><p>optional. Not required if you’re using do_level_IRQ for all
IRQs that use this ‘irqchip’. Generally expected to re-trigger
the hardware IRQ if possible. If not, may call the handler
directly.</p></li>
</ul>
</dd>
<dt>type</dt><dd><ul class="simple">
<li><p>optional. If you don’t support changing the type of an IRQ,
it should be null so people can detect if they are unable to
set the IRQ type.</p></li>
</ul>
</dd>
</dl>
<p>For each IRQ, we keep the following information:</p>
<blockquote>
<div><ul class="simple">
<li><p>“disable” depth (number of <a class="reference internal" href="../../core-api/genericirq.html#c.disable_irq" title="disable_irq"><code class="xref c c-func docutils literal notranslate"><span class="pre">disable_irq()</span></code></a>s without <a class="reference internal" href="../../core-api/genericirq.html#c.enable_irq" title="enable_irq"><code class="xref c c-func docutils literal notranslate"><span class="pre">enable_irq()</span></code></a>s)</p></li>
<li><p>flags indicating what we can do with this IRQ (valid, probe,
noautounmask) as before</p></li>
<li><p>status of the IRQ (probing, enable, etc)</p></li>
<li><p>chip</p></li>
<li><p>per-IRQ handler</p></li>
<li><p>irqaction structure list</p></li>
</ul>
</div></blockquote>
<p>The handler can be one of the 3 standard handlers - “level”, “edge” and
“simple”, or your own specific handler if you need to do something special.</p>
<p>The “level” handler is what we currently have - its pretty simple.
“edge” knows about the brokenness of such IRQ implementations - that you
need to leave the hardware IRQ enabled while processing it, and queueing
further IRQ events should the IRQ happen again while processing. The
“simple” handler is very basic, and does not perform any hardware
manipulation, nor state tracking. This is useful for things like the
SMC9196 and USAR above.</p>
<section id="so-what-s-changed">
<h2>So, what’s changed?<a class="headerlink" href="#so-what-s-changed" title="Link to this heading">¶</a></h2>
<ol class="arabic">
<li><p>Machine implementations must not write to the irqdesc array.</p></li>
<li><p>New functions to manipulate the irqdesc array. The first 4 are expected
to be useful only to machine specific code. The last is recommended to
only be used by machine specific code, but may be used in drivers if
absolutely necessary.</p>
<blockquote>
<div><dl class="simple">
<dt>set_irq_chip(irq,chip)</dt><dd><p>Set the mask/unmask methods for handling this IRQ</p>
</dd>
<dt>set_irq_handler(irq,handler)</dt><dd><p>Set the handler for this IRQ (level, edge, simple)</p>
</dd>
<dt>set_irq_chained_handler(irq,handler)</dt><dd><p>Set a “chained” handler for this IRQ - automatically
enables this IRQ (eg, Neponset and SA1111 handlers).</p>
</dd>
<dt>set_irq_flags(irq,flags)</dt><dd><p>Set the valid/probe/noautoenable flags.</p>
</dd>
<dt>set_irq_type(irq,type)</dt><dd><p>Set active the IRQ edge(s)/level. This replaces the
SA1111 INTPOL manipulation, and the <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">set_GPIO_IRQ_edge()</span></code>
function. Type should be one of IRQ_TYPE_xxx defined in
<linux/irq.h></p>
</dd>
</dl>
</div></blockquote>
</li>
<li><p><code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">set_GPIO_IRQ_edge()</span></code> is obsolete, and should be replaced by set_irq_type.</p></li>
<li><p>Direct access to SA1111 INTPOL is deprecated. Use set_irq_type instead.</p></li>
<li><p>A handler is expected to perform any necessary acknowledgement of the
parent IRQ via the correct chip specific function. For instance, if
the SA1111 is directly connected to a SA1110 GPIO, then you should
acknowledge the SA1110 IRQ each time you re-read the SA1111 IRQ status.</p></li>
<li><p>For any child which doesn’t have its own IRQ enable/disable controls
(eg, SMC9196), the handler must mask or acknowledge the parent IRQ
while the child handler is called, and the child handler should be the
“simple” handler (not “edge” nor “level”). After the handler completes,
the parent IRQ should be unmasked, and the status of all children must
be re-checked for pending events. (see the Neponset IRQ handler for
details).</p></li>
<li><p><code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">fixup_irq()</span></code> is gone, as is <cite>arch/arm/mach-*/include/mach/irq.h</cite></p></li>
</ol>
<p>Please note that this will not solve all problems - some of them are
hardware based. Mixing level-based and edge-based IRQs on the same
parent signal (eg neponset) is one such area where a software based
solution can’t provide the full answer to low IRQ latency.</p>
</section>
</section>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©The kernel development community.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
& <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="../../_sources/arch/arm/interrupts.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>