From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v8 34/39] drm/tidss: Implement hw_reset
Date: Fri, 06 Nov 2026 13:50:33 +0000 [thread overview]
Message-ID: <sashiko-outbox-201506@kernel.org> (raw)
In-Reply-To: <20261106-drm-state-readout-v8-34-cbe78624e1bc@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/tidss: dispc_reset_hw() wipes initial config and skips
irq_mask setup
- [Medium] drm/tidss: unchecked tidss_runtime_get() in dispc_reset_hw()
--
commit a129179ba80db5a92955433675f3f60bbebdd1c5
Author: Maxime Ripard <mripard@kernel.org>
drm/tidss: Implement hw_reset
This commit moves the DISPC hardware soft reset out of dispc_init() into a
drm_mode_config_funcs.hw_reset callback and reorders tidss_probe() so that
drm_mode_config_create_initial_state() runs before tidss_irq_install().
> diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c
> index b5fb296fddccc..8720403af9ed3 100644
> --- a/drivers/gpu/drm/tidss/tidss_dispc.c
> +++ b/drivers/gpu/drm/tidss/tidss_dispc.c
> @@ -2931,45 +2931,23 @@ 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;
> + struct tidss_device *tidss = dispc->tidss;
> int ret;
>
> - ret = pm_runtime_set_active(dev);
> - if (ret) {
> - dev_err(dev, "Failed to set DSS PM to active\n");
> - return ret;
> - }
> -
> - ret = clk_prepare_enable(dispc->fclk);
> - if (ret) {
> - dev_err(dev, "Failed to enable DSS fclk\n");
> - goto err_runtime_suspend;
> - }
> + /*
> + * The reset runs from drm_mode_config_create_initial_state(), so
> + * after the driver has enabled runtime PM. As
> + * pm_runtime_set_active() is only allowed while runtime PM is
> + * disabled, rely on the regular runtime PM references to power
> + * the device up for the reset instead.
> + */
> + tidss_runtime_get(tidss);
>
> ret = dispc_softreset(dispc);
> - if (ret)
> - goto err_clk_disable;
>
> - clk_disable_unprepare(dispc->fclk);
> - ret = pm_runtime_set_suspended(dev);
> - if (ret) {
> - dev_err(dev, "Failed to set DSS PM to suspended\n");
> - return ret;
> - }
> -
> - return 0;
> -
> -err_clk_disable:
> - clk_disable_unprepare(dispc->fclk);
> -
> -err_runtime_suspend:
> - ret = pm_runtime_set_suspended(dev);
> - if (ret) {
> - dev_err(dev, "Failed to set DSS PM to suspended\n");
> - return ret;
> - }
> + tidss_runtime_put(tidss);
>
> return ret;
> }
[Severity: Medium]
What happens if tidss_runtime_get() fails here?
tidss_runtime_get() wraps pm_runtime_resume_and_get(), which drops its usage
reference on error and leaves the power domain and dispc->fclk disabled.
Continuing on failure accesses unclocked DISPC registers in
dispc_softreset() and then underflows the runtime PM usage count in
tidss_runtime_put().
[ ... ]
> diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
> index e258f656cf03d..409d599bb2ffd 100644
> --- a/drivers/gpu/drm/tidss/tidss_drv.c
> +++ b/drivers/gpu/drm/tidss/tidss_drv.c
> @@ -151,6 +151,20 @@ static int tidss_probe(struct platform_device *pdev)
> goto err_runtime_suspend;
> }
>
> + drm_kms_helper_poll_init(ddev);
> +
> + /*
> + * drm_mode_config_create_initial_state() resets the DISPC when
> + * the state readout isn't possible, which also clears the
> + * interrupt enable registers. Install the interrupts only once
> + * that's been done, so that the reset can't wipe them.
> + */
> + ret = drm_mode_config_create_initial_state(ddev);
> + if (ret) {
> + dev_err(dev, "failed to create initial state: %d\n", ret);
> + goto err_runtime_suspend;
> + }
> +
> irq = platform_get_irq(pdev, 0);
> if (irq < 0) {
> ret = irq;
> @@ -164,14 +178,6 @@ static int tidss_probe(struct platform_device *pdev)
> goto err_runtime_suspend;
> }
>
> - drm_kms_helper_poll_init(ddev);
> -
> - ret = drm_mode_config_create_initial_state(ddev);
> - if (ret) {
> - dev_err(dev, "failed to create initial state: %d\n", ret);
> - goto err_irq_uninstall;
> - }
> -
> ret = drm_dev_register(ddev, 0);
[Severity: High]
Does running dispc_reset_hw() via runtime PM and before tidss_irq_install()
wipe the initial DISPC configuration and leave tidss->irq_mask unprogrammed
in hardware?
drivers/gpu/drm/tidss/tidss_dispc.c:dispc_runtime_resume() {
...
dispc_initial_config(dispc);
dispc->is_enabled = true;
tidss_irq_resume(dispc->tidss);
...
}
Previously, dispc_init_hw() ran before pm_runtime_enable() using
pm_runtime_set_active() and clk_prepare_enable() so that the soft reset
completed before dispc_runtime_resume() ever ran (as noted in
bc288a927815 ("drm/tidss: Fix dss reset")). Now, tidss_runtime_get() in
dispc_reset_hw() triggers dispc_runtime_resume() first, and
dispc_softreset() immediately resets all DISPC registers back to their
defaults, wiping the plane thresholds, preload values, gamma shadow bits,
and J721E DISPC_CONNECTIONS programmed by dispc_initial_config().
In addition, tidss_irq_install() only populates tidss->irq_mask in memory
and relies on tidss_irq_resume() during dispc_runtime_resume() to program
the hardware IRQ enable registers. Because dispc_runtime_resume() now runs
during drm_mode_config_create_initial_state() while tidss->irq_mask is still
0, and tidss_runtime_put() uses a 1000 ms autosuspend delay (or never
suspends when CONFIG_PM is disabled), the device stays runtime-active across
tidss_irq_install() and the initial modeset in drm_client_setup(), leaving
the hardware unconfigured and frame-done/underflow interrupts disabled in
hardware.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261106-drm-state-readout-v8-0-cbe78624e1bc@kernel.org?part=34
next prev parent reply other threads:[~2026-11-06 13:50 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 13:14 [PATCH v8 00/39] drm: Implement state readout support Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 01/39] drm/ingenic: Convert to devm_drm_bridge_alloc() Maxime Ripard
2026-11-06 13:33 ` sashiko-bot
2026-11-06 13:55 ` Luca Ceresoli
2026-11-06 13:59 ` Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 02/39] drm/bridge-helper: Don't unlock the connection mutex after a backoff Maxime Ripard
2026-11-06 13:39 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 03/39] drm/tests: hdmi-state-helper: Handle EDEADLK in the 420-only test Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 04/39] drm/tests: hdmi-state-helper: Handle EDEADLK in the color format test Maxime Ripard
2026-11-06 13:32 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 05/39] drm/colorop: Export drm_atomic_helper_colorop_create_state() Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 06/39] drm/atomic: Fix private obj error handling Maxime Ripard
2026-11-06 13:29 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 07/39] drm/atomic: Add drm_private_obj name Maxime Ripard
2026-11-06 13:35 ` sashiko-bot
2026-11-19 15:20 ` Luca Ceresoli
2026-11-06 13:14 ` [PATCH v8 08/39] drm/bridge: Switch print_state to use bridge name Maxime Ripard
2026-11-19 15:25 ` Luca Ceresoli
2026-11-06 13:14 ` [PATCH v8 09/39] drm/bridge: Add drm_private_obj_is_bridge() Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 10/39] drm/fb-dma-helper: Handle framebuffers without a GEM object Maxime Ripard
2026-11-06 13:32 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 11/39] drm/gem-atomic-helper: " Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 12/39] drm/atomic: Export drm_atomic_*_print_state Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 13/39] drm/atomic_sro: Create drm_atomic_sro_state container Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 14/39] drm/atomic_sro: Create kernel parameter to force or disable readout Maxime Ripard
2026-11-06 13:31 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 15/39] drm/atomic_sro: Add atomic state readout infrastructure Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 16/39] drm/atomic_sro: Add function to install state into drm objects Maxime Ripard
2026-11-06 13:33 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 17/39] drm/atomic_sro: Create documentation Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 18/39] drm/bridge: Handle bridges with hardware state readout Maxime Ripard
2026-11-06 13:33 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 19/39] drm/mode-config: Read out hardware state in drm_mode_config_create_state Maxime Ripard
2026-11-06 13:33 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 20/39] drm/atomic_sro: Provide helpers to implement hardware state readout Maxime Ripard
2026-11-06 13:44 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 21/39] drm/mode-config: Introduce hw_reset hook Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 22/39] drm/modeset-helper: Add drm_mode_config_helper_hw_reset() Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 23/39] drm/atomic_helper: Compare actual and readout states once the commit is done Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 24/39] drm/atomic-state-helper: Provide comparison macros Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 25/39] drm/atomic-state-helper: Provide atomic_compare_state helpers Maxime Ripard
2026-11-06 13:44 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 26/39] drm/atomic-helper: Document State Read-Out as a state initialization approach Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 27/39] drm/tests: kunit: Add a drm_printer helper Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 28/39] drm/tests: Add tests for the atomic state readout Maxime Ripard
2026-11-06 13:44 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 29/39] drm/encoder: Create atomic_sro_get_current_crtc hook Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 30/39] drm/bridge: display-connector: Implement readout support Maxime Ripard
2026-11-06 13:50 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 31/39] drm/bridge_connector: Implement hw readout for connector Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 32/39] drm/tidss: crtc: Add atomic_print_state implementation Maxime Ripard
2026-11-17 7:24 ` Tomi Valkeinen
2026-11-06 13:14 ` [PATCH v8 33/39] drm/tidss: dispc: Improve mode checking logs Maxime Ripard
2026-11-17 7:25 ` Tomi Valkeinen
2026-11-06 13:14 ` [PATCH v8 34/39] drm/tidss: Implement hw_reset Maxime Ripard
2026-11-06 13:50 ` sashiko-bot [this message]
2026-11-06 13:14 ` [PATCH v8 35/39] drm/tidss: Implement readout support Maxime Ripard
2026-11-06 14:06 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 36/39] drm/tidss: encoder: Implement atomic_sro_get_current_crtc Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 37/39] drm/bridge: sii902x: Implement hw state readout Maxime Ripard
2026-11-06 13:14 ` [PATCH v8 38/39] drm/panel: Implement state readout support Maxime Ripard
2026-11-06 13:45 ` sashiko-bot
2026-11-06 13:14 ` [PATCH v8 39/39] fixup! drm/tidss: Implement " Maxime Ripard
2026-11-06 13:57 ` sashiko-bot
2026-11-17 15:17 ` [PATCH v8 00/39] drm: Implement state " Tomi Valkeinen
2026-11-18 12:37 ` 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-201506@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