From: Liu Ying <victor.liu@nxp.com>
To: sashiko-reviews@lists.linux.dev
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
imx@lists.linux.dev, robh@kernel.org, conor+dt@kernel.org,
Frank.Li@kernel.org
Subject: Re: [PATCH v9 08/16] drm/imx: dc: Add PRG support
Date: Mon, 30 Nov 2026 16:35:55 +0800 [thread overview]
Message-ID: <aw01azx6KcQlOZHm@raspi> (raw)
In-Reply-To: <sashiko-outbox-194645@kernel.org>
On Tue, Nov 03, 2026 at 06:36:22AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] drm/imx: dc-prg: unclocked MMIO and RPM underflow in dc_prg_configure()
> --
>
> commit d1c395ad8b2bd23da43b9ddd3c832ab32084d33e
> Author: Liu Ying <victor.liu@nxp.com>
>
> drm/imx: dc: Add PRG support
>
> This commit adds a platform driver for the Display Prefetch Resolve Gasket
> (PRG), which sits between a Display Prefetch Resolve Channel (DPRC) and a
> FetchUnit as part of the prefetch engine.
>
> > diff --git a/drivers/gpu/drm/imx/dc/dc-prg.c b/drivers/gpu/drm/imx/dc/dc-prg.c
> > new file mode 100644
> > index 0000000000000..b80ce5e641173
> > --- /dev/null
> > +++ b/drivers/gpu/drm/imx/dc/dc-prg.c
> > @@ -0,0 +1,317 @@
>
> [ ... ]
>
> > +void dc_prg_enable(struct dc_prg *prg)
> > +{
> > + regmap_write(prg->reg, PRG_CTRL + CLR, BYPASS);
> > +}
> > +
> > +void dc_prg_disable(struct dc_prg *prg)
> > +{
> > + regmap_write(prg->reg, PRG_CTRL, BYPASS);
> > +
> > + pm_runtime_put(prg->dev);
> > +}
>
> [ ... ]
>
> > +void dc_prg_configure(struct dc_prg *prg,
> > + unsigned int width, unsigned int height,
> > + unsigned int stride, unsigned int bits_per_pixel,
> > + dma_addr_t baddr, bool start)
> > +{
> > + struct device *dev = prg->dev;
> > + unsigned int burst_size;
> > + u32 val;
> > + int ret;
> > +
> > + if (start) {
> > + ret = pm_runtime_resume_and_get(dev);
> > + if (ret < 0) {
> > + dev_err(dev, "failed to get RPM: %d\n", ret);
> > + return;
> > + }
> > + }
>
> [Severity: High]
> As reported by Sashiko on v8 [1], in drivers/gpu/drm/imx/dc/dc-prg.c, what
> happens if pm_runtime_resume_and_get() fails in dc_prg_configure() when start
> is true?
>
> Because dc_prg_configure() returns void, the error is not propagated to the
> caller and the PRG device remains runtime-suspended with its clocks disabled
> in dc_prg_runtime_resume().
>
> Callers that proceed after dc_prg_configure() will then call dc_prg_enable(),
> dc_prg_reg_update(), or dc_prg_shadow_enable(), performing MMIO writes to
> PRG_CTRL and PRG_REG_UPDATE while the PRG clocks are off. Subsequent updates
> with start set to false will also write to the PRG registers without clocks
> enabled.
>
> Furthermore, when the plane or CRTC is later disabled, dc_prg_disable() will
> write to PRG_CTRL while unclocked and call pm_runtime_put(prg->dev),
> underflowing the runtime PM usage counter on prg->dev.
>
> Should dc_prg_configure() return an error code, or track the runtime PM active
> state so subsequent register accesses and pm_runtime_put() are skipped when
> resume fails?
I've explained in v7 comment[1] that if pm_runtime_resume_and_get() fails, then
it should be fixed in the first place.
[1] https://lore.kernel.org/dri-devel/auRC-xz5IYaHf_AP@raspi/
>
> [1] https://lore.kernel.org/r/20261030-imx8-dc-prefetch-v8-7-c4f81afd4533@nxp.com
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261103-imx8-dc-prefetch-v9-0-3b985e7636e2@nxp.com?part=8
--
Regards,
Liu Ying
next prev parent reply other threads:[~2026-11-30 8:34 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 6:21 [PATCH v9 00/16] drm/imx: dc: Use prefetch engine Liu Ying
2026-11-03 6:21 ` [PATCH v9 01/16] dt-bindings: display: imx: Add i.MX8qxp/qm PRG binding Liu Ying
2026-11-03 6:21 ` [PATCH v9 02/16] dt-bindings: display: imx: Add i.MX8qxp/qm DPR channel binding Liu Ying
2026-11-03 6:21 ` [PATCH v9 03/16] drm/imx: dc-plane: Disable plane when it is invisible Liu Ying
2026-11-03 6:22 ` [PATCH v9 04/16] drm/imx: dc-kms: Use driver specific .atomic_commit_tail callback Liu Ying
2026-11-03 6:39 ` sashiko-bot
2026-11-03 7:03 ` Liu Ying
2026-11-03 6:22 ` [PATCH v9 05/16] drm/imx: dc-fu: Fix dimensions Liu Ying
2026-11-03 6:22 ` [PATCH v9 06/16] drm/imx: dc: Flag CRTC status in GENERALPURPOSE register Liu Ying
2026-11-03 6:32 ` sashiko-bot
2026-11-03 6:22 ` [PATCH v9 07/16] drm/imx: dc-crtc: Disable at boot Liu Ying
2026-11-03 6:38 ` sashiko-bot
2026-11-30 8:24 ` Liu Ying
2026-11-03 6:22 ` [PATCH v9 08/16] drm/imx: dc: Add PRG support Liu Ying
2026-11-03 6:36 ` sashiko-bot
2026-11-30 8:35 ` Liu Ying [this message]
2026-11-03 6:22 ` [PATCH v9 09/16] drm/imx: dc: Add DPR channel support Liu Ying
2026-11-03 6:53 ` sashiko-bot
2026-11-03 6:22 ` [PATCH v9 10/16] drm/imx: dc: Use TCON operation mode Liu Ying
2026-11-03 6:22 ` [PATCH v9 11/16] drm/imx: dc-ed: Support getting source selection Liu Ying
2026-11-03 6:22 ` [PATCH v9 12/16] drm/imx: dc-lb: Support getting secondary input selection Liu Ying
2026-11-03 6:22 ` [PATCH v9 13/16] drm/imx: dc-ed: Drop initial source selection Liu Ying
2026-11-03 6:22 ` [PATCH v9 14/16] drm/imx: dc-lb: Drop initial primary and secondary input selections Liu Ying
2026-11-03 6:22 ` [PATCH v9 15/16] drm/imx: dc-fu: Get DPR channel Liu Ying
2026-11-03 6:22 ` [PATCH v9 16/16] drm/imx: dc: Use prefetch engine Liu Ying
2026-11-03 7:03 ` sashiko-bot
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=aw01azx6KcQlOZHm@raspi \
--to=victor.liu@nxp.com \
--cc=Frank.Li@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=imx@lists.linux.dev \
--cc=robh@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