mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/msm/dp: skip the link teardown after a failed enable
@ 2026-11-04  7:20 Burke Cates
  2026-11-23 11:00 ` Thorsten Leemhuis
  0 siblings, 1 reply; 5+ messages in thread
From: Burke Cates @ 2026-11-04  7:20 UTC (permalink / raw)
  To: robin.clark, Dmitry Baryshkov
  Cc: Abhinav Kumar, Dmitry Baryshkov, Yongxing Mou, Jessica Zhang,
	Sean Paul, Marijn Suijten, David Airlie, Simona Vetter, Xilin Wu,
	linux-arm-msm, dri-devel, freedreno, linux-kernel, regressions

Commit 1bda647ce61b ("drm/msm/dp: move link-level teardown from
display_disable to display_unprepare") moved msm_dp_ctrl_off_link() and
the PHY exit into msm_dp_display_unprepare(). Unlike
msm_dp_display_disable(), that function does not check power_on.

When link training fails, msm_dp_ctrl_on_link() has already turned the
link clocks and the PHY off, and .atomic_enable() returns with power_on
still false. The next disable now runs msm_dp_ctrl_off_link() anyway,
which writes REG_DP_MAINLINK_CTRL and pulses DP_SW_RESET with the link
clocks off. On an ASUS Zenbook A16 (Glymur, eDP) the SoC then resets.

Skip the link teardown when power_on is false, as before that commit,
but still drop the runtime PM reference.

Tested on the A16 by forcing link training to fail and then blanking
the display: the SoC reset 2/2 times without this patch and 0/3 with
it.

Fixes: 1bda647ce61b ("drm/msm/dp: move link-level teardown from display_disable to display_unprepare")
Signed-off-by: Burke Cates <burke.cates@gmail.com>
---

Notes:
    Test base: v7.4-rc1 with out-of-tree Glymur platform, board and eDP
    PHY patches; drivers/gpu/drm/msm/dp as in v7.4-rc1 plus a local
    knob that fails every training attempt. The reset is silent (no
    pstore), so which of the two accesses triggers it is not known.
    
    As before 1bda647ce61b, a failure after successful training still
    leaves the link up. Xilin Wu's hdr10 v2 09/20 handles these paths
    more generally; this is the minimal fix for -rc. Happy to test his
    approach instead.
    https://lore.kernel.org/all/20261009-msm-dp-hdr10-v2-9-1835d4966da3@radxa.com/
    
    The bug was found and this patch drafted with an AI coding
    assistant (Claude Code, Claude Opus 5.5); I reviewed it and ran the
    tests.

 drivers/gpu/drm/msm/dp/dp_display.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 9299ce616fdb..76784cc45228 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -1528,6 +1528,14 @@ static void msm_dp_display_unprepare(struct msm_dp_display_private *dp)
 {
 	struct msm_dp *msm_dp_display = &dp->msm_dp_display;
 
+	/*
+	 * Failed link training leaves the link clocks off. Avoid accessing
+	 * link registers after a failed enable, but still release the
+	 * runtime-PM reference below.
+	 */
+	if (!msm_dp_display->power_on)
+		goto out;
+
 	/* dongle is still connected but sinks are disconnected */
 	if (dp->link->sink_count == 0)
 		msm_dp_link_psm_config(dp->link, &dp->panel->link_info, true);
@@ -1542,6 +1550,7 @@ static void msm_dp_display_unprepare(struct msm_dp_display_private *dp)
 
 	msm_dp_display->power_on = false;
 
+out:
 	pm_runtime_put_sync(&msm_dp_display->pdev->dev);
 
 	drm_dbg_dp(dp->drm_dev, "type=%d Done\n", msm_dp_display->connector_type);

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.54.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/msm/dp: skip the link teardown after a failed enable
  2026-11-04  7:20 [PATCH] drm/msm/dp: skip the link teardown after a failed enable Burke Cates
@ 2026-11-23 11:00 ` Thorsten Leemhuis
  2026-11-23 16:25   ` Burke Cates
  0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Leemhuis @ 2026-11-23 11:00 UTC (permalink / raw)
  To: Burke Cates, robin.clark, Dmitry Baryshkov
  Cc: Abhinav Kumar, Dmitry Baryshkov, Yongxing Mou, Jessica Zhang,
	Sean Paul, Marijn Suijten, David Airlie, Simona Vetter, Xilin Wu,
	linux-arm-msm, dri-devel, freedreno, linux-kernel, regressions

On 11/4/26 08:20, Burke Cates wrote:
> Commit 1bda647ce61b ("drm/msm/dp: move link-level teardown from
> display_disable to display_unprepare") moved msm_dp_ctrl_off_link() and
> the PHY exit into msm_dp_display_unprepare(). Unlike
> msm_dp_display_disable(), that function does not check power_on.

Was this regression ever resolved through the proposed or another
patch[1]? Looks like it feel through the cracks, but it's easy to miss
something from the outside.

Ciao, Thorsten



> When link training fails, msm_dp_ctrl_on_link() has already turned the
> link clocks and the PHY off, and .atomic_enable() returns with power_on
> still false. The next disable now runs msm_dp_ctrl_off_link() anyway,
> which writes REG_DP_MAINLINK_CTRL and pulses DP_SW_RESET with the link
> clocks off. On an ASUS Zenbook A16 (Glymur, eDP) the SoC then resets.
> 
> Skip the link teardown when power_on is false, as before that commit,
> but still drop the runtime PM reference.
> 
> Tested on the A16 by forcing link training to fail and then blanking
> the display: the SoC reset 2/2 times without this patch and 0/3 with
> it.
> 
> Fixes: 1bda647ce61b ("drm/msm/dp: move link-level teardown from display_disable to display_unprepare")
> Signed-off-by: Burke Cates <burke.cates@gmail.com>
> ---
> 
> Notes:
>     Test base: v7.4-rc1 with out-of-tree Glymur platform, board and eDP
>     PHY patches; drivers/gpu/drm/msm/dp as in v7.4-rc1 plus a local
>     knob that fails every training attempt. The reset is silent (no
>     pstore), so which of the two accesses triggers it is not known.
>     
>     As before 1bda647ce61b, a failure after successful training still
>     leaves the link up. Xilin Wu's hdr10 v2 09/20 handles these paths
>     more generally; this is the minimal fix for -rc. Happy to test his
>     approach instead.
>     https://lore.kernel.org/all/20261009-msm-dp-hdr10-v2-9-1835d4966da3@radxa.com/
>     
>     The bug was found and this patch drafted with an AI coding
>     assistant (Claude Code, Claude Opus 5.5); I reviewed it and ran the
>     tests.
> 
>  drivers/gpu/drm/msm/dp/dp_display.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index 9299ce616fdb..76784cc45228 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -1528,6 +1528,14 @@ static void msm_dp_display_unprepare(struct msm_dp_display_private *dp)
>  {
>  	struct msm_dp *msm_dp_display = &dp->msm_dp_display;
>  
> +	/*
> +	 * Failed link training leaves the link clocks off. Avoid accessing
> +	 * link registers after a failed enable, but still release the
> +	 * runtime-PM reference below.
> +	 */
> +	if (!msm_dp_display->power_on)
> +		goto out;
> +
>  	/* dongle is still connected but sinks are disconnected */
>  	if (dp->link->sink_count == 0)
>  		msm_dp_link_psm_config(dp->link, &dp->panel->link_info, true);
> @@ -1542,6 +1550,7 @@ static void msm_dp_display_unprepare(struct msm_dp_display_private *dp)
>  
>  	msm_dp_display->power_on = false;
>  
> +out:
>  	pm_runtime_put_sync(&msm_dp_display->pdev->dev);
>  
>  	drm_dbg_dp(dp->drm_dev, "type=%d Done\n", msm_dp_display->connector_type);
> 
> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/msm/dp: skip the link teardown after a failed enable
  2026-11-23 11:00 ` Thorsten Leemhuis
@ 2026-11-23 16:25   ` Burke Cates
  2026-12-01 11:18     ` Thorsten Leemhuis
  0 siblings, 1 reply; 5+ messages in thread
From: Burke Cates @ 2026-11-23 16:25 UTC (permalink / raw)
  To: Thorsten Leemhuis, robin.clark, Dmitry Baryshkov
  Cc: Abhinav Kumar, Dmitry Baryshkov, Yongxing Mou, Jessica Zhang,
	Sean Paul, Marijn Suijten, David Airlie, Simona Vetter, Xilin Wu,
	linux-arm-msm, dri-devel, freedreno, linux-kernel, regressions,
	Gianfranco Mariotti

On 23/11/2026 03:00, Thorsten Leemhuis wrote:
> Was this regression ever resolved through the proposed or another
> patch[1]? Looks like it feel through the cracks, but it's easy to miss
> something from the outside.

No, it is still open, and there has been no reply from the
maintainers. 1bda647ce61b was not reverted, and nothing in
drivers/gpu/drm/msm/dp has changed this path in v7.4-rc4 or
next-20261120: msm_dp_display_unprepare() still calls
msm_dp_ctrl_off_link() after a failed enable. The patch applies
unchanged to both.

Two other postings touch the same function, but as far as I can tell
neither covers this path:

- Gianfranco Mariotti's 7/7 has a Fixes: tag for 1bda647ce61b. It
  gates the dongle power-down and PHY re-init on dp->plugged for a
  cable unplug; the off_link() call stays unconditional.
  https://lore.kernel.org/all/20261121214105.32596-8-gianfranco.mariotti94@gmail.com/
- MST v9 08/29 replaces power_on with active_stream_mask. After a
  failed enable no stream bit is set, so unprepare() still runs
  off_link(). My patch would need rework on top of it.
  https://lore.kernel.org/all/20261119-msm-dp-mst-v9-8-ca61be4edfc3@oss.qualcomm.com/

Xilin Wu's broader rework (hdr10 v2 09/20) has no newer revision.

I'm happy to send a v2 or test a different approach on the A16.

An AI coding assistant helped check the trees and draft this reply.

Thanks,
Burke

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/msm/dp: skip the link teardown after a failed enable
  2026-11-23 16:25   ` Burke Cates
@ 2026-12-01 11:18     ` Thorsten Leemhuis
  2026-12-02 13:12       ` Liviu Nicoara
  0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Leemhuis @ 2026-12-01 11:18 UTC (permalink / raw)
  To: Burke Cates, Simona Vetter, David Airlie
  Cc: Abhinav Kumar, Dmitry Baryshkov, robin.clark, Yongxing Mou,
	Jessica Zhang, Sean Paul, Marijn Suijten, Dmitry Baryshkov,
	Xilin Wu, linux-arm-msm, dri-devel, freedreno, linux-kernel,
	regressions, Gianfranco Mariotti

On 11/23/26 17:25, Burke Cates wrote:> On 23/11/2026 03:00, Thorsten
Leemhuis wrote:
>> Was this regression ever resolved through the proposed or another
>> patch[1]? Looks like it feel through the cracks, but it's easy to miss
>> something from the outside.
> 
> No, it is still open, and there has been no reply from the
> maintainers.

That is still the case afaics (please correct me if I'm wrong).

Given that we are close to -rc6 (which is where Linus wants all known
regressions to be fixed), I'm considering to ask Linus to pull this
straight from the list.

Dave, Sima: Or do you want to pick this up for this weeks -fixes pull?

Ciao, Thorsten

> 1bda647ce61b was not reverted, and nothing in
> drivers/gpu/drm/msm/dp has changed this path in v7.4-rc4 or
> next-20261120: msm_dp_display_unprepare() still calls
> msm_dp_ctrl_off_link() after a failed enable. The patch applies
> unchanged to both.
> 
> Two other postings touch the same function, but as far as I can tell
> neither covers this path:
> 
> - Gianfranco Mariotti's 7/7 has a Fixes: tag for 1bda647ce61b. It
>   gates the dongle power-down and PHY re-init on dp->plugged for a
>   cable unplug; the off_link() call stays unconditional.
>   https://lore.kernel.org/all/20261121214105.32596-8-gianfranco.mariotti94@gmail.com/
> - MST v9 08/29 replaces power_on with active_stream_mask. After a
>   failed enable no stream bit is set, so unprepare() still runs
>   off_link(). My patch would need rework on top of it.
>   https://lore.kernel.org/all/20261119-msm-dp-mst-v9-8-ca61be4edfc3@oss.qualcomm.com/
> 
> Xilin Wu's broader rework (hdr10 v2 09/20) has no newer revision.
> 
> I'm happy to send a v2 or test a different approach on the A16.
> 
> An AI coding assistant helped check the trees and draft this reply.
> 
> Thanks,
> Burke


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/msm/dp: skip the link teardown after a failed enable
  2026-12-01 11:18     ` Thorsten Leemhuis
@ 2026-12-02 13:12       ` Liviu Nicoara
  0 siblings, 0 replies; 5+ messages in thread
From: Liviu Nicoara @ 2026-12-02 13:12 UTC (permalink / raw)
  To: Thorsten Leemhuis, Burke Cates, Simona Vetter, David Airlie
  Cc: Abhinav Kumar, Dmitry Baryshkov, robin.clark, Yongxing Mou,
	Jessica Zhang, Sean Paul, Marijn Suijten, Dmitry Baryshkov,
	Xilin Wu, Gianfranco Mariotti, linux-arm-msm, dri-devel,
	freedreno, linux-kernel, regressions

On Tue, 1 Dec 2026 12:18:17 +0100, Thorsten Leemhuis wrote:
> Given that we are close to -rc6 (which is where Linus wants all known
> regressions to be fixed), I'm considering to ask Linus to pull this
> straight from the list.
>
> Dave, Sima: Or do you want to pick this up for this weeks -fixes pull?

Another data point for taking this in -rc6: this regression also hits
organically on mainline-supported X1E80100 (Dell XPS 13 9345, external
USB-C DisplayPort monitor) running v7.4-rc5 with unmodified
drivers/gpu/drm/msm (the only local patches are board DTS additions for
audio, camera, and thermal zones).

When the external DP attach fails to enable ctrl_link (-16) during
.atomic_enable() and the connector is then turned off, the unguarded
msm_dp_ctrl_off_link() in msm_dp_display_unprepare() takes an EL1
synchronous external abort and the machine resets seconds later:

  [   21.612656] disp_cc_mdss_dptx1_link_clk status stuck at 'off'
  [   21.612665] WARNING: drivers/clk/qcom/clk-branch.c:87 at clk_branch_toggle+0x180/0x1a4, CPU#5: tyler/1463
  [   21.612999] Failed to enable clk 'ctrl_link': -16
  [   21.613001] [drm:msm_dp_ctrl_enable_mainlink_clocks [msm]] *ERROR* Unable to start link clocks. ret=-16
  [   21.613013] [drm:msm_dp_display_atomic_enable [msm]] *ERROR* Failed link training (rc=-16)
  [   21.613024] [drm:msm_dp_display_atomic_enable [msm]] *ERROR* DP display prepare failed, rc=-16
  [   22.134699] Internal error: synchronous external abort: 0000000096001610 [#1]  SMP
  [   22.134828] CPU: 5 UID: 1001 PID: 1463 Comm: tyler Tainted: G   M    W           7.4.0-rc5-1.1-aarch64-ARTIX #1 PREEMPT(full)
  [   22.134832] Hardware name: Dell Inc. XPS 13 9345/0W8JXV, BIOS 2.15.0 08/31/2026
  [   22.134836] pc : msm_dp_ctrl_off_link+0x4c/0xa8 [msm]
  [   22.134853] lr : msm_dp_ctrl_off_link+0x44/0xa8 [msm]
  [   22.134888] Call trace:
  [   22.134889]  msm_dp_ctrl_off_link+0x4c/0xa8 [msm] (P)
  [   22.134901]  msm_dp_display_atomic_post_disable+0x64/0x190 [msm]
  [   22.134911]  msm_dp_bridge_atomic_post_disable+0x18/0x40 [msm]
  [   22.134921]  drm_atomic_bridge_chain_post_disable+0x88/0x260 [drm]
  [   22.134934]  drm_atomic_helper_commit_encoder_bridge_post_disable+0xf8/0x19c [drm_kms_helper]
  [   22.134940]  drm_atomic_helper_commit_modeset_disables+0x2c/0x80 [drm_kms_helper]
  [   22.134944]  msm_atomic_commit_tail+0x198/0x590 [msm]
  [   22.135032] Code: 9129c063 97f5b6aa f9401a61 d503201f (b9400020)

From the disassembly of msm_dp_ctrl_off_link+0x4c, the faulting
instruction (b9400020: ldr w0, [x1]) is the first REG_DP_MAINLINK_CTRL
read inside msm_dp_ctrl_mainlink_disable(), before DP_SW_RESET is
reached.

On v7.2.14 (before 1bda647ce61b), the same disp_cc_mdss_dptx1_link_clk
-16 failure hit six times in one boot without taking an abort, because
msm_dp_display_disable() returned early on !power_on.

I have not rebuilt with Burke's patch yet, so no Tested-by, just
confirming the regression is live on mainline X1E80100.

Thanks,
Liviu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-02 13:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04  7:20 [PATCH] drm/msm/dp: skip the link teardown after a failed enable Burke Cates
2026-11-23 11:00 ` Thorsten Leemhuis
2026-11-23 16:25   ` Burke Cates
2026-12-01 11:18     ` Thorsten Leemhuis
2026-12-02 13:12       ` Liviu Nicoara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®