dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v7 31/34] drm/tidss: Implement hw_reset
Date: Thu, 29 Oct 2026 08:09:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-188950@kernel.org> (raw)
In-Reply-To: <20261029-drm-state-readout-v7-31-25e5163d75c3@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] drm/tidss: moving dispc_reset_hw() to tidss_hw_reset() breaks hardware reset
- [High] drm/tidss: dispc_reset_hw() never called on probe and fails when PM enabled
--

commit b4ac51170032bf695c274ab86a54a2de58078be4
Author: Maxime Ripard <mripard@kernel.org>

drm/tidss: Implement hw_reset

This commit renames dispc_init_hw() to dispc_reset_hw(), removes its
unconditional call from dispc_init(), and wires it up to
drm_mode_config_funcs.hw_reset via tidss_hw_reset().

> diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c
> index 5943a5f254321..fd33edd809770 100644
> --- a/drivers/gpu/drm/tidss/tidss_dispc.c
> +++ b/drivers/gpu/drm/tidss/tidss_dispc.c
> @@ -2909,7 +2909,7 @@ static int dispc_softreset(struct dispc_device *dispc)
>  	return 0;
>  }
>  
> -static int dispc_init_hw(struct dispc_device *dispc)
> +int dispc_reset_hw(struct dispc_device *dispc)
>  {
>  	struct device *dev = dispc->dev;
>  	int ret;
> @@ -3059,10 +3059,6 @@ int dispc_init(struct tidss_device *tidss)
>  	of_property_read_u32(dispc->dev->of_node, "max-memory-bandwidth",
>  			     &dispc->memory_bandwidth_limit);
>  
> -	r = dispc_init_hw(dispc);
> -	if (r)
> -		return r;
> -
>  	tidss->dispc = dispc;
>  
>  	return 0;

[Severity: High]
Does removing dispc_init_hw() from dispc_init() leave the DISPC hardware
unreset during probe and before tidss_irq_install() registers the interrupt
handler?

In drivers/gpu/drm/tidss/tidss_drv.c, tidss_probe() calls
drm_mode_config_reset(ddev) rather than
drm_mode_config_create_initial_state(ddev):

drivers/gpu/drm/tidss/tidss_drv.c:tidss_probe() {
	...
	ret = tidss_irq_install(ddev, irq);
	if (ret) {
		dev_err(dev, "tidss_irq_install failed: %d\n", ret);
		goto err_runtime_suspend;
	}

	drm_kms_helper_poll_init(ddev);

	drm_mode_config_reset(ddev);
	...
}

Because drm_mode_config_reset() in drivers/gpu/drm/drm_mode_config.c only
invokes per-CRTC helper_funcs->hw_reset and does not call
dev->mode_config.funcs->hw_reset(dev) (which is only called by
drm_mode_config_create_initial_state()), tidss_hw_reset() and
dispc_reset_hw() are never called during probe. This also leaves any active
bootloader display or interrupt state unmasked when tidss_irq_install()
requests the IRQ line.

[ ... ]

> diff --git a/drivers/gpu/drm/tidss/tidss_kms.c b/drivers/gpu/drm/tidss/tidss_kms.c
> index 70c14c3be10d5..3b97c08c4f714 100644
> --- a/drivers/gpu/drm/tidss/tidss_kms.c
> +++ b/drivers/gpu/drm/tidss/tidss_kms.c
> @@ -116,10 +117,23 @@ static int tidss_atomic_check(struct drm_device *ddev,
>  	return 0;
>  }
>  
> +static void tidss_hw_reset(struct drm_device *dev)
> +{
> +	struct tidss_device *tidss = to_tidss(dev);
> +	int ret;
> +
> +	ret = dispc_reset_hw(tidss->dispc);
> +	if (ret)
> +		drm_warn(dev, "Couldn't reset dispc");
> +
> +	drm_mode_config_helper_hw_reset(dev);
> +}
> +
>  static const struct drm_mode_config_funcs mode_config_funcs = {
>  	.fb_create = drm_gem_fb_create,
>  	.atomic_check = tidss_atomic_check,
>  	.atomic_commit = drm_atomic_helper_commit,
> +	.hw_reset = tidss_hw_reset,
>  };

[Severity: High]
When tidss_hw_reset() is called during mode_config initialization (such as via
drm_mode_config_create_initial_state()), won't dispc_reset_hw() fail with
-EAGAIN when CONFIG_PM is enabled, or wipe out programmed register state when
CONFIG_PM is disabled?

In drivers/gpu/drm/tidss/tidss_drv.c, tidss_probe() enables runtime PM (or
manually calls dispc_runtime_resume() when !CONFIG_PM) before modeset
initialization and reset:

drivers/gpu/drm/tidss/tidss_drv.c:tidss_probe() {
	...
	pm_runtime_enable(dev);

	pm_runtime_set_autosuspend_delay(dev, 1000);
	pm_runtime_use_autosuspend(dev);

#ifndef CONFIG_PM
	/* If we don't have PM, we need to call resume manually */
	dispc_runtime_resume(tidss->dispc);
#endif

	ret = tidss_modeset_init(tidss);
	...
}

However, dispc_reset_hw() uses pm_runtime_set_active() and
pm_runtime_set_suspended(), which only work while runtime PM is disabled:

drivers/gpu/drm/tidss/tidss_dispc.c:dispc_reset_hw() {
	struct device *dev = dispc->dev;
	int ret;

	ret = pm_runtime_set_active(dev);
	if (ret) {
		dev_err(dev, "Failed to set DSS PM to active\n");
		return ret;
	}
	...
}

Once pm_runtime_enable(dev) has been called (so dev->power.disable_depth == 0
and dev->power.runtime_error == 0), __pm_runtime_set_status() in
drivers/base/power/runtime.c rejects pm_runtime_set_active(dev) with -EAGAIN:

drivers/base/power/runtime.c:__pm_runtime_set_status() {
	...
	if (dev->power.runtime_error || dev->power.disable_depth)
		dev->power.disable_depth++;
	else
		error = -EAGAIN;
	...
}

As a result, under CONFIG_PM=y, dispc_reset_hw() aborts immediately before
enabling dispc->fclk or calling dispc_softreset(). Conversely, under
CONFIG_PM=n, dispc_runtime_resume() and tidss_irq_install() have already
configured the initial registers and interrupt masks before tidss_hw_reset()
runs, so executing dispc_softreset() at that point resets DSS_SYSCONFIG and
wipes out the programmed register and IRQ state.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261029-drm-state-readout-v7-0-25e5163d75c3@kernel.org?part=31

  reply	other threads:[~2026-10-29  8:09 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  7:33 [PATCH v7 00/34] drm: Implement state readout support Maxime Ripard
2026-10-29  7:33 ` [PATCH v7 01/34] drm/bridge-helper: Don't unlock the connection mutex after a backoff Maxime Ripard
2026-10-29  7:51   ` sashiko-bot
2026-10-29  7:33 ` [PATCH v7 02/34] drm/tests: hdmi-state-helper: Handle EDEADLK in the 420-only test Maxime Ripard
2026-10-29  7:33 ` [PATCH v7 03/34] drm/tests: hdmi-state-helper: Handle EDEADLK in the color format test Maxime Ripard
2026-10-29  7:33 ` [PATCH v7 04/34] drm/atomic: Fix private obj error handling Maxime Ripard
2026-10-29  7:57   ` sashiko-bot
2026-10-29  7:33 ` [PATCH v7 05/34] drm/atomic: Add drm_private_obj name Maxime Ripard
2026-10-29  7:56   ` sashiko-bot
2026-10-29  7:33 ` [PATCH v7 06/34] drm/bridge: Switch print_state to use bridge name Maxime Ripard
2026-10-29  7:33 ` [PATCH v7 07/34] drm/bridge: Add drm_private_obj_is_bridge() Maxime Ripard
2026-10-29  7:33 ` [PATCH v7 08/34] drm/fb-dma-helper: Handle framebuffers without a GEM object Maxime Ripard
2026-10-29  7:33 ` [PATCH v7 09/34] drm/atomic: Export drm_atomic_*_print_state Maxime Ripard
2026-10-29  7:34 ` [PATCH v7 10/34] drm/atomic_sro: Create drm_atomic_sro_state container Maxime Ripard
2026-10-29  7:50   ` sashiko-bot
2026-10-29  7:34 ` [PATCH v7 11/34] drm/atomic_sro: Create kernel parameter to force or disable readout Maxime Ripard
2026-10-29  7:46   ` sashiko-bot
2026-10-29  7:34 ` [PATCH v7 12/34] drm/atomic_sro: Add atomic state readout infrastructure Maxime Ripard
2026-10-29  7:34 ` [PATCH v7 13/34] drm/atomic_sro: Add function to install state into drm objects Maxime Ripard
2026-10-29  7:34 ` [PATCH v7 14/34] drm/atomic_sro: Create documentation Maxime Ripard
2026-10-29  7:34 ` [PATCH v7 15/34] drm/bridge: Handle bridges with hardware state readout Maxime Ripard
2026-10-29  7:59   ` sashiko-bot
2026-10-29  7:34 ` [PATCH v7 16/34] drm/mode-config: Read out hardware state in drm_mode_config_create_state Maxime Ripard
2026-10-29  7:34 ` [PATCH v7 17/34] drm/atomic_sro: Provide helpers to implement hardware state readout Maxime Ripard
2026-10-29  8:02   ` sashiko-bot
2026-10-29  7:34 ` [PATCH v7 18/34] drm/mode-config: Introduce hw_reset hook Maxime Ripard
2026-10-29  7:34 ` [PATCH v7 19/34] drm/modeset-helper: Add drm_mode_config_helper_hw_reset() Maxime Ripard
2026-10-29  7:34 ` [PATCH v7 20/34] drm/atomic_helper: Compare actual and readout states once the commit is done Maxime Ripard
2026-10-29  8:05   ` sashiko-bot
2026-10-29  7:34 ` [PATCH v7 21/34] drm/atomic-state-helper: Provide comparison macros Maxime Ripard
2026-10-29  7:34 ` [PATCH v7 22/34] drm/atomic-state-helper: Provide atomic_compare_state helpers Maxime Ripard
2026-10-29  8:07   ` sashiko-bot
2026-10-29  7:34 ` [PATCH v7 23/34] drm/atomic-helper: Document State Read-Out as a state initialization approach Maxime Ripard
2026-10-29  7:34 ` [PATCH v7 24/34] drm/tests: kunit: Add a drm_printer helper Maxime Ripard
2026-10-29  7:56   ` sashiko-bot
2026-10-29  7:34 ` [PATCH v7 25/34] drm/tests: Add tests for the atomic state readout Maxime Ripard
2026-10-29  8:03   ` sashiko-bot
2026-10-29  7:34 ` [PATCH v7 26/34] drm/encoder: Create atomic_sro_get_current_crtc hook Maxime Ripard
2026-10-29  7:34 ` [PATCH v7 27/34] drm/bridge: display-connector: Implement readout support Maxime Ripard
2026-10-29  7:34 ` [PATCH v7 28/34] drm/bridge_connector: Implement hw readout for connector Maxime Ripard
2026-10-29  8:04   ` sashiko-bot
2026-10-29  7:34 ` [PATCH v7 29/34] drm/tidss: crtc: Add atomic_print_state implementation Maxime Ripard
2026-10-29  7:34 ` [PATCH v7 30/34] drm/tidss: dispc: Improve mode checking logs Maxime Ripard
2026-10-29  7:34 ` [PATCH v7 31/34] drm/tidss: Implement hw_reset Maxime Ripard
2026-10-29  8:09   ` sashiko-bot [this message]
2026-10-29  7:34 ` [PATCH v7 32/34] drm/tidss: Implement readout support Maxime Ripard
2026-10-29  8:22   ` sashiko-bot
2026-10-29  7:34 ` [PATCH v7 33/34] drm/tidss: encoder: Implement atomic_sro_get_current_crtc Maxime Ripard
2026-10-29  7:34 ` [PATCH v7 34/34] drm/bridge: sii902x: Implement hw state readout Maxime Ripard
2026-10-29  8:12   ` sashiko-bot
2026-10-29 15:20 ` [PATCH v7 00/34] drm: Implement state readout support Tomi Valkeinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-188950@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mripard@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox