Skip to content

drm/apple, thunderbolt: apple: stop waiting for a link on a DP tunnel that went - #1930

Merged
DjDeveloperr merged 3 commits into
aurora-silicon:integration/aurorafrom
Isaac-Duarte:t6050-dp-tunnel-withdrawn
Nov 16, 2026
Merged

DjDeveloperr merged 3 commits into
aurora-silicon:integration/aurorafrom
Isaac-Duarte:t6050-dp-tunnel-withdrawn

Conversation

@Isaac-Duarte

@Isaac-Duarte Isaac-Duarte commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

On a J714s (M5 Pro), a Thunderbolt 5 dock's first DP tunnel after boot or plug-in sometimes leaves its display dark until the dock is plugged in again:

apple-dcp 2b2e00000.dcp: dcp_dptx_connect: timed out waiting for port 0 link configuration
apple-dcp 2b2e00000.dcp: AFK[ep:2c]: AppleDCPDPTXRemotePort (chan:1) service call group 0 cmd 7 failed to complete: -110
thunderbolt-apple-acio 381ac0000.acio: dpin0: display teardown failed: -110
thunderbolt-apple-acio 381ac0000.acio: dpin0: DP tunnel setup failed: -110

What happens

With thunderbolt.dyndbg=+p thunderbolt_apple.dyndbg=+p, times from the tunnel's paths being set up:

time event
+113 ms DCP is routed to the tunnel (display routed to Thunderbolt DP tunnel dpin0), before DPRX is done
+124 ms dpin0: active
+132 ms dpin0: interrupt … HPD 0, HPD changed
+162 ms acking hot unplug event on 1:12, DP OUT resource unavailable: adapter unplug: the dock withdraws its DP OUT and the tunnel is deactivated
~+1.4–2.0 s acking hot plug event on 1:12: the dock re-advertises it

On boots where the dock does not withdraw, DPRX completes at about +160 ms and the display comes up. Where it does, the connect still waits the full 2 s for a link configuration on a tunnel that is gone: it runs from the DP IN adapter's ordered worker under the fabric lock, so the detach that would end it is queued behind it. Meanwhile DCP retries the link about every 505 ms (DPTXPort: firmware reports link fault 22).

When the 2 s run out, out_withdraw releases the display (group 0 cmd 7). If that release lands in the first few milliseconds of one of DCP's retries, DCP never answers it, and every later DPTX call times out too; the pipeline stays held. Over 11 such connects in the journal:

release, after the last link fault 22 connects result
0.4–26 ms 5 4 dark, 1 recovered
97–511 ms 6 all recovered

A longer settle before DCP starts does not help: with 400 ms instead of 100 ms (apple_dpin_m5.settle_ms), the dock withdrew 50 ms after DCP started, at +471 ms. The withdrawal follows DCP's start, not the tunnel's.

What changes

1. thunderbolt: apple: tell appledrm whether a DP tunnel is still requested

  • New apple_dp_tunnel_binding_live(binding), declared in dp-tunnel.h and found with symbol_get() like the other hooks there. It is true while the binding's tunnel is requested (apple_dpin_token_access()) and the adapter is alive. Deactivation clears both at once, before the detach reaches appledrm.
  • It takes the adapter's lock, as the binding's set_active callback does, so the lock order (appledrm tb_lock, then the adapter's lock) is unchanged.

2. drm/apple: stop waiting for a link on a DP tunnel that went

  • dcp_dptx_connect_raw() waits for the link configuration in 50 ms slices (dcp_dptx_wait_linkcfg()), and between them asks whether the tunnel feeding the port is still requested (dcp_tb_tunnel_withdrawn()): port 0's binding, or on port 1 the tiled split's own binding. Once it is not, it logs the DP tunnel went before link configuration and withdraws at once, through the existing out_withdraw path.
  • That release now comes 17 to 48 ms after the withdrawal, about 400 ms before DCP's first retry. This makes an unanswered release rare, not impossible (see the follow-up data below); when one still times out, the re-advertised tunnel's connect recovers the display.
  • Scope: only T6050 (of_machine_is_compatible("apple,t6050")) watches the tunnel. M2 Pro/Max, T6030 and every other SoC keep the single 2 s wait until this is tested there. Direct DP alt mode connects have no binding and wait as before; compact (T8132) and late-HPD (T8122) connects keep their single wait.

Testing

J714s (MacBook Pro 14" M5 Pro), kernel 7.3.0-36.n1usb (integration/aurora 9219565) with #1921 and this series, appledrm.ko and thunderbolt_apple.ko built from that tree. Dock: Ugreen 10-in-1 Thunderbolt 5 on the right port, three 1920x1080@165 displays.

boot dynamic debug dock withdrew DP IN 0 wait ended DP IN 0 re-routed timeout / -110 displays
1 on +190 ms +237 ms +1.5 s none 3
2 on +193 ms +240 ms +2.2 s none 3
3 on +188 ms +233 ms +1.5 s none 3
4 on +165 ms +182 ms +1.5 s none 3
5 on +184 ms +225 ms +1.5 s none 3
6 off +196 ms +241 ms +1.5 s none 3
7 off +191 ms +239 ms +1.5 s none 3
8 off +193 ms +237 ms +1.5 s none 3

Before this series, on the same setup: 11 of 21 first connects hit the withdrawal; 4 of those stayed dark.

A day of use afterwards (2026-11-15: 12 boots of a kernel carrying this series, 8 of them with dock connects and withdrawals; those boots ran the previous revision of commit 2, which behaves identically on T6050's DPTX port 0: the gate is true there and the binding is the same): 33 withdrawals (24 of DP IN 0, 5 of DP IN 1, 4 of DP IN 2), each followed by a re-route and the display coming up. One early release still timed out, on DP IN 2 (dcpext2, 302e00000.dcp):

time event
13:02:16.435 display routed to Thunderbolt DP tunnel dpin2
13:02:16.596 dcp_dptx_connect: port 0: the DP tunnel went before link configuration
13:02:17.066 DCP's first retry (link fault 22)
13:02:17.658 the release still times out: group 0 cmd 7 failed to complete: -110
13:02:19.570 re-routed to dpin2; the display came up

So DCP can leave even an early release unanswered; the series makes it rare (1 of 33 releases unanswered and none dark, against 4 of 11 unanswered and dark before) and the re-route recovered it. No display stayed dark.

  • Build: both commits at this branch's base (7c71d6d), each on its own, with W=1 and the kit config: no warnings in drivers/thunderbolt or drivers/gpu/drm/apple. The revised commit 2 (T6050 gate, per-port binding, helpers moved above dcp_dptx_connect_raw()'s comment): dcp.o builds with LLVM=1 W=1 and no compiler warnings.
  • checkpatch --strict: 0 errors, 1 warning (the quoted kernel log lines in commit 2's message).
  • No new KUnit test: the change is in dcp.c and thunderbolt/apple.c, which the fabric and DP IN suites do not exercise.

Not tested

  • Other docks, the left-front port, and other T6050 boards.
  • A withdrawal of DP IN 3. (A tiled split's second tile, port 1, cannot occur on T6050: dcp_typec_port_untileable() treats firmware-27 pipelines as unable to take a tile.)
  • Other SoCs: the watch is limited to T6050.

Related: #1921 (third dock display). Independent of it; tested on top of it.

appledrm connects a DP tunnel's display from the DP IN adapter's ordered
worker and waits for DCP to configure the link. A tunnel that is taken
down meanwhile is detached only after that wait: the detach is queued
behind it. The adapter knows at once, when the tunnel is deactivated,
that the tunnel is no longer requested.

Export apple_dp_tunnel_binding_live() so that appledrm can ask, for the
binding it was handed, whether its tunnel is still requested. It takes
the adapter's lock, as the binding's set_active callback does.

Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com>
A Thunderbolt 5 dock (Ugreen 10-in-1) on a J714s withdraws its first DP
tunnel about 190 ms after it is requested, right after DCP starts on it,
in about half of its first connects after boot or plug-in, and
re-advertises it about 1.4 s later. The connect then waits the full 2 s
for a link configuration that cannot come, while DCP retries the link
about every 500 ms. The release that follows the timeout can land in the
first milliseconds of such a retry, and then DCP never answers it:

  apple-dcp 2b2e00000.dcp: dcp_dptx_connect: timed out waiting for port 0 link configuration
  apple-dcp 2b2e00000.dcp: AFK[ep:2c]: AppleDCPDPTXRemotePort (chan:1) service call group 0 cmd 7 failed to complete: -110
  thunderbolt-apple-acio 381ac0000.acio: dpin0: display teardown failed: -110
  thunderbolt-apple-acio 381ac0000.acio: dpin0: DP tunnel setup failed: -110

The display stays dark, its pipeline held, until the dock is plugged in
again. Over 11 such connects, 4 of the 5 releases sent within 26 ms of a
retry went unanswered, and none of the 6 sent 97 ms or more after one.

Wait for the link in 50 ms slices, and ask the Thunderbolt glue between
them whether the tunnel feeding the port is still requested. Once it is
not, release the display at once, well before DCP's first retry. This
makes an unanswered release rare, not impossible: DCP can still leave an
early release unanswered, and then the re-advertised tunnel's connect
recovers the display.

Only T6050 watches the tunnel for now; elsewhere the wait is unchanged
until it is tested there.

Tested on J714s with the dock on the right port: over 8 boots the dock
withdrew the first tunnel each time, the wait ended 17 to 48 ms later,
and all three displays came up on the re-advertised tunnels, with no
timeout and no -110. Over a later day of use (8 boots, 33 withdrawals of
DP IN 0, 1 and 2), one early release still timed out: DP IN 2's tunnel
went at 13:02:16.596, DCP retried at 17.066, the release failed with -110
at 17.658, and the re-route at 19.570 brought the display up. No display
stayed dark.

Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com>
@Isaac-Duarte
Isaac-Duarte force-pushed the t6050-dp-tunnel-withdrawn branch from 28e0e17 to 56793ef Compare November 15, 2026 20:35
dcp_dptx_connect_raw() now waits through dcp_dptx_wait_linkcfg(), so
the bounce scenario pastes it too. The scenario is an H17P link: the
tunnel-withdrawal watch is off and reaching it is a failure.

Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com>
@DjDeveloperr
DjDeveloperr merged commit bfc90e9 into aurora-silicon:integration/aurora Nov 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants