arch/powerpc/kernel/iommu.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/iommu.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/iommu.c- Extension
.c- Size
- 33835 bytes
- Lines
- 1320
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- 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.
- 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/init.hlinux/types.hlinux/slab.hlinux/sysfs.hlinux/mm.hlinux/spinlock.hlinux/string.hlinux/string_choices.hlinux/dma-mapping.hlinux/bitmap.hlinux/iommu-helper.hlinux/crash_dump.hlinux/hash.hlinux/fault-inject.hlinux/pci.hlinux/iommu.hlinux/sched.hlinux/debugfs.hlinux/vmalloc.hasm/io.hasm/iommu.hasm/pci-bridge.hasm/machdep.hasm/kdump.hasm/fadump.hasm/vio.hasm/tce.hasm/mmu_context.hasm/ppc-pci.h
Detected Declarations
function Copyrightfunction iommu_debugfs_addfunction iommu_debugfs_delfunction iommu_debugfs_addfunction setup_iommufunction setup_iommu_pool_hashfunction setup_fail_iommufunction should_fail_iommufunction fail_iommu_debugfsfunction fail_iommu_showfunction fail_iommu_storefunction fail_iommu_bus_notifyfunction fail_iommu_setupfunction should_fail_iommufunction iommu_range_allocfunction Ofunction iommu_allocfunction iommu_free_checkfunction __iommu_freefunction iommu_freefunction ppc_iommu_map_sgfunction ppc_iommu_unmap_sgfunction iommu_table_clearfunction iommu_table_reserve_pagesfunction iommu_table_in_usefunction iommu_table_freefunction iommu_tce_table_putfunction storagefunction iommu_unmap_physfunction addressfunction iommu_free_coherentfunction iommu_direction_to_tce_permfunction dev_has_iommu_tablefunction group_releasefunction iommu_register_groupfunction iommu_tce_directionfunction iommu_flush_tcefunction iommu_tce_check_iobafunction iommu_tce_check_gpafunction iommu_tce_xchg_no_killfunction iommu_tce_killfunction iommu_add_devicefunction spapr_tce_platform_iommu_attach_devfunction spapr_tce_blocked_iommu_attach_devfunction spapr_tce_iommu_capablefunction spapr_tce_iommu_release_devicefunction ppc_iommu_register_devicefunction ppc_iommu_unregister_device
Annotated Snippet
subsys_initcall(setup_iommu_pool_hash);
#ifdef CONFIG_FAIL_IOMMU
static DECLARE_FAULT_ATTR(fail_iommu);
static int __init setup_fail_iommu(char *str)
{
return setup_fault_attr(&fail_iommu, str);
}
__setup("fail_iommu=", setup_fail_iommu);
static bool should_fail_iommu(struct device *dev)
{
return dev->archdata.fail_iommu && should_fail(&fail_iommu, 1);
}
static int __init fail_iommu_debugfs(void)
{
struct dentry *dir = fault_create_debugfs_attr("fail_iommu",
NULL, &fail_iommu);
return PTR_ERR_OR_ZERO(dir);
}
late_initcall(fail_iommu_debugfs);
static ssize_t fail_iommu_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sysfs_emit(buf, "%d\n", dev->archdata.fail_iommu);
}
static ssize_t fail_iommu_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{
int i;
if (count > 0 && sscanf(buf, "%d", &i) > 0)
dev->archdata.fail_iommu = (i == 0) ? 0 : 1;
return count;
}
static DEVICE_ATTR_RW(fail_iommu);
static int fail_iommu_bus_notify(struct notifier_block *nb,
unsigned long action, void *data)
{
struct device *dev = data;
if (action == BUS_NOTIFY_ADD_DEVICE) {
if (device_create_file(dev, &dev_attr_fail_iommu))
pr_warn("Unable to create IOMMU fault injection sysfs "
"entries\n");
} else if (action == BUS_NOTIFY_DEL_DEVICE) {
device_remove_file(dev, &dev_attr_fail_iommu);
}
return 0;
}
/*
* PCI and VIO buses need separate notifier_block structs, since they're linked
* list nodes. Sharing a notifier_block would mean that any notifiers later
* registered for PCI buses would also get called by VIO buses and vice versa.
*/
static struct notifier_block fail_iommu_pci_bus_notifier = {
.notifier_call = fail_iommu_bus_notify
};
#ifdef CONFIG_IBMVIO
static struct notifier_block fail_iommu_vio_bus_notifier = {
.notifier_call = fail_iommu_bus_notify
};
#endif
static int __init fail_iommu_setup(void)
{
#ifdef CONFIG_PCI
bus_register_notifier(&pci_bus_type, &fail_iommu_pci_bus_notifier);
#endif
#ifdef CONFIG_IBMVIO
bus_register_notifier(&vio_bus_type, &fail_iommu_vio_bus_notifier);
#endif
return 0;
}
/*
* Must execute after PCI and VIO subsystem have initialised but before
Annotation
- Immediate include surface: `linux/init.h`, `linux/types.h`, `linux/slab.h`, `linux/sysfs.h`, `linux/mm.h`, `linux/spinlock.h`, `linux/string.h`, `linux/string_choices.h`.
- Detected declarations: `function Copyright`, `function iommu_debugfs_add`, `function iommu_debugfs_del`, `function iommu_debugfs_add`, `function setup_iommu`, `function setup_iommu_pool_hash`, `function setup_fail_iommu`, `function should_fail_iommu`, `function fail_iommu_debugfs`, `function fail_iommu_show`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.