Our inject_load_failure functionality allows to insert one failure during driver load, but it is hard to guess which number should passed as modparam to select specific checkpoint. Use negative number as option to list all available failure checkpoints without triggering any failure. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/i915_drv.c | 18 +++++++++++------- drivers/gpu/drm/i915/i915_params.c | 6 ++++-- drivers/gpu/drm/i915/i915_params.h | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 1ec12ad..0992301 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -55,16 +55,21 @@ static struct drm_driver driver; -static unsigned int i915_load_fail_count; +static int i915_load_fail_count = 0; bool __i915_inject_load_failure(const char *func, int line) { - if (i915_load_fail_count >= i915_modparams.inject_load_failure) + ++i915_load_fail_count; + + if (unlikely(i915_modparams.inject_load_failure < 0)) { + DRM_NOTE("[i915] load checkpoint %d [%s:%d]\n", + i915_load_fail_count, func, line); return false; + } - if (++i915_load_fail_count == i915_modparams.inject_load_failure) { - DRM_INFO("Injecting failure at checkpoint %u [%s:%d]\n", - i915_modparams.inject_load_failure, func, line); + if (i915_modparams.inject_load_failure == i915_load_fail_count) { + DRM_INFO("Injecting failure at checkpoint %d [%s:%d]\n", + i915_load_fail_count, func, line); return true; } @@ -107,8 +112,7 @@ bool __i915_inject_load_failure(const char *func, int line) static bool i915_error_injected(struct drm_i915_private *dev_priv) { - return i915_modparams.inject_load_failure && - i915_load_fail_count == i915_modparams.inject_load_failure; + return i915_modparams.inject_load_failure >= i915_load_fail_count; } #define i915_load_error(dev_priv, fmt, ...) \ diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index 0b553a8..e5ab69c 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -167,8 +167,10 @@ struct i915_params i915_modparams __read_mostly = { i915_param_named_unsafe(enable_dp_mst, bool, 0600, "Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true)"); -i915_param_named_unsafe(inject_load_failure, uint, 0400, - "Force an error after a number of failure check points (0:disabled (default), N:force failure at the Nth failure check point)"); +i915_param_named_unsafe(inject_load_failure, int, 0400, + "Force an error after a number of failure check points. " + "(-1=list check points, 0=disabled [default], " + "N=force failure at the Nth failure check point)"); i915_param_named(enable_dpcd_backlight, bool, 0600, "Enable support for DPCD backlight control (default:false)"); diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h index 430f5f9..6ed799f 100644 --- a/drivers/gpu/drm/i915/i915_params.h +++ b/drivers/gpu/drm/i915/i915_params.h @@ -54,7 +54,7 @@ param(int, mmio_debug, 0) \ param(int, edp_vswing, 0) \ param(int, reset, 2) \ - param(unsigned int, inject_load_failure, 0) \ + param(int, inject_load_failure, 0) \ /* leave bools at the end to not create holes */ \ param(bool, alpha_support, IS_ENABLED(CONFIG_DRM_I915_ALPHA_SUPPORT)) \ param(bool, enable_cmd_parser, true) \ -- 1.9.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx