kernel/irq/irqdomain.c
Source file repositories/reference/linux-study-clean/kernel/irq/irqdomain.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/irq/irqdomain.c- Extension
.c- Size
- 60740 bytes
- Lines
- 2163
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/debugfs.hlinux/hardirq.hlinux/interrupt.hlinux/irq.hlinux/irqdesc.hlinux/irqdomain.hlinux/module.hlinux/mutex.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/topology.hlinux/seq_file.hlinux/slab.hlinux/smp.hlinux/fs.hproc.hdebugfs.h
Detected Declarations
struct irqchip_fwidfunction debugfs_add_domain_dirfunction fwnode_handlefunction irq_domain_free_fwnodefunction alloc_namefunction alloc_fwnode_namefunction alloc_unknown_namefunction irq_domain_set_namefunction __irq_domain_publishfunction irq_domain_freefunction irq_domain_instantiate_descsfunction irq_domain_instantiatefunction irq_domain_removefunction irq_domain_update_bus_tokenfunction irq_domain_create_simplefunction irq_find_matching_fwspecfunction irq_set_default_domainfunction irq_get_default_domainfunction irq_domain_is_nomapfunction irq_domain_clear_mappingfunction irq_domain_set_mappingfunction irq_domain_disassociatefunction irq_domain_associate_lockedfunction irq_domain_associatefunction irq_domain_associate_manyfunction irq_create_direct_mappingfunction irq_create_mapping_affinity_lockedfunction irq_create_mapping_affinityfunction irq_domain_translatefunction of_phandle_args_to_fwspecfunction irq_populate_fwspec_infofunction irq_create_fwspec_mappingfunction irq_create_of_mappingfunction irq_dispose_mappingfunction __irq_resolve_mappingfunction irq_domain_xlate_onecellfunction irq_domain_xlate_twocellfunction irq_domain_xlate_twothreecellfunction irq_domain_xlate_onetwocellfunction irq_domain_translate_onecellfunction irq_domain_translate_twocellfunction irq_domain_translate_twothreecellfunction irq_domain_alloc_descsfunction irq_domain_reset_irq_datafunction irq_domain_insert_irqfunction irq_domain_remove_irqfunction __irq_domain_free_hierarchyfunction irq_domain_free_irq_data
Annotated Snippet
struct irqchip_fwid {
struct fwnode_handle fwnode;
struct fwnode_handle *parent;
unsigned int type;
char *name;
phys_addr_t *pa;
};
#ifdef CONFIG_GENERIC_IRQ_DEBUGFS
static void debugfs_add_domain_dir(struct irq_domain *d);
static void debugfs_remove_domain_dir(struct irq_domain *d);
#else
static inline void debugfs_add_domain_dir(struct irq_domain *d) { }
static inline void debugfs_remove_domain_dir(struct irq_domain *d) { }
#endif
static const char *irqchip_fwnode_get_name(const struct fwnode_handle *fwnode)
{
struct irqchip_fwid *fwid = container_of(fwnode, struct irqchip_fwid, fwnode);
return fwid->name;
}
static struct fwnode_handle *irqchip_fwnode_get_parent(const struct fwnode_handle *fwnode)
{
struct irqchip_fwid *fwid = container_of(fwnode, struct irqchip_fwid, fwnode);
return fwid->parent;
}
const struct fwnode_operations irqchip_fwnode_ops = {
.get_name = irqchip_fwnode_get_name,
.get_parent = irqchip_fwnode_get_parent,
};
EXPORT_SYMBOL_GPL(irqchip_fwnode_ops);
/**
* __irq_domain_alloc_fwnode - Allocate a fwnode_handle suitable for
* identifying an irq domain
* @type: Type of irqchip_fwnode. See linux/irqdomain.h
* @id: Optional user provided id if name != NULL
* @name: Optional user provided domain name
* @pa: Optional user-provided physical address
* @parent: Optional parent fwnode_handle
*
* Allocate a struct irqchip_fwid, and return a pointer to the embedded
* fwnode_handle (or NULL on failure).
*
* Note: The types IRQCHIP_FWNODE_NAMED and IRQCHIP_FWNODE_NAMED_ID are
* solely to transport name information to irqdomain creation code. The
* node is not stored. For other types the pointer is kept in the irq
* domain struct.
*/
struct fwnode_handle *__irq_domain_alloc_fwnode(unsigned int type, int id,
const char *name,
phys_addr_t *pa,
struct fwnode_handle *parent)
{
struct irqchip_fwid *fwid;
char *n;
fwid = kzalloc_obj(*fwid);
switch (type) {
case IRQCHIP_FWNODE_NAMED:
n = kasprintf(GFP_KERNEL, "%s", name);
break;
case IRQCHIP_FWNODE_NAMED_ID:
n = kasprintf(GFP_KERNEL, "%s-%d", name, id);
break;
default:
n = kasprintf(GFP_KERNEL, "irqchip@%pa", pa);
break;
}
if (!fwid || !n) {
kfree(fwid);
kfree(n);
return NULL;
}
fwid->type = type;
fwid->name = n;
fwid->pa = pa;
fwid->parent = parent;
fwnode_init(&fwid->fwnode, &irqchip_fwnode_ops);
return &fwid->fwnode;
}
EXPORT_SYMBOL_GPL(__irq_domain_alloc_fwnode);
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/debugfs.h`, `linux/hardirq.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/irqdesc.h`, `linux/irqdomain.h`, `linux/module.h`.
- Detected declarations: `struct irqchip_fwid`, `function debugfs_add_domain_dir`, `function fwnode_handle`, `function irq_domain_free_fwnode`, `function alloc_name`, `function alloc_fwnode_name`, `function alloc_unknown_name`, `function irq_domain_set_name`, `function __irq_domain_publish`, `function irq_domain_free`.
- 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.