arch/powerpc/kernel/eeh.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/eeh.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/eeh.c- Extension
.c- Size
- 51092 bytes
- Lines
- 1929
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/sched.hlinux/init.hlinux/list.hlinux/pci.hlinux/iommu.hlinux/proc_fs.hlinux/rbtree.hlinux/reboot.hlinux/seq_file.hlinux/spinlock.hlinux/export.hlinux/of.hlinux/debugfs.hlinux/atomic.hasm/eeh.hasm/eeh_event.hasm/io.hasm/iommu.hasm/machdep.hasm/ppc-pci.hasm/rtas.hasm/pte-walk.h
Detected Declarations
struct eeh_statsfunction eeh_setupfunction eeh_show_enabledfunction eeh_dump_dev_logfunction eeh_slot_error_detailfunction eeh_token_to_physfunction eeh_phb_check_failurefunction eeh_dev_check_failurefunction eeh_state_activefunction eeh_check_failurefunction eeh_pci_enablefunction eeh_disable_and_save_dev_statefunction eeh_restore_dev_statefunction pcibios_set_pcie_reset_statefunction eeh_set_dev_fresetfunction eeh_pe_refreeze_passedfunction eeh_for_each_pefunction eeh_pe_reset_fullfunction eeh_save_barsfunction eeh_reboot_notifierfunction eeh_device_notifierfunction eeh_initfunction eeh_probe_devicefunction pci_dev_to_eeh_devfunction devicefunction eeh_remove_devicefunction eeh_unfreeze_pefunction eeh_pe_change_ownerfunction eeh_dev_openfunction eeh_dev_releasefunction eeh_pe_set_optionfunction eeh_pe_get_statefunction eeh_pe_reenable_devicesfunction eeh_pe_resetfunction eeh_pe_configurefunction eeh_pe_inject_errfunction proc_eeh_showfunction eeh_break_devicefunction eeh_pe_inject_mmio_errorfunction eeh_enable_dbgfs_setfunction eeh_enable_dbgfs_getfunction eeh_force_recover_writefunction eeh_debugfs_dev_usagefunction eeh_dev_check_writefunction eeh_dev_break_writefunction eeh_dev_can_recoverfunction eeh_init_procexport eeh_subsystem_flags
Annotated Snippet
static const struct file_operations eeh_force_recover_fops = {
.open = simple_open,
.write = eeh_force_recover_write,
};
static ssize_t eeh_debugfs_dev_usage(struct file *filp,
char __user *user_buf,
size_t count, loff_t *ppos)
{
static const char usage[] = "input format: <domain>:<bus>:<dev>.<fn>\n";
return simple_read_from_buffer(user_buf, count, ppos,
usage, sizeof(usage) - 1);
}
static ssize_t eeh_dev_check_write(struct file *filp,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct pci_dev *pdev;
struct eeh_dev *edev;
int ret;
pdev = eeh_debug_lookup_pdev(filp, user_buf, count, ppos);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
edev = pci_dev_to_eeh_dev(pdev);
if (!edev) {
pci_err(pdev, "No eeh_dev for this device!\n");
pci_dev_put(pdev);
return -ENODEV;
}
ret = eeh_dev_check_failure(edev);
pci_info(pdev, "eeh_dev_check_failure(%s) = %d\n",
pci_name(pdev), ret);
pci_dev_put(pdev);
return count;
}
static const struct file_operations eeh_dev_check_fops = {
.open = simple_open,
.write = eeh_dev_check_write,
.read = eeh_debugfs_dev_usage,
};
static ssize_t eeh_dev_break_write(struct file *filp,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct pci_dev *pdev;
int ret;
pdev = eeh_debug_lookup_pdev(filp, user_buf, count, ppos);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
ret = eeh_break_device(pdev);
pci_dev_put(pdev);
if (ret < 0)
return ret;
return count;
}
static const struct file_operations eeh_dev_break_fops = {
.open = simple_open,
.write = eeh_dev_break_write,
.read = eeh_debugfs_dev_usage,
};
static ssize_t eeh_dev_can_recover(struct file *filp,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct pci_driver *drv;
struct pci_dev *pdev;
size_t ret;
pdev = eeh_debug_lookup_pdev(filp, user_buf, count, ppos);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
/*
* In order for error recovery to work the driver needs to implement
* .error_detected(), so it can quiesce IO to the device, and
Annotation
- Immediate include surface: `linux/delay.h`, `linux/sched.h`, `linux/init.h`, `linux/list.h`, `linux/pci.h`, `linux/iommu.h`, `linux/proc_fs.h`, `linux/rbtree.h`.
- Detected declarations: `struct eeh_stats`, `function eeh_setup`, `function eeh_show_enabled`, `function eeh_dump_dev_log`, `function eeh_slot_error_detail`, `function eeh_token_to_phys`, `function eeh_phb_check_failure`, `function eeh_dev_check_failure`, `function eeh_state_active`, `function eeh_check_failure`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: pattern 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.