Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ze Huang" <ze.huang@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org, Frank.Li@kernel.org,
	imx@lists.linux.dev
Subject: Re: [PATCH v3 7/8] drm/tve200: replace struct drm_simple_display_pipe with regular atomic helpers
Date: Sun, 26 Jul 2026 20:00:05 +0000	[thread overview]
Message-ID: <20260726200006.687F21F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260727-drm-simple-kms-removal-v3-7-cd5dc89858c6@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] Calling sleeping functions from CRTC atomic enable and disable callbacks violates atomic context constraints.
- [High] Setting `cstate->mode_changed = true` inside the plane's `atomic_check` callback bypasses downstream modeset routing, leaving bridges active during CRTC resets.
--

--- Patch [7]: [PATCH v3 7/8] drm/tve200: replace struct drm_simple_display_pipe with regular atomic helpers ---
commit c9e2ab55e3b69f124e64f349a1ced762885b2aea
Author: Ze Huang <ze.huang@oss.qualcomm.com>
Subject: drm/tve200: replace struct drm_simple_display_pipe with regular atomic helpers

Convert TVE200 to explicit plane, CRTC and encoder objects. Keep generic
plane-state validation before TVE200-specific mode, alignment, pitch and
format-change checks.

> diff --git a/drivers/gpu/drm/tve200/tve200_display.c b/drivers/gpu/drm/tve200/tve200_display.c
> index 26b6c65ef6fd0..beb3a5a63b5d5 100644
> --- a/drivers/gpu/drm/tve200/tve200_display.c
> +++ b/drivers/gpu/drm/tve200/tve200_display.c
[ ... ]
> @@ -69,13 +71,34 @@ irqreturn_t tve200_irq(int irq, void *data)
>  	return IRQ_HANDLED;
>  }
>  
> -static int tve200_display_check(struct drm_simple_display_pipe *pipe,
> -			       struct drm_plane_state *pstate,
> -			       struct drm_crtc_state *cstate)
> +static int tve200_plane_helper_atomic_check(struct drm_plane *plane,
> +					    struct drm_atomic_commit *commit)
>  {

[Severity: High]
This is a pre-existing issue, but does setting cstate->mode_changed = true
inside the plane check hook bypass downstream modeset routing?

In tve200_plane_helper_atomic_check(), the code raises a mode change if the
framebuffer format changes:

    if (old_fb && old_fb->format != fb->format)
            cstate->mode_changed = true;

In the default DRM state check sequence, plane checks are executed after the
modeset checks. Because mode_changed is raised late and the driver does not
explicitly loop back to recalculate modeset routing, the downstream
encoders and bridges may miss their disable/enable hooks. Could this leave
bridges active during a CRTC reset?

[ ... ]
> @@ -119,16 +142,72 @@ static int tve200_display_check(struct drm_simple_display_pipe *pipe,
>  	return 0;
>  }
>  
[ ... ]
> +static void tve200_crtc_helper_atomic_enable(struct drm_crtc *crtc,
> +					     struct drm_atomic_commit *commit)
>  {
> -	struct drm_crtc *crtc = &pipe->crtc;
> -	struct drm_plane *plane = &pipe->plane;
>  	struct drm_device *drm = crtc->dev;
>  	struct tve200_drm_dev_private *priv = drm->dev_private;
> +	struct drm_crtc_state *cstate = drm_atomic_get_new_crtc_state(commit, crtc);
>  	const struct drm_display_mode *mode = &cstate->mode;

[Severity: High]
This is a pre-existing issue, but does this code sleep in atomic context?

The DRM core invokes CRTC atomic enable callbacks during display commits,
which run in atomic context. However, tve200_crtc_helper_atomic_enable()
calls sleeping functions:

    clk_prepare_enable(priv->clk);
    ...
    usleep_range(30000, 50000);

I see this logic was carried over directly from the old
drm_simple_display_pipe hooks. Since sleeping in atomic context can cause
kernel warnings and potential deadlocks, is there a safe way to handle this
enable sequence?

[ ... ]
> @@ -240,9 +319,9 @@ static void tve200_display_enable(struct drm_simple_display_pipe *pipe,
>  	drm_crtc_vblank_on(crtc);
>  }
>  
> -static void tve200_display_disable(struct drm_simple_display_pipe *pipe)
> +static void tve200_crtc_helper_atomic_disable(struct drm_crtc *crtc,
> +					      struct drm_atomic_commit *commit)
>  {
> -	struct drm_crtc *crtc = &pipe->crtc;
>  	struct drm_device *drm = crtc->dev;
>  	struct tve200_drm_dev_private *priv = drm->dev_private;

[Severity: High]
This is a pre-existing issue, but similar to the enable path above, does the
disable callback also sleep in atomic context?

tve200_crtc_helper_atomic_disable() eventually calls clk_disable_unprepare(),
which can sleep:

    clk_disable_unprepare(priv->clk);

Since this runs in the atomic disable path, could this lead to a deadlock?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260727-drm-simple-kms-removal-v3-0-cd5dc89858c6@oss.qualcomm.com?part=7

  reply	other threads:[~2026-07-26 20:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-26 19:45 [PATCH v3 0/8] drm: replace simple display pipe users with atomic helpers Ze Huang
2026-07-26 19:45 ` [PATCH v3 1/8] drm/arcpgu: replace struct drm_simple_display_pipe with regular " Ze Huang
2026-07-26 19:45 ` [PATCH v3 2/8] drm/aspeed: " Ze Huang
2026-07-26 19:59   ` sashiko-bot
2026-07-27  2:29     ` Ze Huang
2026-07-26 19:45 ` [PATCH v3 3/8] drm/mcde: " Ze Huang
2026-07-26 19:57   ` sashiko-bot
2026-07-27  2:31     ` Ze Huang
2026-07-26 19:45 ` [PATCH v3 4/8] drm/pl111: " Ze Huang
2026-07-26 19:59   ` sashiko-bot
2026-07-26 19:45 ` [PATCH v3 5/8] drm/gm12u320: " Ze Huang
2026-07-26 20:13   ` sashiko-bot
2026-07-27  3:29     ` Ze Huang
2026-07-26 19:45 ` [PATCH v3 6/8] drm/repaper: " Ze Huang
2026-07-26 20:04   ` sashiko-bot
2026-07-27  2:35     ` Ze Huang
2026-07-26 19:45 ` [PATCH v3 7/8] drm/tve200: " Ze Huang
2026-07-26 20:00   ` sashiko-bot [this message]
2026-07-27  2:55     ` Ze Huang
2026-07-26 19:45 ` [PATCH v3 8/8] drm/xen: " Ze Huang
2026-07-26 19:56   ` sashiko-bot
2026-07-27  5:39     ` Ze Huang
2026-07-26 20:32 ` [PATCH v3 0/8] drm: replace simple display pipe users with " Linus Walleij
2026-07-27  1:37   ` Ze Huang

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=20260726200006.687F21F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imx@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=ze.huang@oss.qualcomm.com \
    /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