summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaag Jadav <raag.jadav@intel.com>2026-05-02 21:01:43 +0300
committerMatt Roper <matthew.d.roper@intel.com>2026-05-05 20:48:50 +0300
commitead21111e275c89828dc13ac8cfa657971ec874c (patch)
tree00c8d01000f8562b369ff3e36d1d58a84652abaa
parent7d9c39cfb31ff389490ca1308767c2807a9829a6 (diff)
downloadlinux-ead21111e275c89828dc13ac8cfa657971ec874c.tar.xz
drm/xe/hw_error: Cleanup array map
xe_hw_error_map[] is not worth the memory needed to map two components. Clean it up and use switch() instead, which also, in turn, simplifies bounds checking logic. add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-425 (-425) Function old new delta xe_hw_error_map 136 - -136 xe_hw_error_irq_handler 3728 3439 -289 Total: Before=7700, After=7275, chg -5.52% Signed-off-by: Raag Jadav <raag.jadav@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Link: https://patch.msgid.link/20260502180143.1450266-1-raag.jadav@intel.com Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
-rw-r--r--drivers/gpu/drm/xe/xe_hw_error.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/gpu/drm/xe/xe_hw_error.c b/drivers/gpu/drm/xe/xe_hw_error.c
index 2a31b430570e..8b56ca9700f7 100644
--- a/drivers/gpu/drm/xe/xe_hw_error.c
+++ b/drivers/gpu/drm/xe/xe_hw_error.c
@@ -36,11 +36,6 @@ static const char * const hec_uncorrected_fw_errors[] = {
"Data Corruption"
};
-static const unsigned long xe_hw_error_map[] = {
- [XE_GT_ERROR] = DRM_XE_RAS_ERR_COMP_CORE_COMPUTE,
- [XE_SOC_ERROR] = DRM_XE_RAS_ERR_COMP_SOC_INTERNAL,
-};
-
enum gt_vector_regs {
ERR_STAT_GT_VECTOR0 = 0,
ERR_STAT_GT_VECTOR1,
@@ -65,6 +60,18 @@ static enum drm_xe_ras_error_severity hw_err_to_severity(const enum hardware_err
return DRM_XE_RAS_ERR_SEV_UNCORRECTABLE;
}
+static inline u32 err_src_to_id(u32 err_bit)
+{
+ switch (err_bit) {
+ case XE_GT_ERROR:
+ return DRM_XE_RAS_ERR_COMP_CORE_COMPUTE;
+ case XE_SOC_ERROR:
+ return DRM_XE_RAS_ERR_COMP_SOC_INTERNAL;
+ default:
+ return 0;
+ }
+}
+
static const char * const pvc_master_global_err_reg[] = {
[0 ... 1] = "Undefined",
[2] = "HBM SS0: Channel0",
@@ -459,14 +466,8 @@ static void hw_error_source_handler(struct xe_tile *tile, const enum hardware_er
const char *name;
u32 error_id;
- /* Check error bit is within bounds */
- if (err_bit >= ARRAY_SIZE(xe_hw_error_map))
- break;
-
- error_id = xe_hw_error_map[err_bit];
-
- /* Check error component is within max */
- if (!error_id || error_id >= DRM_XE_RAS_ERR_COMP_MAX)
+ error_id = err_src_to_id(err_bit);
+ if (!error_id)
continue;
name = info[error_id].name;