All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "AngeloGioacchino Del Regno" <angelogioacchino.delregno@collabora.com>
Cc: conor+dt@kernel.org, robh@kernel.org,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v7 11/13] drm/mediatek: mtk_dsi: Enable PM Runtime on probe
Date: Mon, 14 Sep 2026 12:37:54 +0000	[thread overview]
Message-ID: <20260914123754.E949E1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260914115812.22751-12-angelogioacchino.delregno@collabora.com>

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

New issues:
- [High] Enabling PM runtime leaves the DSI device perpetually suspended because `mtk_ddp_comp_power_on()` is only invoked for the first component in the display pipeline, never for the DSI device.

Pre-existing issues:
- [High] Bridge properties are initialized after registration, exposing an uninitialized state to concurrent lookups.
- [High] Read-modify-write race on `dsi->irq_data` between process context and IRQ handler context leads to lost interrupts.
--

commit 18651040b7788a002a5585acda6d5cf89879837e
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
drm/mediatek: mtk_dsi: Enable PM Runtime on probe

This commit enables PM runtime at the end of mtk_dsi_probe(), placing the
DSI IP under PM domain control. It expects mtk_ddp_comp_power_on() and off
functions to resume and suspend the device appropriately.

> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d930cb3c4d74e..b668814b92000 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -1734,6 +1734,10 @@ static int mtk_dsi_probe(struct platform_device *pdev)

[ ... ]

> +	ret = devm_pm_runtime_enable(dev);
> +	if (ret)
> +		return ret;
> +

[Severity: High]
Does this leave the DSI device perpetually suspended?

The commit message states that mtk_ddp_comp_power_on() is expected to
call pm_runtime_resume_and_get() for the DSI device. However, tracing
mtk_crtc_atomic_enable() reveals that the power-on mechanism operates
strictly on the first component in the display pipeline:

drivers/gpu/drm/mediatek/mtk_crtc.c:mtk_crtc_atomic_enable() {
        ...
        struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0];
        ...
        ret = mtk_ddp_comp_power_on(comp);
        ...
}

Since the DSI device is at the end of the pipeline and is never ddp_comp[0],
its PM usage count wouldn't be incremented. Because the driver accesses
hardware registers in mtk_dsi_poweron() while the device is still considered
RPM_SUSPENDED by the PM framework, could this regression cause bus faults
or unclocked access crashes?

>  	ret = mipi_dsi_host_register(&dsi->host);
>  	if (ret < 0)
>  		return dev_err_probe(dev, ret, "Failed to register DSI host\n");

[Severity: High]
This is a pre-existing issue, but does this expose an uninitialized bridge
state to concurrent lookups?

In mtk_dsi_probe(), mipi_dsi_host_register() is called before the bridge
properties are initialized:

drivers/gpu/drm/mediatek/mtk_dsi.c:mtk_dsi_probe() {
        ...
        ret = mipi_dsi_host_register(&dsi->host);
        ...
        dsi->bridge.of_node = dev->of_node;
        dsi->bridge.type = DRM_MODE_CONNECTOR_DSI;
        ...
}

Because mipi_dsi_host_register() can synchronously probe child panel
devices, the child's attachment sequence triggers mtk_dsi_host_attach(),
which calls drm_bridge_add(&dsi->bridge).

This publishes the bridge to the global list before of_node and type are
set. Could concurrent iterations over the global bridge_list (like
drm_of_find_panel_or_bridge()) observe a NULL of_node and encounter lookup
failures or spurious -EPROBE_DEFER errors?

Additionally, while reviewing this code, I noticed another pre-existing
issue in the same file:

[Severity: High]
This is a pre-existing issue, but can the read-modify-write pattern on
dsi->irq_data lead to lost interrupts?

The variable dsi->irq_data is updated from both process context and
hardware interrupt context using unprotected read-modify-write operations:

Process context:
mtk_dsi_irq_data_clear() {
        dsi->irq_data &= ~irq_bit;
}

Hardware interrupt context:
mtk_dsi_irq_data_set() {
        dsi->irq_data |= irq_bit;
}

If a hardware interrupt fires between the load and store instructions of the
process context update, the process context will immediately overwrite the
IRQ handler's updated value with its stale loaded value.

Could this erase the interrupt flag and lead to missed wakeups and timeouts
in wait_event_interruptible_timeout() during display initialization?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260914115812.22751-1-angelogioacchino.delregno@collabora.com?part=11

  reply	other threads:[~2026-09-14 12:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 11:57 [PATCH v7 00/13] drm/mediatek: Add DSC, WDMA, MT8189/96 DSI support AngeloGioacchino Del Regno
2026-09-14 11:58 ` [PATCH v7 01/13] dt-bindings: display: mediatek: dsc: Add MT8196 compatible AngeloGioacchino Del Regno
2026-09-14 11:58 ` [PATCH v7 02/13] drm/mediatek: Implement Display Stream Compression support AngeloGioacchino Del Regno
2026-09-14 12:14   ` sashiko-bot
2026-09-14 11:58 ` [PATCH v7 03/13] dt-bindings: display: mediatek: dsi: Document MT8189 and MT8196 AngeloGioacchino Del Regno
2026-09-14 11:58 ` [PATCH v7 04/13] drm/mediatek: mtk_dsi: Cleanup encoder if reset fails during bind AngeloGioacchino Del Regno
2026-09-14 12:12   ` sashiko-bot
2026-09-14 11:58 ` [PATCH v7 05/13] drm/mediatek: mtk_dsi: Enable interrupt at component bind time AngeloGioacchino Del Regno
2026-09-14 12:11   ` sashiko-bot
2026-09-14 11:58 ` [PATCH v7 06/13] drm/mediatek: mtk_dsi: Transfer register offsets to per-SoC const AngeloGioacchino Del Regno
2026-09-14 11:58 ` [PATCH v7 07/13] drm/mediatek: mtk_dsi: Move max link rate parameter to platform data AngeloGioacchino Del Regno
2026-09-14 12:16   ` sashiko-bot
2026-09-14 11:58 ` [PATCH v7 08/13] drm/mediatek: mtk_dsi: Add support for MT8189 AngeloGioacchino Del Regno
2026-09-14 12:20   ` sashiko-bot
2026-09-14 11:58 ` [PATCH v7 09/13] drm/mediatek: mtk_dsi: Add support for SRAM QoS setting AngeloGioacchino Del Regno
2026-09-14 11:58 ` [PATCH v7 10/13] drm/mediatek: mtk_dsi: Add support for MT8196 AngeloGioacchino Del Regno
2026-09-14 11:58 ` [PATCH v7 11/13] drm/mediatek: mtk_dsi: Enable PM Runtime on probe AngeloGioacchino Del Regno
2026-09-14 12:37   ` sashiko-bot [this message]
2026-09-14 11:58 ` [PATCH v7 12/13] dt-bindings: display: mediatek: wdma: Add compatibles for more SoCs AngeloGioacchino Del Regno
2026-09-14 12:30   ` sashiko-bot
2026-09-14 11:58 ` [PATCH v7 13/13] drm/mediatek: Add Write DMA (WDMA) Engine for Writeback support AngeloGioacchino Del Regno
2026-09-14 12:31   ` 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=20260914123754.E949E1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.