Skip to content

thunderbolt: run a T6050 host DP IN's bandwidth allocation as macOS does - #2038

Merged
DjDeveloperr merged 1 commit into
integration/aurorafrom
djdev/t6050-dpin-bw-held-ack
Nov 16, 2026
Merged

DjDeveloperr merged 1 commit into
integration/aurorafrom
djdev/t6050-dpin-bw-held-ack

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Part of a set of seven J714s external-display PRs, measured together (table below): #2032 EDID defaults, #2033 atc tunnel open, #2034 tunnel-only first (stacks on #1921), #2035 merged-mode limit, #2036 tunnel clock, #2037 DPTX connection DP IN and #2038 DP IN bandwidth allocation (merge those two together). Suggested order: #1921, #2006, then the set in any order.

What

One commit, thunderbolt: run a T6050 host DP IN's bandwidth allocation as macOS does.

On the T6050 host's DP IN adapters, the USB4 bandwidth allocation mode now runs:

  • at 1 Gb/s granularity. The generic code picks the finest granularity that still covers UHBR20 x4, which on this dock is 0.5 Gb/s;
  • with CM Ack held. A DPTX bandwidth request is acknowledged by setting CM Ack after writing the allocated bandwidth, waiting for the adapter to clear the request with CM Ack still set, and only then clearing CM Ack. The generic code set CM Ack and cleared it again at once, before the adapter had taken the request.

This is gated by a new host policy, TB_HOST_DP_BW_HELD_ACK, set only in the T6050 (M5) policy (apple_dpin_m5), and it applies only to host DP IN adapters (tb_port_is_apple_host_dpin()). Other hosts, Intel and other USB4 hosts included, and device routers' adapters keep the generic behaviour.

Change from what ran in the kits: if the request doesn't clear in time, or the wait's read fails, a held CM Ack is now cleared before returning. Before, it stayed set on that error path. The path was not reached in any kit (no timeout waiting for DPTX request to clear).

Why

On the J714s dock, a display on the dock's second DP OUT, tunnelled from the host's DP IN 1 beside a display on DP IN 0, never held its link. The sink raised IRQ_HPD in the window where the DCP firmware had finished link training and asked the DP IN adapter for the tunnel's bandwidth, and the firmware then dropped the display.

Stacking

None in code: this applies to integration/aurora alone. It goes with #2037: the G81SF on DP IN 1 held its link only in k6, which added this and #2037 together. Neither was tested alone, so I can't say whether one of them would be enough. Please merge them together.

In the kits both ran with #1921, #2006 and the rest of this set.

Tested

  • k5 (without this and drm/apple: dptxep: name a T6050 tunnel's DP IN in the DPTX connection #2037): the G81SF on dock DP IN 1 is dark: 7 sink IRQ_HPD, 3 relinks, then the driver gives up.
  • k6 (with both): no IRQ_HPD, no relink, no timeout waiting for DPTX request to clear. The G81SF runs at 3840x2160@120 beside the Dell (3840x2160@120), the JTG (1920x1280@60) and the panel. Same at both read-outs. The Thunderbolt dock and the devices behind it (USB hubs, 2.5G Ethernet) stayed up.

Compile: fedora-kcheck (cross build, M5 intg6 config): OK (vmlinux, Image and modules linked), 0 new warnings. checkpatch --strict: 0 errors; its one warning is the From/Signed-off-by name mismatch these commits always have.

Rig and kits

J714s (MacBook Pro 14", M5 Pro):

  • internal panel;
  • Dell S2725QC (3840x2160@120) on the left-front port, DP alt mode;
  • Thunderbolt 5 dock on the right port: JTG S123 (1920x1280@60) on DP IN 0, Samsung Odyssey G81SF (3840x2160, up to 240 Hz) on DP IN 1.

Each kit was integration/aurora 514ae1f + #2006 (which carries #1921) + #2018 as it was at 0521255 (its earlier PHY-side version) + the changes up to that row. Built natively on the M5, one-shot test boot, read-outs only (sysfs, debugfs, kernel log, hyprctl monitors), then the default kernel restored and verified byte-identical. Since 514ae1f, integration/aurora has gained only #2022, which touches none of these files. The k6 tree is the tree of all seven PRs of this set merged on #2006, apart from a diagnostic log commit used only in the kits and the serial keyword added to one log line in the EDID PR.

kit adds Dell (left-front) JTG (dock DP IN 0) G81SF (dock DP IN 1) DP IN 1 in the kernel log
stock (default kernel) 3840x2160@120 1920x1080@60, no EDID, no name dark
k2b EDID defaults, and an earlier tunnel clock restart not up in that boot ¹ 1920x1080@60 ², "JTG S123" dark 11 IRQ_HPD, 3 relinks, 5 failed paired mode sets
k3 + atc tunnel open, + tunnel-only first 3840x2160@120 1920x1280@60 dark 10 IRQ_HPD, 3 relinks, 4 failed paired mode sets
k4 + merged-mode limit 3840x2160@120 1920x1280@60 dark 8 IRQ_HPD, 3 relinks, 1 failed paired mode set
k5 + no paired call under the limit, + tunnel clock only for its link 3840x2160@120 1920x1280@60 dark 7 IRQ_HPD, 3 relinks, no failed paired mode set, no clock rate change
k6 + DPTX connection DP IN, + held CM Ack bandwidth allocation 3840x2160@120 1920x1280@60 3840x2160@120 no IRQ_HPD, no relink

The internal panel ran at 3024x1964@120 in every row. k6 was read at about 60 s and 150 s after boot, with the same result both times, and with no oops, WARN, DART fault or GPU fault.

¹ The left-front port's PD controller came up late in that boot and the Dell never entered DP alt mode. None of these changes touch that path.
² In k2b the JTG was on DP-1 and the compositor ran it at 1920x1080; from k3 on it is DP-5 at its native 1920x1280.

Neo rows needed

Yes, before merge. This touches shared Thunderbolt/USB4 code (tunnel.c, usb4.c, tb.h, nhi.h). The new behaviour is gated to the T6050 policy, and T8140 has no USB4 router. So the Neo rows are a no-regression check of the shared code: boot, USB-C and the external display on the Neo's port.

🤖 Generated with Claude Code

On the J714s dock, a display on the dock's second DP OUT, tunnelled from
the host's DP IN 1 beside a display on DP IN 0, never holds its link:
the sink raises IRQ_HPD in the window where the DCP firmware has finished
link training and asks the DP IN adapter for the tunnel's bandwidth, and
the firmware then drops the display. macOS, in the same setup, sees no
IRQ_HPD there and grants the request at once.

Both run the adapters' USB4 bandwidth allocation mode, but not the same
way:
- macOS programs both host DP IN adapters with 1 Gb/s granularity. The
  driver picks the finest granularity that still covers UHBR20 x4, which
  on this dock is 0.5 Gb/s, so the estimated, requested and allocated
  bandwidths the firmware reads and writes are in other units than the
  ones it gets from macOS;
- macOS acknowledges a DPTX request by setting CM Ack after writing the
  allocated bandwidth, waits for the adapter to clear the request with CM
  Ack still set, and clears CM Ack after that. The driver set CM Ack and
  cleared it again at once, before the adapter had taken the request.

Do as macOS on the T6050 host's DP IN adapters (new host policy
TB_HOST_DP_BW_HELD_ACK, in the M5 policy only). A held CM Ack is cleared
again if the request does not clear in time or cannot be read. Other
hosts and the device routers' adapters are unchanged.

Tested only together with the DPTX connection DP IN change; with both,
the DP IN 1 display holds its link.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Neo (J700, T8140) no-regression row on hardware, 2026-11-15:

  • Kernel: a one-shot test kit, 7.3.0-neo-m5prs1 = integration/aurora 07ade53 + drm/apple: give an external sink a firmware-derived EDID with what it reports #2032 (e60adae) + thunderbolt: run a T6050 host DP IN's bandwidth allocation as macOS does #2038 (40acc31), with the same config and toolchain as the Neo's current default kernel. It booted once; then the Neo went back to its default kernel, with a byte-identical undo verified.
  • Boot: desktop up, no failed units; the running kernel and its module build IDs match the kit.
  • Internal panel (eDP and its DCP): connected and enabled, with the same mode list, EDID and native mode as on the default kernel. No display/DCP warnings beyond those the default kernel logs.
  • USB, the r8152 Ethernet adapter and both Type-C ports came up. One sleep and wake: the panel came back in the same state, USB stayed in place (no re-enumeration), and the Ethernet carrier was back at the resume. No new USB, Type-C or Thunderbolt warnings.
  • Seen, but not from this change: two TLB-invalidation timeouts on the internal display's DART at desktop start. The same lines appear on Neo boots without this change, the shipped 7.3.0-40 kernel included.
  • Not exercised: the new behaviour is T6050-only; T8140 has no USB4 router and the thunderbolt module did not load, so this shows only that the shared code doesn't regress T8140's boot, display, USB, Type-C or sleep.

Result: PASS, no T8140 regression found.

@RyanTheTide
RyanTheTide deleted the djdev/t6050-dpin-bw-held-ack branch November 16, 2026 05:04
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