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 <lucas.demarchi@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://lore.kernel.org/r/20230401085151.1786204-6-lucas.demarchi@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
Lucas De Marchi
2023-04-01 01:51:49 -07:00
committed by Rodrigo Vivi
parent e460410023
commit 7bf350ecb2
2 changed files with 12 additions and 0 deletions

View File

@@ -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 @@ int xe_reg_sr_add(struct xe_reg_sr *sr, u32 reg,
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;
}

View File

@@ -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