drivers/iommu/irq_remapping.c
Source file repositories/reference/linux-study-clean/drivers/iommu/irq_remapping.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iommu/irq_remapping.c- Extension
.c- Size
- 3632 bytes
- Lines
- 168
- Domain
- Driver Families
- Bucket
- drivers/iommu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/cpumask.hlinux/kernel.hlinux/string.hlinux/errno.hlinux/msi.hlinux/irq.hlinux/pci.hlinux/irqdomain.hasm/hw_irq.hasm/irq_remapping.hasm/processor.hasm/x86_init.hasm/apic.hasm/hpet.hirq_remapping.h
Detected Declarations
function irq_remapping_restore_boot_irq_modefunction irq_remapping_modify_x86_opsfunction setup_nointremapfunction setup_irqremapfunction set_irq_remapping_brokenfunction irq_remapping_capfunction irq_remapping_preparefunction irq_remapping_enablefunction irq_remapping_disablefunction irq_remapping_reenablefunction irq_remap_enable_fault_handlingfunction panic_if_irq_remapexport irq_remapping_cap
Annotated Snippet
if (!strncmp(str, "on", 2)) {
disable_irq_remap = 0;
disable_irq_post = 0;
} else if (!strncmp(str, "off", 3)) {
disable_irq_remap = 1;
disable_irq_post = 1;
} else if (!strncmp(str, "nosid", 5))
disable_sourceid_checking = 1;
else if (!strncmp(str, "no_x2apic_optout", 16))
no_x2apic_optout = 1;
else if (!strncmp(str, "nopost", 6))
disable_irq_post = 1;
else if (IS_ENABLED(CONFIG_X86_POSTED_MSI) && !strncmp(str, "posted_msi", 10))
enable_posted_msi = true;
str += strcspn(str, ",");
while (*str == ',')
str++;
}
return 0;
}
early_param("intremap", setup_irqremap);
void set_irq_remapping_broken(void)
{
irq_remap_broken = 1;
}
bool irq_remapping_cap(enum irq_remap_cap cap)
{
if (!remap_ops || disable_irq_post)
return false;
return (remap_ops->capability & (1 << cap));
}
EXPORT_SYMBOL_GPL(irq_remapping_cap);
int __init irq_remapping_prepare(void)
{
if (disable_irq_remap)
return -ENOSYS;
if (IS_ENABLED(CONFIG_INTEL_IOMMU) &&
intel_irq_remap_ops.prepare() == 0)
remap_ops = &intel_irq_remap_ops;
else if (IS_ENABLED(CONFIG_AMD_IOMMU) &&
amd_iommu_irq_ops.prepare() == 0)
remap_ops = &amd_iommu_irq_ops;
else if (IS_ENABLED(CONFIG_HYPERV) &&
hyperv_irq_remap_ops.prepare() == 0)
remap_ops = &hyperv_irq_remap_ops;
else
return -ENOSYS;
return 0;
}
int __init irq_remapping_enable(void)
{
int ret;
if (!remap_ops->enable)
return -ENODEV;
ret = remap_ops->enable();
if (irq_remapping_enabled)
irq_remapping_modify_x86_ops();
return ret;
}
void irq_remapping_disable(void)
{
if (irq_remapping_enabled && remap_ops->disable)
remap_ops->disable();
}
int irq_remapping_reenable(int mode)
{
if (irq_remapping_enabled && remap_ops->reenable)
return remap_ops->reenable(mode);
return 0;
}
int __init irq_remap_enable_fault_handling(void)
{
if (!irq_remapping_enabled)
return 0;
Annotation
- Immediate include surface: `linux/cpumask.h`, `linux/kernel.h`, `linux/string.h`, `linux/errno.h`, `linux/msi.h`, `linux/irq.h`, `linux/pci.h`, `linux/irqdomain.h`.
- Detected declarations: `function irq_remapping_restore_boot_irq_mode`, `function irq_remapping_modify_x86_ops`, `function setup_nointremap`, `function setup_irqremap`, `function set_irq_remapping_broken`, `function irq_remapping_cap`, `function irq_remapping_prepare`, `function irq_remapping_enable`, `function irq_remapping_disable`, `function irq_remapping_reenable`.
- Atlas domain: Driver Families / drivers/iommu.
- Implementation status: integration implementation candidate.
- 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.