drivers/cxl/core/ras.c
Source file repositories/reference/linux-study-clean/drivers/cxl/core/ras.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/cxl/core/ras.c- Extension
.c- Size
- 9067 bytes
- Lines
- 339
- Domain
- Driver Families
- Bucket
- drivers/cxl
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pci.hlinux/aer.hcxl/event.hcxlmem.hcxlpci.htrace.h
Detected Declarations
function cxl_cper_trace_corr_port_prot_errfunction cxl_cper_trace_uncorr_port_prot_errfunction cxl_cper_trace_corr_prot_errfunction cxl_cper_trace_uncorr_prot_errfunction match_memdev_by_parentfunction cxl_cper_handle_prot_errfunction cxl_cper_prot_err_work_fnfunction cxl_ras_initfunction cxl_ras_exitfunction cxl_dport_map_rasfunction devm_cxl_dport_ras_setupfunction devm_cxl_dport_rch_ras_setupfunction devm_cxl_port_ras_setupfunction cxl_handle_cor_rasfunction header_log_copyfunction cxl_handle_rasfunction cxl_cor_error_detectedfunction scoped_guardfunction cxl_error_detectedfunction scoped_guardexport cxl_cper_handle_prot_err
Annotated Snippet
if (!dev->driver) {
dev_warn(&pdev->dev,
"%s: memdev disabled, abort error handling\n",
dev_name(dev));
return;
}
if (cxlds->rcd)
cxl_handle_rdport_errors(cxlds);
cxl_handle_cor_ras(&cxlds->cxlmd->dev, cxlmd->endpoint->regs.ras);
}
}
EXPORT_SYMBOL_NS_GPL(cxl_cor_error_detected, "CXL");
pci_ers_result_t cxl_error_detected(struct pci_dev *pdev,
pci_channel_state_t state)
{
struct cxl_dev_state *cxlds = pci_get_drvdata(pdev);
struct cxl_memdev *cxlmd = cxlds->cxlmd;
struct device *dev = &cxlmd->dev;
bool ue;
scoped_guard(device, dev) {
if (!dev->driver) {
dev_warn(&pdev->dev,
"%s: memdev disabled, abort error handling\n",
dev_name(dev));
return PCI_ERS_RESULT_DISCONNECT;
}
if (cxlds->rcd)
cxl_handle_rdport_errors(cxlds);
/*
* A frozen channel indicates an impending reset which is fatal to
* CXL.mem operation, and will likely crash the system. On the off
* chance the situation is recoverable dump the status of the RAS
* capability registers and bounce the active state of the memdev.
*/
ue = cxl_handle_ras(&cxlds->cxlmd->dev, cxlmd->endpoint->regs.ras);
}
switch (state) {
case pci_channel_io_normal:
if (ue) {
device_release_driver(dev);
return PCI_ERS_RESULT_NEED_RESET;
}
return PCI_ERS_RESULT_CAN_RECOVER;
case pci_channel_io_frozen:
dev_warn(&pdev->dev,
"%s: frozen state error detected, disable CXL.mem\n",
dev_name(dev));
device_release_driver(dev);
return PCI_ERS_RESULT_NEED_RESET;
case pci_channel_io_perm_failure:
dev_warn(&pdev->dev,
"failure state error detected, request disconnect\n");
return PCI_ERS_RESULT_DISCONNECT;
}
return PCI_ERS_RESULT_NEED_RESET;
}
EXPORT_SYMBOL_NS_GPL(cxl_error_detected, "CXL");
Annotation
- Immediate include surface: `linux/pci.h`, `linux/aer.h`, `cxl/event.h`, `cxlmem.h`, `cxlpci.h`, `trace.h`.
- Detected declarations: `function cxl_cper_trace_corr_port_prot_err`, `function cxl_cper_trace_uncorr_port_prot_err`, `function cxl_cper_trace_corr_prot_err`, `function cxl_cper_trace_uncorr_prot_err`, `function match_memdev_by_parent`, `function cxl_cper_handle_prot_err`, `function cxl_cper_prot_err_work_fn`, `function cxl_ras_init`, `function cxl_ras_exit`, `function cxl_dport_map_ras`.
- Atlas domain: Driver Families / drivers/cxl.
- Implementation status: integration implementation candidate.
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.