aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorLucas De Marchi <[email protected]>2023-04-01 01:51:49 -0700
committerRodrigo Vivi <[email protected]>2023-12-19 18:31:32 -0500
commit7bf350ecb240c9db63031e3a1b6c99acd73c90ed (patch)
tree4661603e19fdee1c758dd83e805fc00cbd1147fe /drivers/gpu
parente460410023d95b0845aa99f2d9c0625b143ca593 (diff)
drm/xe/reg_sr: Save errors for kunit integration
When there's an entry that is dropped when xe_reg_sr_add(), there's not much we can do other than reporting the error - it's for certain a driver issue or conflicting workarounds/tunings. Save the number of errors to be used later by kunit to report where it happens. Signed-off-by: Lucas De Marchi <[email protected]> Reviewed-by: Matt Roper <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rodrigo Vivi <[email protected]>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/xe/xe_reg_sr.c8
-rw-r--r--drivers/gpu/drm/xe/xe_reg_sr_types.h4
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/xe/xe_reg_sr.c b/drivers/gpu/drm/xe/xe_reg_sr.c
index 37ae8412cb00..f97673be2e62 100644
--- a/drivers/gpu/drm/xe/xe_reg_sr.c
+++ b/drivers/gpu/drm/xe/xe_reg_sr.c
@@ -82,6 +82,13 @@ static bool compatible_entries(const struct xe_reg_sr_entry *e1,
return true;
}
+static void reg_sr_inc_error(struct xe_reg_sr *sr)
+{
+#if IS_ENABLED(CONFIG_DRM_XE_KUNIT_TEST)
+ sr->errors++;
+#endif
+}
+
int xe_reg_sr_add(struct xe_reg_sr *sr, u32 reg,
const struct xe_reg_sr_entry *e)
{
@@ -119,6 +126,7 @@ fail:
DRM_ERROR("Discarding save-restore reg %04lx (clear: %08x, set: %08x, masked: %s): ret=%d\n",
idx, e->clr_bits, e->set_bits,
str_yes_no(e->masked_reg), ret);
+ reg_sr_inc_error(sr);
return ret;
}
diff --git a/drivers/gpu/drm/xe/xe_reg_sr_types.h b/drivers/gpu/drm/xe/xe_reg_sr_types.h
index 3d2257891005..91469784fd90 100644
--- a/drivers/gpu/drm/xe/xe_reg_sr_types.h
+++ b/drivers/gpu/drm/xe/xe_reg_sr_types.h
@@ -32,6 +32,10 @@ struct xe_reg_sr {
} pool;
struct xarray xa;
const char *name;
+
+#if IS_ENABLED(CONFIG_DRM_XE_KUNIT_TEST)
+ unsigned int errors;
+#endif
};
#endif