arch/powerpc/platforms/powernv/eeh-powernv.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/powernv/eeh-powernv.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/powernv/eeh-powernv.c- Extension
.c- Size
- 44524 bytes
- Lines
- 1696
- 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.
- 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/atomic.hlinux/debugfs.hlinux/delay.hlinux/export.hlinux/init.hlinux/interrupt.hlinux/irqdomain.hlinux/list.hlinux/msi.hlinux/of.hlinux/pci.hlinux/proc_fs.hlinux/rbtree.hlinux/sched.hlinux/seq_file.hlinux/spinlock.hasm/eeh.hasm/eeh_event.hasm/firmware.hasm/io.hasm/iommu.hasm/machdep.hasm/msi_bitmap.hasm/opal.hasm/ppc-pci.hasm/pnv-pci.hpowernv.hpci.h../../../../drivers/pci/pci.h
Detected Declarations
function pnv_pcibios_bus_add_devicefunction pnv_eeh_eventfunction pnv_eeh_ei_writefunction pnv_eeh_dbgfs_setfunction pnv_eeh_dbgfs_getfunction pnv_eeh_enable_phbsfunction list_for_each_entryfunction pnv_eeh_post_initfunction list_for_each_entryfunction pnv_eeh_find_capfunction pnv_eeh_find_ecapfunction pnv_eeh_set_optionfunction pnv_eeh_get_phb_diagfunction pnv_eeh_get_phb_statefunction pnv_eeh_get_pe_statefunction pnv_eeh_get_statefunction pnv_eeh_pollfunction pnv_eeh_phb_resetfunction pnv_eeh_root_resetfunction __pnv_eeh_bridge_resetfunction pnv_eeh_bridge_resetfunction pnv_pci_reset_secondary_busfunction pnv_eeh_wait_for_pendingfunction pnv_eeh_do_flrfunction pnv_eeh_do_af_flrfunction pnv_eeh_reset_vf_pefunction pnv_eeh_resetfunction pnv_eeh_get_logfunction pnv_eeh_configure_bridgefunction pnv_eeh_err_injectfunction pnv_eeh_cfg_blockedfunction pnv_eeh_read_configfunction pnv_eeh_write_configfunction pnv_eeh_dump_hub_diag_commonfunction pnv_eeh_get_and_dump_hub_diagfunction pnv_eeh_get_pefunction eventfunction list_for_each_entryfunction eeh_pe_passedfunction pnv_eeh_restore_configfunction eeh_powernv_init
Annotated Snippet
static const struct file_operations pnv_eeh_ei_fops = {
.open = simple_open,
.write = pnv_eeh_ei_write,
};
static int pnv_eeh_dbgfs_set(void *data, int offset, u64 val)
{
struct pci_controller *hose = data;
struct pnv_phb *phb = hose->private_data;
out_be64(phb->regs + offset, val);
return 0;
}
static int pnv_eeh_dbgfs_get(void *data, int offset, u64 *val)
{
struct pci_controller *hose = data;
struct pnv_phb *phb = hose->private_data;
*val = in_be64(phb->regs + offset);
return 0;
}
#define PNV_EEH_DBGFS_ENTRY(name, reg) \
static int pnv_eeh_dbgfs_set_##name(void *data, u64 val) \
{ \
return pnv_eeh_dbgfs_set(data, reg, val); \
} \
\
static int pnv_eeh_dbgfs_get_##name(void *data, u64 *val) \
{ \
return pnv_eeh_dbgfs_get(data, reg, val); \
} \
\
DEFINE_SIMPLE_ATTRIBUTE(pnv_eeh_dbgfs_ops_##name, \
pnv_eeh_dbgfs_get_##name, \
pnv_eeh_dbgfs_set_##name, \
"0x%llx\n")
PNV_EEH_DBGFS_ENTRY(outb, 0xD10);
PNV_EEH_DBGFS_ENTRY(inbA, 0xD90);
PNV_EEH_DBGFS_ENTRY(inbB, 0xE10);
#endif /* CONFIG_DEBUG_FS */
static void pnv_eeh_enable_phbs(void)
{
struct pci_controller *hose;
struct pnv_phb *phb;
list_for_each_entry(hose, &hose_list, list_node) {
phb = hose->private_data;
/*
* If EEH is enabled, we're going to rely on that.
* Otherwise, we restore to conventional mechanism
* to clear frozen PE during PCI config access.
*/
if (eeh_enabled())
phb->flags |= PNV_PHB_FLAG_EEH;
else
phb->flags &= ~PNV_PHB_FLAG_EEH;
}
}
/**
* pnv_eeh_post_init - EEH platform dependent post initialization
*
* EEH platform dependent post initialization on powernv. When
* the function is called, the EEH PEs and devices should have
* been built. If the I/O cache staff has been built, EEH is
* ready to supply service.
*/
int pnv_eeh_post_init(void)
{
struct pci_controller *hose;
struct pnv_phb *phb;
int ret = 0;
eeh_show_enabled();
/* Register OPAL event notifier */
eeh_event_irq = opal_event_request(ilog2(OPAL_EVENT_PCI_ERROR));
if (eeh_event_irq < 0) {
pr_err("%s: Can't register OPAL event interrupt (%d)\n",
__func__, eeh_event_irq);
return eeh_event_irq;
}
ret = request_irq(eeh_event_irq, pnv_eeh_event,
IRQ_TYPE_LEVEL_HIGH, "opal-eeh", NULL);
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/export.h`, `linux/init.h`, `linux/interrupt.h`, `linux/irqdomain.h`, `linux/list.h`.
- Detected declarations: `function pnv_pcibios_bus_add_device`, `function pnv_eeh_event`, `function pnv_eeh_ei_write`, `function pnv_eeh_dbgfs_set`, `function pnv_eeh_dbgfs_get`, `function pnv_eeh_enable_phbs`, `function list_for_each_entry`, `function pnv_eeh_post_init`, `function list_for_each_entry`, `function pnv_eeh_find_cap`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: pattern 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.