📄 genericirq.tmpl
字号:
}default_disable(irq){ if (!delay_disable(irq)) desc->chip->mask(irq);}default_ack(irq){ chip->ack(irq);}default_mask_ack(irq){ if (chip->mask_ack) { chip->mask_ack(irq); } else { chip->mask(irq); chip->ack(irq); }}noop(irq){} </programlisting> </para> </sect3> </sect2> <sect2> <title>Default flow handler implementations</title> <sect3> <title>Default Level IRQ flow handler</title> <para> handle_level_irq provides a generic implementation for level-triggered interrupts. </para> <para> The following control flow is implemented (simplified excerpt): <programlisting>desc->chip->start();handle_IRQ_event(desc->action);desc->chip->end(); </programlisting> </para> </sect3> <sect3> <title>Default Edge IRQ flow handler</title> <para> handle_edge_irq provides a generic implementation for edge-triggered interrupts. </para> <para> The following control flow is implemented (simplified excerpt): <programlisting>if (desc->status & running) { desc->chip->hold(); desc->status |= pending | masked; return;}desc->chip->start();desc->status |= running;do { if (desc->status & masked) desc->chip->enable(); desc->status &= ~pending; handle_IRQ_event(desc->action);} while (status & pending);desc->status &= ~running;desc->chip->end(); </programlisting> </para> </sect3> <sect3> <title>Default simple IRQ flow handler</title> <para> handle_simple_irq provides a generic implementation for simple interrupts. </para> <para> Note: The simple flow handler does not call any handler/chip primitives. </para> <para> The following control flow is implemented (simplified excerpt): <programlisting>handle_IRQ_event(desc->action); </programlisting> </para> </sect3> <sect3> <title>Default per CPU flow handler</title> <para> handle_percpu_irq provides a generic implementation for per CPU interrupts. </para> <para> Per CPU interrupts are only available on SMP and the handler provides a simplified version without locking. </para> <para> The following control flow is implemented (simplified excerpt): <programlisting>desc->chip->start();handle_IRQ_event(desc->action);desc->chip->end(); </programlisting> </para> </sect3> </sect2> <sect2> <title>Quirks and optimizations</title> <para> The generic functions are intended for 'clean' architectures and chips, which have no platform-specific IRQ handling quirks. If an architecture needs to implement quirks on the 'flow' level then it can do so by overriding the highlevel irq-flow handler. </para> </sect2> <sect2> <title>Delayed interrupt disable</title> <para> This per interrupt selectable feature, which was introduced by Russell King in the ARM interrupt implementation, does not mask an interrupt at the hardware level when disable_irq() is called. The interrupt is kept enabled and is masked in the flow handler when an interrupt event happens. This prevents losing edge interrupts on hardware which does not store an edge interrupt event while the interrupt is disabled at the hardware level. When an interrupt arrives while the IRQ_DISABLED flag is set, then the interrupt is masked at the hardware level and the IRQ_PENDING bit is set. When the interrupt is re-enabled by enable_irq() the pending bit is checked and if it is set, the interrupt is resent either via hardware or by a software resend mechanism. (It's necessary to enable CONFIG_HARDIRQS_SW_RESEND when you want to use the delayed interrupt disable feature and your hardware is not capable of retriggering an interrupt.) The delayed interrupt disable can be runtime enabled, per interrupt, by setting the IRQ_DELAYED_DISABLE flag in the irq_desc status field. </para> </sect2> </sect1> <sect1> <title>Chiplevel hardware encapsulation</title> <para> The chip level hardware descriptor structure irq_chip contains all the direct chip relevant functions, which can be utilized by the irq flow implementations. <itemizedlist> <listitem><para>ack()</para></listitem> <listitem><para>mask_ack() - Optional, recommended for performance</para></listitem> <listitem><para>mask()</para></listitem> <listitem><para>unmask()</para></listitem> <listitem><para>retrigger() - Optional</para></listitem> <listitem><para>set_type() - Optional</para></listitem> <listitem><para>set_wake() - Optional</para></listitem> </itemizedlist> These primitives are strictly intended to mean what they say: ack means ACK, masking means masking of an IRQ line, etc. It is up to the flow handler(s) to use these basic units of lowlevel functionality. </para> </sect1> </chapter> <chapter id="doirq"> <title>__do_IRQ entry point</title> <para> The original implementation __do_IRQ() is an alternative entry point for all types of interrupts. </para> <para> This handler turned out to be not suitable for all interrupt hardware and was therefore reimplemented with split functionality for egde/level/simple/percpu interrupts. This is not only a functional optimization. It also shortens code paths for interrupts. </para> <para> To make use of the split implementation, replace the call to __do_IRQ by a call to desc->chip->handle_irq() and associate the appropriate handler function to desc->chip->handle_irq(). In most cases the generic handler implementations should be sufficient. </para> </chapter> <chapter id="locking"> <title>Locking on SMP</title> <para> The locking of chip registers is up to the architecture that defines the chip primitives. There is a chip->lock field that can be used for serialization, but the generic layer does not touch it. The per-irq structure is protected via desc->lock, by the generic layer. </para> </chapter> <chapter id="structs"> <title>Structures</title> <para> This chapter contains the autogenerated documentation of the structures which are used in the generic IRQ layer. </para>!Iinclude/linux/irq.h </chapter> <chapter id="pubfunctions"> <title>Public Functions Provided</title> <para> This chapter contains the autogenerated documentation of the kernel API functions which are exported. </para>!Ekernel/irq/manage.c!Ekernel/irq/chip.c </chapter> <chapter id="intfunctions"> <title>Internal Functions Provided</title> <para> This chapter contains the autogenerated documentation of the internal functions. </para>!Ikernel/irq/handle.c!Ikernel/irq/chip.c </chapter> <chapter id="credits"> <title>Credits</title> <para> The following people have contributed to this document: <orderedlist> <listitem><para>Thomas Gleixner<email>tglx@linutronix.de</email></para></listitem> <listitem><para>Ingo Molnar<email>mingo@elte.hu</email></para></listitem> </orderedlist> </para> </chapter></book>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -