kernel/irq/chip.c
Source file repositories/reference/linux-study-clean/kernel/irq/chip.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/irq/chip.c- Extension
.c- Size
- 42170 bytes
- Lines
- 1584
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/irq.hlinux/msi.hlinux/module.hlinux/interrupt.hlinux/kernel_stat.hlinux/irqdomain.hlinux/preempt.hlinux/random.htrace/events/irq.hinternals.h
Detected Declarations
function Copyrightfunction irq_set_chipfunction scoped_irqdesc_get_and_lockfunction irq_set_irq_typefunction irq_set_handler_datafunction irq_set_msi_desc_offfunction irq_set_msi_descfunction irq_set_chip_datafunction irq_state_clr_disabledfunction irq_state_clr_maskedfunction irq_state_clr_startedfunction irq_state_set_startedfunction __irq_startup_managedfunction irq_startup_managedfunction __irq_startup_managedfunction irq_enablefunction __irq_startupfunction irq_startupfunction irq_activatefunction irq_activate_and_startupfunction irq_shutdownfunction irq_shutdown_and_deactivatefunction __irq_disablefunction irq_disablefunction irq_percpu_enablefunction irq_percpu_disablefunction mask_ack_irqfunction mask_irqfunction unmask_irqfunction unmask_threaded_irqfunction irq_wait_on_inprogressfunction irq_can_handle_pmfunction handle_edge_irqfunction irq_can_handle_actionsfunction irq_can_handlefunction handle_nested_irqfunction scoped_guardfunction handle_simple_irqfunction handle_untracked_irqfunction handle_level_irqfunction handle_level_irqfunction cond_unmask_eoi_irqfunction irqd_irq_maskedfunction cond_eoi_irqfunction handle_fasteoi_irqfunction handle_fasteoi_nmifunction disablefunction handle_percpu_irq
Annotated Snippet
if (desc->irq_data.chip->irq_enable) {
desc->irq_data.chip->irq_enable(&desc->irq_data);
irq_state_clr_masked(desc);
} else {
unmask_irq(desc);
}
}
}
static int __irq_startup(struct irq_desc *desc)
{
struct irq_data *d = irq_desc_get_irq_data(desc);
int ret = 0;
/* Warn if this interrupt is not activated but try nevertheless */
WARN_ON_ONCE(!irqd_is_activated(d));
if (d->chip->irq_startup) {
ret = d->chip->irq_startup(d);
irq_state_clr_disabled(desc);
irq_state_clr_masked(desc);
} else {
irq_enable(desc);
}
irq_state_set_started(desc);
return ret;
}
int irq_startup(struct irq_desc *desc, bool resend, bool force)
{
struct irq_data *d = irq_desc_get_irq_data(desc);
const struct cpumask *aff = irq_data_get_affinity_mask(d);
int ret = 0;
desc->depth = 0;
if (irqd_is_started(d)) {
irq_enable(desc);
} else {
switch (__irq_startup_managed(desc, aff, force)) {
case IRQ_STARTUP_NORMAL:
if (d->chip->flags & IRQCHIP_AFFINITY_PRE_STARTUP)
irq_setup_affinity(desc);
ret = __irq_startup(desc);
if (!(d->chip->flags & IRQCHIP_AFFINITY_PRE_STARTUP))
irq_setup_affinity(desc);
break;
case IRQ_STARTUP_MANAGED:
irq_do_set_affinity(d, aff, false);
ret = __irq_startup(desc);
break;
case IRQ_STARTUP_ABORT:
desc->depth = 1;
irqd_set_managed_shutdown(d);
return 0;
}
}
if (resend)
check_irq_resend(desc, false);
return ret;
}
int irq_activate(struct irq_desc *desc)
{
struct irq_data *d = irq_desc_get_irq_data(desc);
if (!irqd_affinity_is_managed(d))
return irq_domain_activate_irq(d, false);
return 0;
}
int irq_activate_and_startup(struct irq_desc *desc, bool resend)
{
if (WARN_ON(irq_activate(desc)))
return 0;
return irq_startup(desc, resend, IRQ_START_FORCE);
}
static void __irq_disable(struct irq_desc *desc, bool mask);
void irq_shutdown(struct irq_desc *desc)
{
if (irqd_is_started(&desc->irq_data)) {
clear_irq_resend(desc);
/*
* Increment disable depth, so that a managed shutdown on
* CPU hotunplug preserves the actual disabled state when the
* CPU comes back online. See irq_startup_managed().
*/
Annotation
- Immediate include surface: `linux/irq.h`, `linux/msi.h`, `linux/module.h`, `linux/interrupt.h`, `linux/kernel_stat.h`, `linux/irqdomain.h`, `linux/preempt.h`, `linux/random.h`.
- Detected declarations: `function Copyright`, `function irq_set_chip`, `function scoped_irqdesc_get_and_lock`, `function irq_set_irq_type`, `function irq_set_handler_data`, `function irq_set_msi_desc_off`, `function irq_set_msi_desc`, `function irq_set_chip_data`, `function irq_state_clr_disabled`, `function irq_state_clr_masked`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.