Re: [PATCH 2/6] drm/i915/reset: Reorganize display reset code

Jani Nikula
2026-04-09T08:13:52Z

On Thu, 09 Apr 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Stop returning the "is there a display?" status from
> intel_display_reset_prepare(). I plan to move the pending_fb_pin
> into the i915 code, so I need to make that determination already
> before intel_display_reset_prepare() is called. Add a new
> intel_display_reset_supported() function for that.
>
> Cc: Simona Vetter <simona.vetter@ffwll.ch>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Jouni Högander <jouni.hogander@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
> .../drm/i915/display/intel_display_reset.c | 23 ++++++++-----------
> .../drm/i915/display/intel_display_reset.h | 3 ++-
> drivers/gpu/drm/i915/gt/intel_reset.c | 13 +++++++----
> 3 files changed, 20 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_reset.c b/drivers/gpu/drm/i915/display/intel_display_reset.c
> index d00ef5bdcbda..137a2a33c8b0 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_reset.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_reset.c
> @@ -16,22 +16,24 @@
> #include "intel_hotplug.h"
> #include "intel_pps.h"
>
> +bool intel_display_reset_supported(struct intel_display *display)
> +{
> + return HAS_DISPLAY(display);
> +}
> +
> bool intel_display_reset_test(struct intel_display *display)
> {
> - return display->params.force_reset_modeset_test;
> + return HAS_DISPLAY(display) &&
> + display->params.force_reset_modeset_test;
> }
>
> -/* returns true if intel_display_reset_finish() needs to be called */
> -bool intel_display_reset_prepare(struct intel_display *display,
> +void intel_display_reset_prepare(struct intel_display *display,
> modeset_stuck_fn modeset_stuck, void *context)
> {
> struct drm_modeset_acquire_ctx *ctx = &display->restore.reset_ctx;
> struct drm_atomic_state *state;
> int ret;
>
> - if (!HAS_DISPLAY(display))
> - return false;
> -
> if (atomic_read(&display->restore.pending_fb_pin)) {
> drm_dbg_kms(display->drm,
> "Modeset potentially stuck, unbreaking through wedging\n");
> @@ -60,7 +62,7 @@ bool intel_display_reset_prepare(struct intel_display *display,
> ret = PTR_ERR(state);
> drm_err(display->drm, "Duplicating state failed with %i\n",
> ret);
> - return true;
> + return;
> }
>
> ret = drm_atomic_helper_disable_all(display->drm, ctx);
> @@ -68,13 +70,11 @@ bool intel_display_reset_prepare(struct intel_display *display,
> drm_err(display->drm, "Suspending crtc's failed with %i\n",
> ret);
> drm_atomic_state_put(state);
> - return true;
> + return;
> }
>
> display->restore.modeset_state = state;
> state->acquire_ctx = ctx;
> -
> - return true;
> }
>
> void intel_display_reset_finish(struct intel_display *display, bool test_only)
> @@ -83,9 +83,6 @@ void intel_display_reset_finish(struct intel_display *display, bool test_only)
> struct drm_atomic_state *state;
> int ret;
>
> - if (!HAS_DISPLAY(display))
> - return;
> -
> state = fetch_and_zero(&display->restore.modeset_state);
> if (!state)
> goto unlock;
> diff --git a/drivers/gpu/drm/i915/display/intel_display_reset.h b/drivers/gpu/drm/i915/display/intel_display_reset.h
> index 8b3bda134454..e0f15e757728 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_reset.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_reset.h
> @@ -12,8 +12,9 @@ struct intel_display;
>
> typedef void modeset_stuck_fn(void *context);
>
> +bool intel_display_reset_supported(struct intel_display *display);
> bool intel_display_reset_test(struct intel_display *display);
> -bool intel_display_reset_prepare(struct intel_display *display,
> +void intel_display_reset_prepare(struct intel_display *display,
> modeset_stuck_fn modeset_stuck, void *context);
> void intel_display_reset_finish(struct intel_display *display, bool test_only);
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c
> index 37272871b0f2..ffd11767874f 100644
> --- a/drivers/gpu/drm/i915/gt/intel_reset.c
> +++ b/drivers/gpu/drm/i915/gt/intel_reset.c
> @@ -1425,16 +1425,19 @@ static void intel_gt_reset_global(struct intel_gt *gt,
> bool need_display_reset;
> bool reset_display;
>
> - need_display_reset = intel_gt_gpu_reset_clobbers_display(gt) &&
> + need_display_reset =
> + intel_display_reset_supported(display) &&
> + intel_gt_gpu_reset_clobbers_display(gt) &&
> intel_has_gpu_reset(gt);
>
> - reset_display = intel_display_reset_test(display) ||
> + reset_display =
> + intel_display_reset_test(display) ||
> need_display_reset;
>
> if (reset_display)
> - reset_display = intel_display_reset_prepare(display,
> - display_reset_modeset_stuck,
> - gt);
> + intel_display_reset_prepare(display,
> + display_reset_modeset_stuck,
> + gt);
>
> intel_gt_reset(gt, engine_mask, reason);

--
Jani Nikula, Intel