Skip to content

drm: apple: second Thunderbolt stream (daisy chain) on the M2 Ultra Mac Studio - #468

Closed
jcrowthe wants to merge 5 commits into
omacom:integration/aurorafrom
jcrowthe:tb-dpin1-pipeline
Closed

jcrowthe wants to merge 5 commits into
omacom:integration/aurorafrom
jcrowthe:tb-dpin1-pipeline

Conversation

@jcrowthe

Copy link
Copy Markdown

A display daisy-chained behind a Thunderbolt monitor (or a dual-stream dock's second display) on the Mac Studio M2 Ultra (J475d). Stacked on #463: please review only the last commit, drm: apple: don't fix a port's second DP tunnel to its first stream's pipeline. Independent of #467.

Problem

With a portable monitor plugged into the downstream Thunderbolt port of an LG 40WP95C, the second stream is refused while other pipelines are idle:

thunderbolt-apple-nhi 701f00000.nhi: DP IN tunnel routing: tunnel 0:6 <-> 1:14
thunderbolt-apple-acio 701ac0000.cio: dpin1: DP tunnel setup failed: -16

apple_probe_typec_ports() fixes each port's secondary (DPIN1) connector to the lowest-indexed Type-C-only pipeline. On the M2 Pro/Max laptops that is dcpext1, since dcpext0 also drives HDMI. Meanwhile the pairing pass (dcp_fabric_plan(), pipelines in CRTC order) and dcp_fabric_tunnel_candidate() give the first stream the lowest-indexed pipeline, dcpext0. On the J475d HDMI runs from die 1, so every rear-port pipeline is Type-C-only, and the "lowest Type-C-only" pipeline is dcpext0. Both streams want dcpext0, and DPIN1 gets -EBUSY.

Change

dcp_fabric_secondary_crtc() (fabric core) picks the secondary connector's CRTC: the lowest-indexed Type-C-only pipeline other than the port's lowest-indexed pipeline, which the first stream takes. A port with a single Type-C-only pipeline keeps it. apple_probe_typec_ports() uses it for ordered dual-stream secondaries; the other path is unchanged (it reduces to mask |= crtc_mask[i]).

Other machines. On the M2 Pro/Max laptops the port's lowest-indexed pipeline is the HDMI hybrid dcpext0, which was never a secondary candidate, so the result is dcpext1 as before, with or without t6021-display2.dtsi's dcpext2/3. KUnit covers both layouts. T6030 (not ordered) and single-stream machines don't take this path. I have only tested this on the J475d, not on a laptop.

KUnit

tools/testing/kunit/kunit.py run --arch=arm64 (QEMU, 16K pages, clang 18.1.8) with the fabric, DPIN and ATC suites: 183 tests, 182 passed, 1 skipped (S35_dual_retry_off, skipped by the suite itself). The new fabric_secondary_crtc_test:

  • covers the laptop layouts (hybrid lowest, 2 and 4 pipelines) → dcpext1, the J475d layout (four Type-C-only pipelines, in and out of order) → dcpext1, a single Type-C-only pipeline → kept, and none → 0;
  • on a J475d-shaped port, the first stream takes CRTC 0 and the second gets CRTC 1, from both dcp_fabric_tunnel_candidate() and dcp_fabric_plan();
  • with the old mask (CRTC 0), both return nothing / -EBUSY, matching the hardware failure above.

checkpatch --strict is clean.

Hardware testing

Mac Studio (M2 Ultra), linux-aurora 7.2.11.aurora16-1 with #463 and this commit (appledrm.ko, dcp-fabric-core.ko rebuilt, same vermagic), m1n1 from omacom/m1n1#48. LG 40WP95C on a rear port, a 3840x2400 USB-C monitor on its downstream Thunderbolt port, Dell U2718Q on HDMI.

apple-dcp 289c00000.dcp: display routed to Thunderbolt DP tunnel dpin0
apple-dcp 289c00000.dcp: set_digital_out_mode(color:84 timing:43) "3840x2400": 60 ...
apple-dcp 315c00000.dcp: display routed to Thunderbolt DP tunnel dpin1
thunderbolt-apple-acio 701ac0000.cio: dpin1: active handshake=0

Both chained displays come up at boot, through the LUKS prompt and into the desktop. With two streams on the link, the 40WP95C offers at most 5120x2160@30 (or 3440x1440@72). That is the shared link bandwidth, and the monitor's own mode list.

Limitation, not addressed here

DPIN1 still has exactly one pipeline, dcpext1, and nothing keeps direct DP-alt displays off it. If DP-alt displays come up first and hold dcpext0/1 (here an UltraFine and a U2417H on two other rear ports, from power-on), the chained display gets -16 again. The laptops have the same constraint today, with a DP-alt display on dcpext1 and a dock arriving later. Avoiding it would mean steering DP alt away from dcpext1, which works against the follow-CRTC pairing and changes laptop behavior, so I'd rather ask than guess: is that wanted?

…ports

On the Mac Studio (M2 Ultra) no display controller is wired to the four
rear USB-C ports, so a USB-C DisplayPort display there never lights up.
The dcpext1 routes in t602x-j474-j475.dtsi sit inside the
APPLE_T602X_NON_ULTRA block together with the USB4/PCIe-C wiring, and
t6022 does not define it.

The die-0 half of the t6022 keeps the plain labels and the same rear-port
wiring as the M2 Max Studio. macOS on a J475d drives a DP alt mode display
on rear ports 1 and 2 from DCPEXT1 through the display crossbar (ADT
display-crossbar0, "display-crossbar,t602x"), the same controller the
non-Ultra boards use. Keep only the USB4 aliases, the PCIe-C tunnels and
the non-Ultra display iommus under the guard. The dcpext1 display routes,
dpaudio2, the ATC crossbars and the always-on ATC common power domains now
apply to J475d too.

t6022-jxxxd.dtsi points the display subsystem at the die-1 HDMI DART only,
so add dispext1_dart to it on J475d for the framebuffers of the new pipe.

J474s and J475c keep the same nodes and properties; only the position of
the dcpext1 alias within /aliases changes.

Signed-off-by: Jacob Crowther <3944151+jcrowthe@users.noreply.github.com>
The M2 Ultra is two t6021 dies. Its die-0 ACIO, ATC and display crossbar
are the ones the M2 Pro/Max laptops use, and the DCPs are the same
apple,t6020-dcpext. With t6022 missing from apple_dpin_qualified_soc, a
Thunderbolt display on a J475d enumerates, but the DP IN adapter never
asks for a pipeline and the tunnel is torn down after the DPRX timeout:

  thunderbolt-apple-nhi f01f00000.nhi: 0:5 <-> 1:13 (DP): not active, tearing down

Qualify t6022 with the same M2 (pre/post) flow. That flow still requires
dual-stream connector wiring, so nothing changes until a board's DT
describes it.

Tested on a Mac Studio (M2 Ultra, J475d) with an LG 40WP95C on rear
ports 1 and 2: 5120x2160@72, hotplug, and DPMS off/on.

Signed-off-by: Jacob Crowther <3944151+jcrowthe@users.noreply.github.com>
… tunnels

Qualify t6022 for the T602x tunnel clock sequence, as for the
Thunderbolt side, and accept the ATC3 core at 0x1303000000. The 14/16-inch
boards only have ATC0-2, so ATC3 was never listed, but the Mac mini and
Mac Studio use it for their fourth rear port. The wiring gate still
applies.

Tested on a Mac Studio (M2 Ultra, J475d): a DP tunnel on rear port 1
(phy@1303000000) runs 5120x2160@72.

Signed-off-by: Jacob Crowther <3944151+jcrowthe@users.noreply.github.com>
…ar ports

On M2, Thunderbolt DP tunnels need dual-stream connector wiring: two
DCPs per Type-C connector, each with typecN-dpin0/1 controls on cells 1
and 2 of the port's crossbar, as on the 14/16-inch boards. The J475d's
HDMI runs from die 1, so die-0 dcpext0 is free. Enable it as a USB-C-only
pipeline for the rear ports (crossbar state 0, dcpext1 state 2), give
both die-0 DCPs the DPIN controls, add the second endpoint to each rear
connector, and add dispext0_dart to the display iommus.

m1n1 fills apple,firmware-compat only through the ADT-indexed dcpextN
aliases. Without "dcpext0" here, probe fails with
"Could not read 'apple,firmware-compat': -22" and the whole apple-drm
aggregate stays down, HDMI included.

Tested on a Mac Studio (M2 Ultra, J475d), together with the two previous
patches: HDMI (dcpext4), a DP alt mode display on rear port 4 (dcpext0)
and a Thunderbolt display on rear port 2 (dcpext1, dpin0) all run at once.

Signed-off-by: Jacob Crowther <3944151+jcrowthe@users.noreply.github.com>
… pipeline

On an ordered dual-stream machine each Type-C port gets a second
connector for a dock's DPIN1 stream, fixed to the lowest-indexed
Type-C-only pipeline. On the M2 Pro/Max laptops that is dcpext1, since
dcpext0 also drives HDMI, and the pairing pass gives the first stream
the lowest-indexed pipeline, dcpext0.

On the M2 Ultra Mac Studio (J475d) HDMI runs from die 1, so every
rear-port pipeline is Type-C-only. Both streams then want dcpext0, and
a display daisy-chained behind a Thunderbolt monitor is refused while
dcpext1 sits idle:

  thunderbolt-apple-acio 701ac0000.cio: dpin1: DP tunnel setup failed: -16

Fix the second stream to the lowest-indexed Type-C-only pipeline other
than the port's lowest-indexed pipeline, which the first stream takes.
A port with a single Type-C-only pipeline keeps it. The laptops still
get dcpext1.

Tested on a J475d with an LG 40WP95C and a monitor daisy-chained behind
it: dpin0 on dcpext0, dpin1 on dcpext1, both displays up.

Signed-off-by: Jacob Crowther <3944151+jcrowthe@users.noreply.github.com>
@jcrowthe

jcrowthe commented Dec 4, 2026

Copy link
Copy Markdown
Author

Superseded for 7.3+ by aurora-silicon/linux#3273 (which updates dcp_fabric_port_crtc_mask() and dcp_fabric_second_yields() to handle all reachable Type-C-only pipelines cleanly).

@jcrowthe jcrowthe closed this Dec 4, 2026
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.

1 participant