Linux generic IRQ handling
Copyright: © 2005-2010: Thomas Gleixner
Copyright: © 2005-2006: Ingo Molnar
Introduction #
The generic interrupt handling layer is designed to provide a complete abstraction of interrupt handling for device drivers. It is able to handle all the different types of interrupt controller hardware. Device drivers use generic API functions to request, enable, disable and free interrupts. The drivers do not have to know anything about interrupt hardware details, so they can be used on different platforms without code changes.
This documentation is provided to developers who want to implement an interrupt subsystem based for their architecture, with the help of the generic IRQ handling layer.
Rationale #
The original implementation of interrupt handling in Linux uses the __do_IRQ() super-handler, which is able to deal with every type of interrupt logic.
Originally, Russell King identified different types of handlers to build a quite universal set for the ARM interrupt handler implementation in Linux 2.5/2.6. He distinguished between:
-
Level type
-
Edge type
-
Simple type
During the implementation we identified another type:
- Fast EOI type
In the SMP world of the __do_IRQ() super-handler another type was identified:
- Per CPU type
This split implementation of high-level IRQ handlers allows us to optimize the flow of the interrupt handling for each specific interrupt type. This reduces complexity in that particular code path and allows the optimized handling of a given type.
The original general IRQ implementation used hw_interrupt_type structures and their ->ack, ->end [etc.] callbacks to differentiate the flow control in the super-handler. This leads to a mix of flow logic and low-level hardware logic, and it also leads to unnecessary code duplication: for example in i386, there is an ioapic_level_irq and an ioapic_edge_irq IRQ-type which share many of the low-level details but have different flow handling.
A more natural abstraction is the clean separation of the 'irq flow' and the 'chip details'.
Analysing a couple of architecture's IRQ subsystem implementations reveals that most of them can use a generic set of 'irq flow' methods and only need to add the chip-level specific code. The separation is also valuable for (sub)architectures which need specific quirks in the IRQ flow itself but not in the chip details - and thus provides a more transparent IRQ subsystem design.
Each interrupt descriptor is assigned its own high-level flow handler, which is normally one of the generic implementations. (This high-level flow handler implementation also makes it simple to provide demultiplexing handlers which can be found in embedded platforms on various architectures.)
The separation makes the generic interrupt handling layer more flexible and extensible. For example, an (sub)architecture can use a generic IRQ-flow implementation for 'level type' interrupts and add a (sub)architecture specific 'edge type' implementation.
To make the transition to the new model easier and prevent the breakage of existing implementations, the __do_IRQ() super-handler is still available. This leads to a kind of duality for the time being. Over time the new model should be used in more and more architectures, as it enables smaller and cleaner IRQ subsystems. It's deprecated for three years now and about to be removed.
Known Bugs And Assumptions #
None (knock on wood).
Abstraction layers #
There are three main levels of abstraction in the interrupt code:
-
High-level driver API
-
High-level IRQ flow handlers
-
Chip-level hardware encapsulation
Interrupt control flow #
Each interrupt is described by an interrupt descriptor structure irq_desc. The interrupt is referenced by an 'unsigned int' numeric value which selects the corresponding interrupt description structure in the descriptor structures array. The descriptor structure contains status information and pointers to the interrupt flow method and the interrupt chip structure which are assigned to this interrupt.
Whenever an interrupt triggers, the low-level architecture code calls into the generic interrupt code by calling desc->handle_irq(). This high-level IRQ handling function only uses desc->irq_data.chip primitives referenced by the assigned chip descriptor structure.
High-level Driver API #
The high-level Driver API consists of following functions:
-
request_irq()
-
request_threaded_irq()
-
free_irq()
-
disable_irq()
-
enable_irq()
-
disable_irq_nosync() (SMP only)
-
synchronize_irq() (SMP only)
-
irq_set_irq_type()
-
irq_set_irq_wake()
-
irq_set_handler_data()
-
irq_set_chip()
-
irq_set_chip_data()
See the autogenerated function documentation for details.
High-level IRQ flow handlers #
The generic layer provides a set of pre-defined irq-flow methods:
-
handle_level_irq()
-
handle_edge_irq()
-
handle_fasteoi_irq()
-
handle_simple_irq()
-
handle_percpu_irq()
-
handle_edge_eoi_irq()
-
handle_bad_irq()
The interrupt flow handlers (either pre-defined or architecture specific) are assigned to specific interrupts by the architecture either during bootup or during device initialization.
Default flow implementations #
Helper functions #
The helper functions call the chip primitives and are used by the default flow implementations. The following helper functions are implemented (simplified excerpt):
default_enable(struct irq_data *data)
{
desc->irq_data.chip->irq_unmask(data);
}
default_disable(struct irq_data *data)
{
if (!delay_disable(data))
desc->irq_data.chip->irq_mask(data);
}
default_ack(struct irq_data *data)
{
chip->irq_ack(data);
}
default_mask_ack(struct irq_data *data)
{
if (chip->irq_mask_ack) {
chip->irq_mask_ack(data);
} else {
chip->irq_mask(data);
chip->irq_ack(data);
}
}
noop(struct irq_data *data)
{
}
Default flow handler implementations #
Default Level IRQ flow handler #
handle_level_irq provides a generic implementation for level-triggered interrupts.
The following control flow is implemented (simplified excerpt):
desc->irq_data.chip->irq_mask_ack();
handle_irq_event(desc->action);
desc->irq_data.chip->irq_unmask();
Default Fast EOI IRQ flow handler #
handle_fasteoi_irq provides a generic implementation for interrupts, which only need an EOI at the end of the handler.
The following control flow is implemented (simplified excerpt):
handle_irq_event(desc->action);
desc->irq_data.chip->irq_eoi();
Default Edge IRQ flow handler #
handle_edge_irq provides a generic implementation for edge-triggered interrupts.
The following control flow is implemented (simplified excerpt):
if (desc->status & running) {
desc->irq_data.chip->irq_mask_ack();
desc->status |= pending | masked;
return;
}
desc->irq_data.chip->irq_ack();
desc->status |= running;
do {
if (desc->status & masked)
desc->irq_data.chip->irq_unmask();
desc->status &= ~pending;
handle_irq_event(desc->action);
} while (desc->status & pending);
desc->status &= ~running;
Default simple IRQ flow handler #
handle_simple_irq provides a generic implementation for simple interrupts.
The following control flow is implemented (simplified excerpt):
handle_irq_event(desc->action);
Default per CPU flow handler #
handle_percpu_irq provides a generic implementation for per CPU interrupts.
Per CPU interrupts are only available on SMP and the handler provides a simplified version without locking.
The following control flow is implemented (simplified excerpt):
if (desc->irq_data.chip->irq_ack)
desc->irq_data.chip->irq_ack();
handle_irq_event(desc->action);
if (desc->irq_data.chip->irq_eoi)
desc->irq_data.chip->irq_eoi();
EOI Edge IRQ flow handler #
handle_edge_eoi_irq provides an abnomination of the edge handler which is solely used to tame a badly wreckaged irq controller on powerpc/cell.
Bad IRQ flow handler #
handle_bad_irq is used for spurious interrupts which have no real handler assigned..
Quirks and optimizations #
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 high-level irq-flow handler.
Delayed interrupt disable #
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 is not configurable.
Chip-level hardware encapsulation #
The chip-level hardware descriptor structure irq_chip contains all the direct chip relevant functions, which can be utilized by the irq flow implementations.
-
irq_ack -
irq_mask_ack- Optional, recommended for performance -
irq_mask -
irq_unmask -
irq_eoi- Optional, required for EOI flow handlers -
irq_retrigger- Optional -
irq_set_type- Optional -
irq_set_wake- Optional
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 low-level functionality.
__do_IRQ entry point #
The original implementation __do_IRQ() was an alternative entry point for all types of interrupts. It no longer exists.
This handler turned out to be not suitable for all interrupt hardware and was therefore reimplemented with split functionality for edge/level/simple/percpu interrupts. This is not only a functional optimization. It also shortens code paths for interrupts.
Locking on SMP #
The locking of chip registers is up to the architecture that defines the chip primitives. The per-irq structure is protected via desc->lock, by the generic layer.
Generic interrupt chip #
To avoid copies of identical implementations of IRQ chips the core provides a configurable generic interrupt chip implementation. Developers should check carefully whether the generic chip fits their needs before implementing the same functionality slightly differently themselves.
irq_gc_noop() #
void NOOP function
Parameters
struct irq_data *d: irq_data
irq_gc_mask_disable_reg() #
void Mask chip via disable register
Parameters
struct irq_data *d: irq_data
Description
Chip has separate enable/disable registers instead of a single mask register.
irq_gc_mask_set_bit() #
void Mask chip via setting bit in mask register
Parameters
struct irq_data *d: irq_data
Description
Chip has a single mask register. Values of this register are cached and protected by gc->lock
irq_gc_mask_clr_bit() #
void Mask chip via clearing bit in mask register
Parameters
struct irq_data *d: irq_data
Description
Chip has a single mask register. Values of this register are cached and protected by gc->lock
irq_gc_unmask_enable_reg() #
void Unmask chip via enable register
Parameters
struct irq_data *d: irq_data
Description
Chip has separate enable/disable registers instead of a single mask register.
irq_gc_ack_set_bit() #
void Ack pending interrupt via setting bit
Parameters
struct irq_data *d: irq_data
irq_gc_mask_disable_and_ack_set() #
void Mask and ack pending interrupt
Parameters
struct irq_data *d: irq_data
Description
This generic implementation of the irq_mask_ack method is for chips with separate enable/disable registers instead of a single mask register and where a pending interrupt is acknowledged by setting a bit.
Note
This is the only permutation currently used. Similar generic functions should be added here if other permutations are required.
irq_gc_set_wake() #
int Set/clr wake bit for an interrupt
Parameters
struct irq_data *d: irq_dataunsigned int on: Indicates whether the wake bit should be set or cleared
Description
For chips where the wake from suspend functionality is not configured in a separate register and the wakeup active state is just stored in a bitmask.
irq_alloc_generic_chip() #
struct irq_chip_generic * Allocate a generic chip and initialize it
Parameters
const char *name: Name of the irq chipint num_ct: Number of irq_chip_type instances associated with thisunsigned int irq_base: Interrupt base nr for this chipvoid __iomem *reg_base: Register base address (virtual)irq_flow_handler_t handler: Default flow handler associated with this chip
Description
Returns an initialized irq_chip_generic structure. The chip defaults to the primary (index 0) irq_chip_type and handler
irq_domain_alloc_generic_chips() #
int Allocate generic chips for an irq domain
Parameters
struct irq_domain *d: irq domain for which to allocate chipsconst struct irq_domain_chip_generic_info *info: Generic chip information
Return
0 on success, negative error code on failure
irq_domain_remove_generic_chips() #
void Remove generic chips from an irq domain
Parameters
struct irq_domain *d: irq domain for which generic chips are to be removed
__irq_alloc_domain_generic_chips() #
int Allocate generic chips for an irq domain
Parameters
struct irq_domain *d: irq domain for which to allocate chipsint irqs_per_chip: Number of interrupts each chip handles (max 32)int num_ct: Number of irq_chip_type instances associated with thisconst char *name: Name of the irq chipirq_flow_handler_t handler: Default flow handler associated with these chipsunsigned int clr: IRQ_* bits to clear in the mapping functionunsigned int set: IRQ_* bits to set in the mapping functionenum irq_gc_flags gcflags: Generic chip specific setup flags
irq_get_domain_generic_chip() #
struct irq_chip_generic * Get a pointer to the generic chip of a hw_irq
Parameters
struct irq_domain *d: irq domain pointerunsigned int hw_irq: Hardware interrupt number
irq_setup_generic_chip() #
void Setup a range of interrupts with a generic chip
Parameters
struct irq_chip_generic *gc: Generic irq chip holding all datau32 msk: Bitmask holding the irqs to initialize relative to gc->irq_baseenum irq_gc_flags flags: Flags for initializationunsigned int clr: IRQ_* bits to clearunsigned int set: IRQ_* bits to set
Description
Set up max. 32 interrupts starting from gc->irq_base. Note, this initializes all interrupts to the primary irq_chip_type and its associated handler.
irq_setup_alt_chip() #
int Switch to alternative chip
Parameters
struct irq_data *d: irq_data for this interruptunsigned int type: Flow type to be initialized
Description
Only to be called from chip->irq_set_type() callbacks.
irq_remove_generic_chip() #
void Remove a chip
Parameters
struct irq_chip_generic *gc: Generic irq chip holding all datau32 msk: Bitmask holding the irqs to initialize relative to gc->irq_baseunsigned int clr: IRQ_* bits to clearunsigned int set: IRQ_* bits to set
Description
Remove up to 32 interrupts starting from gc->irq_base.
Structures #
This chapter contains the autogenerated documentation of the structures which are used in the generic IRQ layer.
struct irq_common_data #
per irq data shared by all irqchips
Definition
;
Members
state_use_accessors: status information for irq chip functions. Use accessor functions to deal with itnode: node index useful for balancinghandler_data: per-IRQ data for the irq_chip methodsmsi_desc: MSI descriptoraffinity: IRQ affinity on SMP. If this is an IPI related irq, then this is the mask of the CPUs to which an IPI can be sent.effective_affinity: The effective IRQ affinity on SMP as some irq chips do not allow multi CPU destinations. A subset of affinity.ipi_offset: Offset of first IPI target cpu in affinity. Optional.
struct irq_data #
per irq chip data passed down to chip functions
Definition
;
Members
mask: precomputed bitmask for accessing the chip registersirq: interrupt numberhwirq: hardware interrupt number, local to the interrupt domaincommon: point to data shared by all irqchipschip: low level interrupt hardware accessdomain: Interrupt translation domain; responsible for mapping between hwirq number and linux irq number.parent_data: pointer to parent struct irq_data to support hierarchy irq_domainchip_data: platform-specific per-chip private data for the chip methods, to allow shared chip implementations
struct irq_chip #
hardware interrupt chip descriptor
Definition
;
Members
name: name for /proc/interruptsirq_startup: start up the interrupt (defaults to ->enable if NULL)irq_shutdown: shut down the interrupt (defaults to ->disable if NULL)irq_enable: enable the interrupt (defaults to chip->unmask if NULL)irq_disable: disable the interruptirq_ack: start of a new interruptirq_mask: mask an interrupt sourceirq_mask_ack: ack and mask an interrupt sourceirq_unmask: unmask an interrupt sourceirq_eoi: end of interruptirq_set_affinity: Set the CPU affinity on SMP machines. If the force argument is true, it tells the driver to unconditionally apply the affinity setting. Sanity checks against the supplied affinity mask are not required. This is used for CPU hotplug where the target CPU is not yet set in the cpu_online_mask.irq_pre_redirect: Optional function to be invoked before redirecting an interrupt via irq_work. Called only on CONFIG_SMP.irq_retrigger: resend an IRQ to the CPUirq_set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQirq_set_wake: enable/disable power-management wake-on of an IRQirq_bus_lock: function to lock access to slow bus (i2c) chipsirq_bus_sync_unlock: function to sync and unlock slow bus (i2c) chipsirq_cpu_online: configure an interrupt source for a secondary CPUirq_cpu_offline: un-configure an interrupt source for a secondary CPUirq_suspend: function called from core code on suspend once per chip, when one or more interrupts are installedirq_resume: function called from core code on resume once per chip, when one ore more interrupts are installedirq_pm_shutdown: function called from core code on shutdown once per chipirq_calc_mask: Optional function to set irq_data.mask for special casesirq_print_chip: optional to print special chip info in show_interruptsirq_request_resources: optional to request resources before calling any other callback related to this irqirq_release_resources: optional to release resources acquired with irq_request_resourcesirq_compose_msi_msg: optional to compose message content for MSIirq_write_msi_msg: optional to write message content for MSIirq_get_irqchip_state: return the internal state of an interruptirq_set_irqchip_state: set the internal state of a interruptirq_set_vcpu_affinity: optional to target a vCPU in a virtual machineipi_send_single: send a single IPI to destination cpusipi_send_mask: send an IPI to destination cpus in cpumaskirq_nmi_setup: function called from core code before enabling an NMIirq_nmi_teardown: function called from core code after disabling an NMIirq_force_complete_move: optional function to force complete pending irq moveflags: chip specific flags
struct irq_chip_regs #
register offsets for struct irq_gci
Definition
;
Members
enable: Enable register offset to reg_basedisable: Disable register offset to reg_basemask: Mask register offset to reg_baseack: Ack register offset to reg_baseeoi: Eoi register offset to reg_basetype: Type configuration register offset to reg_base
struct irq_chip_type #
Generic interrupt chip instance for a flow type
Definition
;
Members
chip: The real interrupt chip which provides the callbacksregs: Register offsets for this chiphandler: Flow handler associated with this chiptype: Chip can handle these flow typesmask_cache_priv: Cached mask register private to the chip typemask_cache: Pointer to cached mask register
Description
A irq_generic_chip can have several instances of irq_chip_type when it requires different functions and register offsets for different flow types.
struct irq_chip_generic #
Generic irq chip data structure
Definition
;
Members
lock: Lock to protect register and cache data accessreg_base: Register base address (virtual)reg_readl: Alternate I/O accessor (defaults to readl if NULL)reg_writel: Alternate I/O accessor (defaults to writel if NULL)suspend: Function called from core code on suspend once per chip; can be useful instead of irq_chip::suspend to handle chip details even when no interrupts are in useresume: Function called from core code on resume once per chip; can be useful instead of irq_chip::suspend to handle chip details even when no interrupts are in useirq_base: Interrupt base nr for this chipirq_cnt: Number of interrupts handled by this chipmask_cache: Cached mask register shared between all chip typeswake_enabled: Interrupt can wakeup from suspendwake_active: Interrupt is marked as an wakeup from suspend sourcenum_ct: Number of available irq_chip_type instances (usually 1)private: Private data for non generic chip callbacksinstalled: bitfield to denote installed interruptsunused: bitfield to denote unused interruptsdomain: irq domain pointerlist: List head for keeping track of instanceschip_types: Array of interrupt irq_chip_types
Description
Note, that irq_chip_generic can have multiple irq_chip_type implementations which can be associated to a particular irq line of an irq_chip_generic instance. That allows to share and protect state in an irq_chip_generic instance when we need to implement different flow mechanisms (level/edge) for it.
enum irq_gc_flags #
Initialization flags for generic irq chips
Constants
IRQ_GC_INIT_MASK_CACHE: Initialize the mask_cache by reading mask regIRQ_GC_INIT_NESTED_LOCK: Set the lock class of the irqs to nested for irq chips which need to callirq_set_wake()on the parent irq. Usually GPIO implementationsIRQ_GC_MASK_CACHE_PER_TYPE: Mask cache is chip type privateIRQ_GC_NO_MASK: Do not calculate irq_data->maskIRQ_GC_BE_IO: Use big-endian register accesses (default: LE)
struct irq_domain_chip_generic_info #
Generic chip information structure
Definition
;
Members
name: Name of the generic interrupt chiphandler: Interrupt handler used by the generic interrupt chipirqs_per_chip: Number of interrupts each chip handles (max 32)num_ct: Number of irq_chip_type instances associated with each chipirq_flags_to_clear: IRQ_* bits to clear in the mapping functionirq_flags_to_set: IRQ_* bits to set in the mapping functiongc_flags: Generic chip specific setup flagsinit: Function called on each chip when they are created. Allow to do some additional chip initialisation.exit: Function called on each chip when they are destroyed. Allow to do some chip cleanup operation.
struct irqaction #
per interrupt action descriptor
Definition
;
Members
handler: interrupt handler function{unnamed_union}: anonymousdev_id: cookie to identify the devicepercpu_dev_id: cookie to identify the deviceaffinity: CPUs this irqaction is allowed to run onnext: pointer to the next irqaction for shared interruptsthread_fn: interrupt handler function for threaded interruptsthread: thread pointer for threaded interruptssecondary: pointer to secondary irqaction (force threading)irq: interrupt numberflags: flags (see IRQF_* above)thread_flags: flags related to threadthread_mask: bitmask for keeping track of thread activityname: name of the devicedir: pointer to the proc/irq/NN/name entry
request_irq() #
int Add a handler for an interrupt line
Parameters
unsigned int irq: The interrupt line to allocateirq_handler_t handler: Function to be called when the IRQ occurs. Primary handler for threaded interrupts If NULL, the default primary handler is installedunsigned long flags: Handling flagsconst char *name: Name of the device generating this interruptvoid *dev: A cookie passed to the handler function
Description
This call allocates an interrupt and establishes a handler; see
the documentation for request_threaded_irq() for details.
struct irq_affinity_notify #
context for notification of IRQ affinity changes
Definition
;
Members
irq: Interrupt to which notification applieskref: Reference count, for internal usework: Work item, for internal usenotify: Function to be called on change. This will be called in process context.release: Function to be called on release. This will be called in process context. Once registered, the structure must only be freed when this function is called or later.
struct irq_affinity #
Description for automatic irq affinity assignments
Definition
;
Members
pre_vectors: Don't apply affinity to pre_vectors at beginning of the MSI(-X) vector spacepost_vectors: Don't apply affinity to post_vectors at end of the MSI(-X) vector spacenr_sets: The number of interrupt sets for which affinity spreading is requiredset_size: Array holding the size of each interrupt setcalc_sets: Callback for calculating the number and size of interrupt setspriv: Private data for usage by calc_sets, usually a pointer to driver/device specific data.
struct irq_affinity_desc #
Interrupt affinity descriptor
Definition
;
Members
mask: cpumask to hold the affinity assignmentis_managed: 1 if the interrupt is managed internally
irq_update_affinity_hint() #
int Update the affinity hint
Parameters
unsigned int irq: Interrupt to updateconst struct cpumask *m: cpumask pointer (NULL to clear the hint)
Description
Updates the affinity hint, but does not change the affinity of the interrupt.
irq_set_affinity_and_hint() #
int Update the affinity hint and apply the provided cpumask to the interrupt
Parameters
unsigned int irq: Interrupt to updateconst struct cpumask *m: cpumask pointer (NULL to clear the hint)
Description
Updates the affinity hint and if m is not NULL it applies it as the affinity of that interrupt.
Public Functions Provided #
This chapter contains the autogenerated documentation of the kernel API functions which are exported.
synchronize_hardirq() #
bool wait for pending hard IRQ handlers (on other CPUs)
Parameters
unsigned int irq: interrupt number to wait for
Description
This function waits for any pending hard IRQ handlers for this interrupt to complete before returning. If you use this function while holding a resource the IRQ handler may need you will deadlock. It does not take associated threaded handlers into account.
Do not use this for shutdown scenarios where you must be sure that all parts (hardirq and threaded handler) have completed.
This function may be called - with care - from IRQ context.
It does not check whether there is an interrupt in flight at the hardware level, but not serviced yet, as this might deadlock when called with interrupts disabled and the target CPU of the interrupt is the current CPU.
Return
false if a threaded handler is active.
synchronize_irq() #
void wait for pending IRQ handlers (on other CPUs)
Parameters
unsigned int irq: interrupt number to wait for
Description
This function waits for any pending IRQ handlers for this interrupt to complete before returning. If you use this function while holding a resource the IRQ handler may need you will deadlock.
Can only be called from preemptible code as it might sleep when an interrupt thread is associated to irq.
It optionally makes sure (when the irq chip supports that method) that the interrupt is not pending in any CPU and waiting for service.
irq_can_set_affinity() #
int Check if the affinity of a given irq can be set
Parameters
unsigned int irq: Interrupt to check
irq_can_set_affinity_usr() #
bool Check if affinity of a irq can be set from user space
Parameters
unsigned int irq: Interrupt to check
Description
Like irq_can_set_affinity() above, but additionally checks for the
AFFINITY_MANAGED flag.
irq_set_thread_affinity() #
void Notify irq threads to adjust affinity
Parameters
struct irq_desc *desc: irq descriptor which has affinity changed
Description
Just set IRQTF_AFFINITY and delegate the affinity setting to the
interrupt thread itself. We can not call set_cpus_allowed_ptr() here as
we hold desc->lock and this code can be called from hard interrupt
context.
irq_affinity_schedule_notify_work() #
void Schedule work to notify about affinity change
Parameters
struct irq_desc *desc: Interrupt descriptor whose affinity changed
irq_update_affinity_desc() #
int Update affinity management for an interrupt
Parameters
unsigned int irq: The interrupt number to updatestruct irq_affinity_desc *affinity: Pointer to the affinity descriptor
Description
This interface can be used to configure the affinity management of interrupts which have been allocated already.
There are certain limitations on when it may be used - attempts to use it for when the kernel is configured for generic IRQ reservation mode (in config GENERIC_IRQ_RESERVATION_MODE) will fail, as it may conflict with managed/non-managed interrupt accounting. In addition, attempts to use it on an interrupt which is already started or which has already been configured as managed will also fail, as these mean invalid init state or double init.
irq_set_affinity() #
int Set the irq affinity of a given irq
Parameters
unsigned int irq: Interrupt to set affinityconst struct cpumask *cpumask: cpumask
Description
Fails if cpumask does not contain an online CPU
irq_force_affinity() #
int Force the irq affinity of a given irq
Parameters
unsigned int irq: Interrupt to set affinityconst struct cpumask *cpumask: cpumask
Description
Same as irq_set_affinity, but without checking the mask against online cpus.
Solely for low level cpu hotplug code, where we need to make per cpu interrupts affine before the cpu becomes online.
irq_set_affinity_notifier() #
int control notification of IRQ affinity changes
Parameters
unsigned int irq: Interrupt for which to enable/disable notificationstruct irq_affinity_notify *notify: Context for notification, orNULLto disable notification. Function pointers must be initialised; the other fields will be initialised by this function.
Description
Must be called in process context. Notification may only be enabled
after the IRQ is allocated and must be disabled before the IRQ is freed
using free_irq().
irq_set_vcpu_affinity() #
int Set vcpu affinity for the interrupt
Parameters
unsigned int irq: interrupt number to set affinityvoid *vcpu_info: vCPU specific data or pointer to a percpu array of vCPU specific data for percpu_devid interrupts
Description
This function uses the vCPU specific data to set the vCPU affinity for
an irq. The vCPU specific data is passed from outside, such as KVM. One
example code path is as below: KVM -> IOMMU -> irq_set_vcpu_affinity().
disable_irq_nosync() #
void disable an irq without waiting
Parameters
unsigned int irq: Interrupt to disable
Description
Disable the selected interrupt line. Disables and Enables are
nested.
Unlike disable_irq(), this function does not ensure existing
instances of the IRQ handler have completed before returning.
This function may be called from IRQ context.
disable_irq() #
void disable an irq and wait for completion
Parameters
unsigned int irq: Interrupt to disable
Description
Disable the selected interrupt line. Enables and Disables are nested.
This function waits for any pending IRQ handlers for this interrupt to complete before returning. If you use this function while holding a resource the IRQ handler may need you will deadlock.
Can only be called from preemptible code as it might sleep when an interrupt thread is associated to irq.
disable_hardirq() #
bool disables an irq and waits for hardirq completion
Parameters
unsigned int irq: Interrupt to disable
Description
Disable the selected interrupt line. Enables and Disables are nested.
This function waits for any pending hard IRQ handlers for this interrupt to complete before returning. If you use this function while holding a resource the hard IRQ handler may need you will deadlock.
When used to optimistically disable an interrupt from atomic context the return value must be checked.
This function may be called - with care - from IRQ context.
Return
false if a threaded handler is active.
disable_nmi_nosync() #
void disable an nmi without waiting
Parameters
unsigned int irq: Interrupt to disable
Description
Disable the selected interrupt line. Disables and enables are nested.
The interrupt to disable must have been requested through request_nmi.
Unlike disable_nmi(), this function does not ensure existing
instances of the IRQ handler have completed before returning.
enable_irq() #
void enable handling of an irq
Parameters
unsigned int irq: Interrupt to enable
Description
Undoes the effect of one call to disable_irq(). If this matches the
last disable, processing of interrupts on this IRQ line is re-enabled.
This function may be called from IRQ context only when desc->irq_data.chip->bus_lock and desc->chip->bus_sync_unlock are NULL !
enable_nmi() #
void enable handling of an nmi
Parameters
unsigned int irq: Interrupt to enable
Description
The interrupt to enable must have been requested through request_nmi.
Undoes the effect of one call to disable_nmi(). If this matches the last
disable, processing of interrupts on this IRQ line is re-enabled.
irq_set_irq_wake() #
int control irq power management wakeup
Parameters
unsigned int irq: interrupt to controlunsigned int on: enable/disable power management wakeup
Description
Enable/disable power management wakeup mode, which is disabled by default. Enables and disables must match, just as they match for non-wakeup mode support.
Wakeup mode lets this IRQ wake the system from sleep states like "suspend to RAM".
Note
irq enable/disable state is completely orthogonal to the
enable/disable state of irq wake. An irq can be disabled with
disable_irq() and still wake the system as long as the irq has wake
enabled. If this does not hold, then the underlying irq chip and the
related driver need to be investigated.
irq_wake_thread() #
void wake the irq thread for the action identified by dev_id
Parameters
unsigned int irq: Interrupt linevoid *dev_id: Device identity for which the thread should be woken
free_irq() #
const void * free an interrupt allocated with request_irq
Parameters
unsigned int irq: Interrupt line to freevoid *dev_id: Device identity to free
Description
Remove an interrupt handler. The handler is removed and if the interrupt line is no longer in use by any driver it is disabled. On a shared IRQ the caller must ensure the interrupt is disabled on the card it drives before calling this function. The function does not return until any executing interrupts for this IRQ have completed.
This function must not be called from interrupt context.
Returns the devname argument passed to request_irq.
request_threaded_irq() #
int allocate an interrupt line
Parameters
unsigned int irq: Interrupt line to allocateirq_handler_t handler: Function to be called when the IRQ occurs. Primary handler for threaded interrupts. If handler is NULL and thread_fn != NULL the default primary handler is installed.irq_handler_t thread_fn: Function called from the irq handler thread If NULL, no irq thread is createdunsigned long irqflags: Interrupt type flagsconst char *devname: An ascii name for the claiming devicevoid *dev_id: A cookie passed back to the handler function
Description
This call allocates interrupt resources and enables the interrupt line and IRQ handling. From the point this call is made your handler function may be invoked. Since your handler function must clear any interrupt the board raises, you must take care both to initialise your hardware and to set up the interrupt handler in the right order.
If you want to set up a threaded irq handler for your device then you need to supply handler and thread_fn. handler is still called in hard interrupt context and has to check whether the interrupt originates from the device. If yes it needs to disable the interrupt on the device and return IRQ_WAKE_THREAD which will wake up the handler thread and run thread_fn. This split handler design is necessary to support shared interrupts.
dev_id must be globally unique. Normally the address of the device data structure is used as the cookie. Since the handler receives this value it makes sense to use it.
If your interrupt is shared you must pass a non NULL dev_id as this is required when freeing the interrupt.
Flags:
IRQF_SHARED Interrupt is shared IRQF_TRIGGER_* Specify active edge(s) or level IRQF_ONESHOT Run thread_fn with interrupt line masked
request_any_context_irq() #
int allocate an interrupt line
Parameters
unsigned int irq: Interrupt line to allocateirq_handler_t handler: Function to be called when the IRQ occurs. Threaded handler for threaded interrupts.unsigned long flags: Interrupt type flagsconst char *name: An ascii name for the claiming devicevoid *dev_id: A cookie passed back to the handler function
Description
This call allocates interrupt resources and enables the interrupt line and IRQ handling. It selects either a hardirq or threaded handling method depending on the context.
Return
On failure, it returns a negative value. On success, it returns either IRQC_IS_HARDIRQ or IRQC_IS_NESTED.
request_nmi() #
int allocate an interrupt line for NMI delivery
Parameters
unsigned int irq: Interrupt line to allocateirq_handler_t handler: Function to be called when the IRQ occurs. Threaded handler for threaded interrupts.unsigned long irqflags: Interrupt type flagsconst char *name: An ascii name for the claiming devicevoid *dev_id: A cookie passed back to the handler function
Description
This call allocates interrupt resources and enables the interrupt line and IRQ handling. It sets up the IRQ line to be handled as an NMI.
An interrupt line delivering NMIs cannot be shared and IRQ handling cannot be threaded.
Interrupt lines requested for NMI delivering must produce per cpu interrupts and have auto enabling setting disabled.
dev_id must be globally unique. Normally the address of the device data structure is used as the cookie. Since the handler receives this value it makes sense to use it.
If the interrupt line cannot be used to deliver NMIs, function will fail and return a negative value.
irq_percpu_is_enabled() #
bool Check whether the per cpu irq is enabled
Parameters
unsigned int irq: Linux irq number to check for
Description
Must be called from a non migratable context. Returns the enable state of a per cpu interrupt on the current cpu.
free_percpu_irq() #
void free an interrupt allocated with request_percpu_irq
Parameters
unsigned int irq: Interrupt line to freevoid __percpu *dev_id: Device identity to free
Description
Remove a percpu interrupt handler. The handler is removed, but the interrupt line is not disabled. This must be done on each CPU before calling this function. The function does not return until any executing interrupts for this IRQ have completed.
This function must not be called from interrupt context.
request_percpu_irq_affinity() #
int allocate a percpu interrupt line
Parameters
unsigned int irq: Interrupt line to allocateirq_handler_t handler: Function to be called when the IRQ occurs.const char *devname: An ascii name for the claiming deviceconst cpumask_t *affinity: A cpumask describing the target CPUs for this interruptvoid __percpu *dev_id: A percpu cookie passed back to the handler function
Description
This call allocates interrupt resources, but doesn't enable the interrupt
on any CPU, as all percpu-devid interrupts are flagged with IRQ_NOAUTOEN.
It has to be done on each CPU using enable_percpu_irq().
dev_id must be globally unique. It is a per-cpu variable, and the handler gets called with the interrupted CPU's instance of that variable.
request_percpu_nmi() #
int allocate a percpu interrupt line for NMI delivery
Parameters
unsigned int irq: Interrupt line to allocateirq_handler_t handler: Function to be called when the IRQ occurs.const char *name: An ascii name for the claiming deviceconst struct cpumask *affinity: A cpumask describing the target CPUs for this interruptvoid __percpu *dev_id: A percpu cookie passed back to the handler function
Description
This call allocates interrupt resources for a per CPU NMI. Per CPU NMIs
have to be setup on each CPU by calling prepare_percpu_nmi() before
being enabled on the same CPU by using enable_percpu_nmi().
dev_id must be globally unique. It is a per-cpu variable, and the handler gets called with the interrupted CPU's instance of that variable.
Interrupt lines requested for NMI delivering should have auto enabling setting disabled.
If the interrupt line cannot be used to deliver NMIs, function will fail returning a negative value.
prepare_percpu_nmi() #
int performs CPU local setup for NMI delivery
Parameters
unsigned int irq: Interrupt line to prepare for NMI delivery
Description
This call prepares an interrupt line to deliver NMI on the current CPU,
before that interrupt line gets enabled with enable_percpu_nmi().
As a CPU local operation, this should be called from non-preemptible context.
If the interrupt line cannot be used to deliver NMIs, function will fail returning a negative value.
teardown_percpu_nmi() #
void undoes NMI setup of IRQ line
Parameters
unsigned int irq: Interrupt line from which CPU local NMI configuration should be removed
Description
This call undoes the setup done by prepare_percpu_nmi().
IRQ line should not be enabled for the current CPU. As a CPU local operation, this should be called from non-preemptible context.
irq_get_irqchip_state() #
int returns the irqchip state of a interrupt.
Parameters
unsigned int irq: Interrupt line that is forwarded to a VMenum irqchip_irq_state which: One of IRQCHIP_STATE_* the caller wants to know aboutbool *state: a pointer to a boolean where the state is to be stored
Description
This call snapshots the internal irqchip state of an interrupt, returning into state the bit corresponding to stage which
This function should be called with preemption disabled if the interrupt controller has per-cpu registers.
irq_set_irqchip_state() #
int set the state of a forwarded interrupt.
Parameters
unsigned int irq: Interrupt line that is forwarded to a VMenum irqchip_irq_state which: State to be restored (one of IRQCHIP_STATE_*)bool val: Value corresponding to which
Description
This call sets the internal irqchip state of an interrupt, depending on the value of which.
This function should be called with migration disabled if the interrupt controller has per-cpu registers.
irq_has_action() #
bool Check whether an interrupt is requested
Parameters
unsigned int irq: The linux irq number
Return
A snapshot of the current state
irq_check_status_bit() #
bool Check whether bits in the irq descriptor status are set
Parameters
unsigned int irq: The linux irq numberunsigned int bitmask: The bitmask to evaluate
Return
True if one of the bits in bitmask is set
irq_set_chip() #
int set the irq chip for an irq
Parameters
unsigned int irq: irq numberconst struct irq_chip *chip: pointer to irq chip description structure
irq_set_irq_type() #
int set the irq trigger type for an irq
Parameters
unsigned int irq: irq numberunsigned int type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
irq_set_handler_data() #
int set irq handler data for an irq
Parameters
unsigned int irq: Interrupt numbervoid *data: Pointer to interrupt specific data
Description
Set the hardware irq controller data for an irq
irq_set_chip_data() #
int set irq chip data for an irq
Parameters
unsigned int irq: Interrupt numbervoid *data: Pointer to chip specific data
Description
Set the hardware irq chip data for an irq
handle_nested_irq() #
void Handle a nested irq from a irq thread
Parameters
unsigned int irq: the interrupt number
Description
Handle interrupts which are nested into a threaded interrupt handler. The handler function is called inside the calling threads context.
handle_simple_irq() #
void Simple and software-decoded IRQs.
Parameters
struct irq_desc *desc: the interrupt description structure for this irq
Description
Simple interrupts are either sent from a demultiplexing interrupt handler or come from hardware, where no interrupt hardware control is necessary.
Note
The caller is expected to handle the ack, clear, mask and unmask issues if necessary.
handle_untracked_irq() #
void Simple and software-decoded IRQs.
Parameters
struct irq_desc *desc: the interrupt description structure for this irq
Description
Untracked interrupts are sent from a demultiplexing interrupt handler when the demultiplexer does not know which device it its multiplexed irq domain generated the interrupt. IRQ's handled through here are not subjected to stats tracking, randomness, or spurious interrupt detection.
Note
Like handle_simple_irq, the caller is expected to handle the ack, clear, mask and unmask issues if necessary.
handle_level_irq() #
void Level type irq handler
Parameters
struct irq_desc *desc: the interrupt description structure for this irq
Description
Level type interrupts are active as long as the hardware line has the active level. This may require to mask the interrupt and unmask it after the associated handler has acknowledged the device, so the interrupt line is back to inactive.
handle_fasteoi_irq() #
void irq handler for transparent controllers
Parameters
struct irq_desc *desc: the interrupt description structure for this irq
Description
Only a single callback will be issued to the chip: an ->eoi() call when
the interrupt has been serviced. This enables support for modern forms
of interrupt handlers, which handle the flow details in hardware,
transparently.
handle_fasteoi_nmi() #
void irq handler for NMI interrupt lines
Parameters
struct irq_desc *desc: the interrupt description structure for this irq
Description
A simple NMI-safe handler, considering the restrictions from request_nmi.
Only a single callback will be issued to the chip: an ->eoi()
call when the interrupt has been serviced. This enables support
for modern forms of interrupt handlers, which handle the flow
details in hardware, transparently.
handle_edge_irq() #
void edge type IRQ handler
Parameters
struct irq_desc *desc: the interrupt description structure for this irq
Description
Interrupt occurs on the falling and/or rising edge of a hardware signal. The occurrence is latched into the irq controller hardware and must be acked in order to be reenabled. After the ack another interrupt can happen on the same source even before the first one is handled by the associated event handler. If this happens it might be necessary to disable (mask) the interrupt depending on the controller hardware. This requires to reenable the interrupt inside of the loop which handles the interrupts which have arrived while the handler was running. If all pending interrupts are handled, the loop is left.
handle_fasteoi_ack_irq() #
void irq handler for edge hierarchy stacked on transparent controllers
Parameters
struct irq_desc *desc: the interrupt description structure for this irq
Description
Like handle_fasteoi_irq(), but for use with hierarchy where the irq_chip
also needs to have its ->irq_ack() function called.
handle_fasteoi_mask_irq() #
void irq handler for level hierarchy stacked on transparent controllers
Parameters
struct irq_desc *desc: the interrupt description structure for this irq
Description
Like handle_fasteoi_irq(), but for use with hierarchy where the irq_chip
also needs to have its ->irq_mask_ack() function called.
irq_chip_set_parent_state() #
int set the state of a parent interrupt.
Parameters
struct irq_data *data: Pointer to interrupt specific dataenum irqchip_irq_state which: State to be restored (one of IRQCHIP_STATE_*)bool val: Value corresponding to which
Description
Conditional success, if the underlying irqchip does not implement it.
irq_chip_get_parent_state() #
int get the state of a parent interrupt.
Parameters
struct irq_data *data: Pointer to interrupt specific dataenum irqchip_irq_state which: one of IRQCHIP_STATE_* the caller wants to knowbool *state: a pointer to a boolean where the state is to be stored
Description
Conditional success, if the underlying irqchip does not implement it.
irq_chip_shutdown_parent() #
void Shutdown the parent interrupt
Parameters
struct irq_data *data: Pointer to interrupt specific data
Description
Invokes the irq_shutdown() callback of the parent if available or falls
back to irq_chip_disable_parent().
irq_chip_startup_parent() #
unsigned int Startup the parent interrupt
Parameters
struct irq_data *data: Pointer to interrupt specific data
Description
Invokes the irq_startup() callback of the parent if available or falls
back to irq_chip_enable_parent().
irq_chip_enable_parent() #
void Enable the parent interrupt (defaults to unmask if NULL)
Parameters
struct irq_data *data: Pointer to interrupt specific data
irq_chip_disable_parent() #
void Disable the parent interrupt (defaults to mask if NULL)
Parameters
struct irq_data *data: Pointer to interrupt specific data
irq_chip_ack_parent() #
void Acknowledge the parent interrupt
Parameters
struct irq_data *data: Pointer to interrupt specific data
irq_chip_mask_parent() #
void Mask the parent interrupt
Parameters
struct irq_data *data: Pointer to interrupt specific data
irq_chip_mask_ack_parent() #
void Mask and acknowledge the parent interrupt
Parameters
struct irq_data *data: Pointer to interrupt specific data
irq_chip_unmask_parent() #
void Unmask the parent interrupt
Parameters
struct irq_data *data: Pointer to interrupt specific data
irq_chip_eoi_parent() #
void Invoke EOI on the parent interrupt
Parameters
struct irq_data *data: Pointer to interrupt specific data
irq_chip_set_affinity_parent() #
int Set affinity on the parent interrupt
Parameters
struct irq_data *data: Pointer to interrupt specific dataconst struct cpumask *dest: The affinity mask to setbool force: Flag to enforce setting (disable online checks)
Description
Conditional, as the underlying parent chip might not implement it.
irq_chip_set_type_parent() #
int Set IRQ type on the parent interrupt
Parameters
struct irq_data *data: Pointer to interrupt specific dataunsigned int type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
Description
Conditional, as the underlying parent chip might not implement it.
irq_chip_retrigger_hierarchy() #
int Retrigger an interrupt in hardware
Parameters
struct irq_data *data: Pointer to interrupt specific data
Description
Iterate through the domain hierarchy of the interrupt and check whether a hw retrigger function exists. If yes, invoke it.
irq_chip_set_vcpu_affinity_parent() #
int Set vcpu affinity on the parent interrupt
Parameters
struct irq_data *data: Pointer to interrupt specific datavoid *vcpu_info: The vcpu affinity information
irq_chip_set_wake_parent() #
int Set/reset wake-up on the parent interrupt
Parameters
struct irq_data *data: Pointer to interrupt specific dataunsigned int on: Whether to set or reset the wake-up capability of this irq
Description
Conditional, as the underlying parent chip might not implement it.
irq_chip_request_resources_parent() #
int Request resources on the parent interrupt
Parameters
struct irq_data *data: Pointer to interrupt specific data
irq_chip_release_resources_parent() #
void Release resources on the parent interrupt
Parameters
struct irq_data *data: Pointer to interrupt specific data
Internal Functions Provided #
This chapter contains the autogenerated documentation of the internal functions.
irq_get_nr_irqs() #
unsigned int Number of interrupts supported by the system.
Parameters
void: no arguments
irq_set_nr_irqs() #
unsigned int Set the number of interrupts supported by the system.
Parameters
unsigned int nr: New number of interrupts.
Return
nr.
generic_handle_irq() #
int Invoke the handler for a particular irq
Parameters
unsigned int irq: The irq number to handle
Return
0 on success, or -EINVAL if conversion has failed
Description
This function must be called from an IRQ context with irq regs initialized.
generic_handle_irq_safe() #
int Invoke the handler for a particular irq from any context.
Parameters
unsigned int irq: The irq number to handle
Return
0 on success, a negative value on error.
Description
This function can be called from any context (IRQ or process context). It will report an error if not invoked from IRQ context and the irq has been marked to enforce IRQ-context only.
generic_handle_domain_irq() #
int Invoke the handler for a HW irq belonging to a domain.
Parameters
struct irq_domain *domain: The domain where to perform the lookupirq_hw_number_t hwirq: The HW irq number to convert to a logical one
Return
0 on success, or -EINVAL if conversion has failed
Description
This function must be called from an IRQ context with irq regs initialized.
generic_handle_domain_nmi() #
int Invoke the handler for a HW nmi belonging to a domain.
Parameters
struct irq_domain *domain: The domain where to perform the lookupirq_hw_number_t hwirq: The HW irq number to convert to a logical one
Return
0 on success, or -EINVAL if conversion has failed
Description
This function must be called from an NMI context with irq regs initialized.
generic_handle_demux_domain_irq() #
bool Invoke the handler for a hardware interrupt of a demultiplexing domain.
Parameters
struct irq_domain *domain: The domain where to perform the lookupirq_hw_number_t hwirq: The hardware interrupt number to convert to a logical one
Return
True on success, or false if lookup has failed
irq_free_descs() #
void free irq descriptors
Parameters
unsigned int from: Start of descriptor rangeunsigned int cnt: Number of consecutive irqs to free
__irq_alloc_descs() #
int __ref allocate and initialize a range of irq descriptors
Parameters
int irq: Allocate for specific irq number if irq >= 0unsigned int from: Start the search from this irq numberunsigned int cnt: Number of consecutive irqs to allocate.int node: Preferred node on which the irq descriptor should be allocatedstruct module *owner: Owning module (can be NULL)const struct irq_affinity_desc *affinity: Optional pointer to an affinity mask array of size cnt which hints where the irq descriptors should be allocated and which default affinities to use
Description
Returns the first irq number or error code
irq_get_next_irq() #
unsigned int get next allocated irq number
Parameters
unsigned int offset: where to start the search
Description
Returns next irq number after offset or nr_irqs if none is found.
kstat_irqs_cpu() #
unsigned int Get the statistics for an interrupt on a cpu
Parameters
unsigned int irq: The interrupt numberint cpu: The cpu number
Description
Returns the sum of interrupt counts on cpu since boot for irq. The caller must ensure that the interrupt is not removed concurrently.
kstat_irqs_usr() #
unsigned int Get the statistics for an interrupt from thread context
Parameters
unsigned int irq: The interrupt number
Description
Returns the sum of interrupt counts on all cpus since boot for irq.
It uses rcu to protect the access since a concurrent removal of an
interrupt descriptor is observing an rcu grace period before
delayed_free_desc()/irq_kobj_release().
handle_bad_irq() #
void handle spurious and unhandled irqs
Parameters
struct irq_desc *desc: description of the interrupt
Description
Handles spurious and unhandled IRQ's. It also prints a debugmessage.
generic_handle_arch_irq() #
void noinstr root irq handler for architectures which do no entry accounting themselves
Parameters
struct pt_regs *regs: Register file coming from the low-level handling code
irq_set_msi_desc_off() #
int set MSI descriptor data for an irq at offset
Parameters
unsigned int irq_base: Interrupt number baseunsigned int irq_offset: Interrupt number offsetstruct msi_desc *entry: Pointer to MSI descriptor data
Description
Set the MSI descriptor entry for an irq at offset
irq_set_msi_desc() #
int set MSI descriptor data for an irq
Parameters
unsigned int irq: Interrupt numberstruct msi_desc *entry: Pointer to MSI descriptor data
Description
Set the MSI descriptor entry for an irq
irq_disable() #
void Mark interrupt disabled
Parameters
struct irq_desc *desc: irq descriptor which should be disabled
Description
If the chip does not implement the irq_disable callback, we use a lazy disable approach. That means we mark the interrupt disabled, but leave the hardware unmasked. That's an optimization because we avoid the hardware access for the common case where no interrupt happens after we marked it disabled. If an interrupt happens, then the interrupt flow handler masks the line at the hardware level and marks it pending.
If the interrupt chip does not implement the irq_disable callback, a driver can disable the lazy approach for a particular irq line by calling 'irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY)'. This can be used for devices which cannot disable the interrupt at the device level under certain circumstances and have to use disable_irq[_nosync] instead.
handle_percpu_irq() #
void Per CPU local irq handler
Parameters
struct irq_desc *desc: the interrupt description structure for this irq
Description
Per CPU interrupts on SMP machines without locking requirements
handle_percpu_devid_irq() #
void Per CPU local irq handler with per cpu dev ids
Parameters
struct irq_desc *desc: the interrupt description structure for this irq
Description
Per CPU interrupts on SMP machines without locking requirements. Same as
handle_percpu_irq() above but with the following extras:
action->percpu_dev_id is a pointer to percpu variables which contain the real device id for the cpu on which this handler is called
irq_cpu_online() #
void Invoke all irq_cpu_online functions.
Parameters
void: no arguments
Description
Iterate through all irqs and invoke the chip.irq_cpu_online()
for each.
irq_cpu_offline() #
void Invoke all irq_cpu_offline functions.
Parameters
void: no arguments
Description
Iterate through all irqs and invoke the chip.irq_cpu_offline()
for each.
irq_chip_compose_msi_msg() #
int Compose msi message for a irq chip
Parameters
struct irq_data *data: Pointer to interrupt specific datastruct msi_msg *msg: Pointer to the MSI message
Description
For hierarchical domains we find the first chip in the hierarchy which implements the irq_compose_msi_msg callback. For non hierarchical we use the top level chip.
irq_chip_pm_get() #
int Enable power for an IRQ chip
Parameters
struct irq_data *data: Pointer to interrupt specific data
Description
Enable the power to the IRQ chip referenced by the interrupt data structure.
irq_chip_pm_put() #
void Drop a PM reference on an IRQ chip
Parameters
struct irq_data *data: Pointer to interrupt specific data
Description
Drop a power management reference, acquired via irq_chip_pm_get(), on the IRQ
chip represented by the interrupt data structure.
Note that this will not disable power to the IRQ chip until this function
has been called for all IRQs that have called irq_chip_pm_get() and it may
not disable power at all (if user space prevents that, for example).
Credits #
The following people have contributed to this document:
-
Thomas Gleixner tglx@kernel.org
-
Ingo Molnar mingo@elte.hu