Skip to contentSkip to conversation

drm/msm/dp: skip the link teardown after a failed enable

PATCH In review Burke Cates 2 participants 3 messages Nov 4 – Nov 23

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/msm/dp: skip the link teardown after a failed enable

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")

---

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/[email protected]/

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(+)
drivers/gpu/drm/msm/dp/dp_display.c +9 -0
index 9299ce616fdb..76784cc45228 100644
@@ -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

Signature · 1 line
2.54.0
#1 lore raw
Quoted 4 lines · Burke Cates

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

Quoted 65 lines

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")

---

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/[email protected]/

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(+)
drivers/gpu/drm/msm/dp/dp_display.c +9 -0
index 9299ce616fdb..76784cc45228 100644
@@ -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 lore raw
Quoted 3 lines · Thorsten Leemhuis

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/[email protected]/
- 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/[email protected]/

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