drivers/gpu/drm/xe/xe_hw_error.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_hw_error.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_hw_error.c- Extension
.c- Size
- 17349 bytes
- Lines
- 566
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/bitmap.hlinux/fault-inject.hregs/xe_gsc_regs.hregs/xe_hw_error_regs.hregs/xe_irq_regs.hxe_device.hxe_drm_ras.hxe_hw_error.hxe_mmio.hxe_survivability_mode.h
Detected Declarations
enum gt_vector_regsfunction hw_err_to_severityfunction err_src_to_idfunction fault_inject_csc_hw_errorfunction csc_hw_error_workfunction csc_hw_error_handlerfunction for_each_set_bitfunction log_hw_errorfunction log_gt_errfunction log_soc_errorfunction gt_hw_error_handlerfunction for_each_set_bitfunction soc_slave_ieh_handlerfunction soc_hw_error_handlerfunction hw_error_source_handlerfunction for_each_set_bitfunction xe_hw_error_irq_handlerfunction hw_error_info_initfunction process_hw_errorsfunction for_each_tilefunction xe_hw_error_init
Annotated Snippet
for_each_set_bit(err_bit, &fw_err, HEC_UNCORR_FW_ERR_BITS) {
drm_err_ratelimited(&xe->drm, HW_ERR
"HEC FW %s %s reported, bit[%d] is set\n",
hec_uncorrected_fw_errors[err_bit], severity_str,
err_bit);
schedule_work(&tile->csc_hw_error_work);
}
}
xe_mmio_write32(mmio, HEC_UNCORR_ERR_STATUS(base), err_src);
}
static void log_hw_error(struct xe_tile *tile, const char *name,
const enum drm_xe_ras_error_severity severity)
{
const char *severity_str = error_severity[severity];
struct xe_device *xe = tile_to_xe(tile);
if (severity == DRM_XE_RAS_ERR_SEV_CORRECTABLE)
drm_warn(&xe->drm, HW_ERR "%s %s detected\n", name, severity_str);
else
drm_err_ratelimited(&xe->drm, HW_ERR "%s %s detected\n", name, severity_str);
}
static void log_gt_err(struct xe_tile *tile, const char *name, int i, u32 err,
const enum drm_xe_ras_error_severity severity)
{
const char *severity_str = error_severity[severity];
struct xe_device *xe = tile_to_xe(tile);
if (severity == DRM_XE_RAS_ERR_SEV_CORRECTABLE)
drm_warn(&xe->drm, HW_ERR "%s %s detected, ERROR_STAT_GT_VECTOR%d:0x%08x\n",
name, severity_str, i, err);
else
drm_err_ratelimited(&xe->drm, HW_ERR "%s %s detected, ERROR_STAT_GT_VECTOR%d:0x%08x\n",
name, severity_str, i, err);
}
static void log_soc_error(struct xe_tile *tile, const char * const *reg_info,
const enum drm_xe_ras_error_severity severity, u32 err_bit, u32 index)
{
const char *severity_str = error_severity[severity];
struct xe_device *xe = tile_to_xe(tile);
struct xe_drm_ras *ras = &xe->ras;
struct xe_drm_ras_counter *info = ras->info[severity];
const char *name;
name = reg_info[err_bit];
if (strcmp(name, "Undefined")) {
if (severity == DRM_XE_RAS_ERR_SEV_CORRECTABLE)
drm_warn(&xe->drm, HW_ERR "%s SOC %s detected", name, severity_str);
else
drm_err_ratelimited(&xe->drm, HW_ERR "%s SOC %s detected", name, severity_str);
atomic_inc(&info[index].counter);
}
}
static void gt_hw_error_handler(struct xe_tile *tile, const enum hardware_error hw_err,
u32 error_id)
{
const enum drm_xe_ras_error_severity severity = hw_err_to_severity(hw_err);
struct xe_device *xe = tile_to_xe(tile);
struct xe_drm_ras *ras = &xe->ras;
struct xe_drm_ras_counter *info = ras->info[severity];
struct xe_mmio *mmio = &tile->mmio;
unsigned long err_stat = 0;
int i;
if (xe->info.platform != XE_PVC)
return;
if (hw_err == HARDWARE_ERROR_NONFATAL) {
atomic_inc(&info[error_id].counter);
log_hw_error(tile, info[error_id].name, severity);
return;
}
for (i = 0; i < PVC_GT_VECTOR_LEN(hw_err); i++) {
u32 vector, val;
vector = xe_mmio_read32(mmio, ERR_STAT_GT_VECTOR_REG(hw_err, i));
if (!vector)
continue;
switch (i) {
case ERR_STAT_GT_VECTOR0:
case ERR_STAT_GT_VECTOR1: {
u32 errbit;
Annotation
- Immediate include surface: `linux/bitmap.h`, `linux/fault-inject.h`, `regs/xe_gsc_regs.h`, `regs/xe_hw_error_regs.h`, `regs/xe_irq_regs.h`, `xe_device.h`, `xe_drm_ras.h`, `xe_hw_error.h`.
- Detected declarations: `enum gt_vector_regs`, `function hw_err_to_severity`, `function err_src_to_id`, `function fault_inject_csc_hw_error`, `function csc_hw_error_work`, `function csc_hw_error_handler`, `function for_each_set_bit`, `function log_hw_error`, `function log_gt_err`, `function log_soc_error`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source 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.