Skip to content

thunderbolt: give USB4 docks a picture again on T6050 by keeping them out of the HiFi-bi quirk - #3005

Open
Isaac-Duarte wants to merge 2 commits into
aurora-silicon:integration/aurorafrom
Isaac-Duarte:j714s/tmu-usb4-hifi-bi
Open

Isaac-Duarte wants to merge 2 commits into
aurora-silicon:integration/aurorafrom
Isaac-Duarte:j714s/tmu-usb4-hifi-bi

Conversation

@Isaac-Duarte

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

Copy link
Copy Markdown
Contributor

Since #2088, a USB4 dock on a 14-inch M5 Pro (J714s) gives its monitors no picture. The test setup is a Ugreen TBT5 dock (USB4 v2, 80 Gb/s) with three 1080p165 monitors. The DP tunnels come up: the links train at HBR2 x4, the modesets finish and the connectors read as connected. But the monitors stay in standby, and a later modeset times out.

On T6050 the host router's TMU belongs to its firmware (QUIRK_HOST_TMU). The firmware applies a mode only when its lane adapter's time sync goes off and then on again. The enhanced uni-directional path does this. The bi-directional HiFi path only turns time sync on, and on a freshly attached router it is already on. #2088 sends every device router down the bi-directional path, so the firmware never configures its TMU and the dock's DP OUT adapters have no time base. The ACIO firmware's TMU CONFIGURED: is_master=1, mode=2 line shows this: it appears on 7 of 7 dock attaches before #2088 and on 0 of 5 after.

  • Keep USB4 device routers out of the HiFi-bi quirk. USB4 v2 routers go back to enhanced uni-directional mode, and hosts that allow CL states get them again. The CLx guard now checks the depth-1 router, whose link it acts on. The Studio Display's router, which thunderbolt: apple: default device routers to bidirectional HiFi #2088 was written for, is generation 3, not USB4, so it still runs bi-directional HiFi.
  • Turn time sync off first in tb_switch_tmu_enable_bidirectional() on a host-managed TMU, as the enhanced path does. On T6050 this is the path a USB4 v1 router takes, before and after thunderbolt: apple: default device routers to bidirectional HiFi #2088: it has no enhanced mode and CL1 is off. Only T6050 sets host_tmu.

Tested on the J714s with the Ugreen dock on the right port:

Kernel TMU CONFIGURED from the ACIO firmware Monitors
f9d2146, stock never (0 of 5 attaches) no picture
f9d2146 + the first commit (thunderbolt.ko swapped) mode=2, on each of 4 attaches (one of them after a deep sleep) picture, also after a replug
full boot of this PR's head (d88f46b on 3989d21), aura 1.0.0b14 mode=2, time_sync_interval=16 picture; 0 SELinux denials, 0 failed units, kernel errors in the first 34 s identical to the f9d2146 boot
f9d2146 + the second commit only (#2088's bi-directional HiFi forced on this dock, the path a USB4 v1 router takes) mode=1, time_sync_interval=0, at attach and after the router's sleep wake; stock f9d2146 logs none picture

Not tested: a USB4 v1 dock (I have none), a Studio Display, and resume on the full PR-head boot: this machine sometimes freezes when it boots with the lid shut and the dock attached. I am chasing that freeze separately.

Regression from #2088 (253232b).

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal Pre-PR Checklist Review (§1–§6) — REQUEST_CHANGES

Reviewed commit 0475cd198992cfae88d45cd717ae8bd4277f41b8 (Isaac-Duarte:j714s/tmu-usb4-hifi-bi → aurora-silicon/linux:integration/aurora). Live CI: Host tests (45241715252) passed.


Blockers

  1. tb_enable_clx() checks !tb_switch_is_usb4(sw) before walking to depth 1 (drivers/thunderbolt/tb.c:235-246):

    • tb_enable_clx() only ever enables CL states on the depth-1 link (while (sw && tb_switch_depth(sw) > 1) sw = tb_switch_parent(sw);).
    • Because the new guard if ((sw->tb->nhi->quirks & QUIRK_TMU_HIFI_BI) && !tb_switch_is_usb4(sw)) runs before walking up to depth 1:
      • Daisy-chaining a USB4 router (depth 2) behind a non-USB4 / Titan Ridge router (depth 1) on Apple CIO hosts without QUIRK_NO_HOST_CLX (t8103, t6020, t6030) bypasses the guard and enables CL0s/CL1 on the depth-1 non-USB4 router that is running TB_SWITCH_TMU_MODE_HIFI_BI (which does not support CL states).
      • Conversely, a non-USB4 (TB3) router at depth 2 behind a USB4 dock at depth 1 returns early before walking up, skipping CLx re-enable on the depth-1 USB4 link.
    • Fix: Move the (sw->tb->nhi->quirks & QUIRK_TMU_HIFI_BI) && !tb_switch_is_usb4(sw) check after walking sw to depth 1 (after if (!sw || tb_switch_depth(sw) != 1) return 0;).
  2. USB4 v1 routers and the QUIRK_HOST_TMU bidirectional path are not actually fixed (drivers/thunderbolt/tb.c:374-435, drivers/thunderbolt/tmu.c:615, 715-748):

    • The commit message and PR body explain that keeping USB4 routers out of QUIRK_TMU_HIFI_BI sends them down the enhanced uni-directional path (TB_SWITCH_TMU_MODE_MEDRES_ENHANCED_UNI), and cite the J714c + Dell TB4 monitor report from #2088.
    • However, tb_switch_tmu_enhanced_is_supported(sw) (tmu.c:88-91) requires usb4_switch_version(sw) > 1 (USB4 v2 only, like the tested Ugreen TBT5 dock). For a USB4 v1 router (such as TB4 docks/monitors like the Dell U4025QW), tb_switch_is_usb4(sw) is true, so this patch skips the QUIRK_TMU_HIFI_BI branch; MEDRES_ENHANCED_UNI then returns -EOPNOTSUPP; on T6050 (QUIRK_NO_HOST_CLX), CL1 is off, so tb_enable_tmu() falls back to TB_SWITCH_TMU_MODE_HIFI_BI.
    • On that path:
      • if tmu_mode_init() read HIFI_BI, line 423 (if (tb_switch_tmu_is_enabled(sw)) return 0;) returns without touching the link at all;
      • if tmu_mode_init() read OFF, tb_switch_tmu_disable() returns 0 early (tmu.c:615) and tb_switch_tmu_enable_bidirectional() (tmu.c:715-748) never performs the tb_switch_tmu_host_managed(sw) time-sync disable→enable transition on down (unlike tb_switch_tmu_enable_enhanced() at tmu.c:842-848, 883-890). So the T6050 ACIO firmware still never gets the off→on transition on its lane adapter.
    • Fix: Also pulse lane-adapter time sync off→on under tb_switch_tmu_host_managed(sw) in tb_switch_tmu_enable_bidirectional() (and tb_switch_tmu_enable_unidirectional() if reachable), while keeping USB4 routers out of forced QUIRK_TMU_HIFI_BI so USB4 v2 routers continue to use MEDRES_ENHANCED_UNI and CLx; and update the commit message / PR body to accurately distinguish USB4 v2 vs. USB4 v1 (avoid claiming the Dell TB4 / USB4 v1 case is resolved unless handled and verified).
  3. §5 Evidence and §1 cross-hardware / regression coverage incomplete:

    • The run reported in the PR body booted an older base (f9d214639619, aura 1.0.0b14) with only thunderbolt.ko swapped, rather than a full boot of the PR head (0475cd198992), and omits the §5 regression tuple (0 SELinux denials, 0 failed units, 0 new kernel errors against a baseline).
    • Suspend/resume (tb_restore_children()), a non-USB4 / Studio Display (to confirm #2088 is not regressed), and a second Mac / USB4 v1 dock are untested. Please post a full-boot row on the updated PR head with the §5 regression tuple and request/collect a Studio Display and resume check.

Pre-PR Checklist Summary (§1–§6)

  • §1 No model gating: PASS in code (keys off tb_switch_is_usb4(sw) rather than SoC/board/firmware version); cross-Mac verification still owed.
  • §2 Production-ready, no hacks: FAIL — depth > 1 bug in tb_enable_clx() and incomplete USB4 v1 / QUIRK_HOST_TMU handling.
  • §3 Safety: PASS — no hardcoded safety limits or bypasses.
  • §4 Clean-room & attribution: PASS — commit 0475cd198992cfae88d45cd717ae8bd4277f41b8 has human author/committer (Isaac Duarte) and human Signed-off-by: only, zero AI trailers in commit.
  • §5 Evidence: FAIL — swapped .ko on older base, missing §5 regression tuple, untested resume / Studio Display.
  • §6 Naming: PASS.

Assisted-by: LLM (Gemini 4 Neon)

@joshuaswarren

joshuaswarren commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Our #2088 caused this - said plainly. Correcting our first comment: we said we were reproducing on our T6050 machine, but our M5 (T6050, K114c) has no dock or Thunderbolt monitor attached, so we cannot test DP on a dock at all. Code review only; here is what we checked.

The core reasoning holds. #2088 keyed the bi-directional HiFi default on the host's QUIRK_TMU_HIFI_BI plus tb_route(sw) (device routers) without separating USB4 routers from generation-3 routers. On T6050 the host router's TMU belongs to firmware (QUIRK_HOST_TMU), and firmware applies its mode only when the lane adapter's time sync drops and re-arms - which the enhanced uni-directional path does and bi-directional HiFi does not. So a USB4 dock's DP OUT adapters were left without a time base. Your ACIO evidence (TMU CONFIGURED: is_master=1, mode=2, 7/7 dock attaches before vs 0/5 after) plus the A/B (thunderbolt.ko swap alone restoring TMU CONFIGURED and all three monitors) is decisive for the USB4 v2 case, and the J714c/Dell-TB4 report independently matches.

On djdevsbot's blockers - we agree with both, and they matter:

  1. The tb_enable_clx() guard placement is a real bug. The new !tb_switch_is_usb4(sw) check runs before the walk to depth 1, so it tests the wrong router: a USB4 router at depth 2 behind a non-USB4 depth-1 router bypasses the guard and re-enables CL0s/CL1 on a router running HIFI_BI (which does not support CL); a non-USB4 router at depth 2 behind a USB4 depth-1 dock returns early and skips the CLx re-enable the depth-1 link needs. Moving the guard after the depth-1 walk is the right fix - the question is what the depth-1 router is, not what the queued router is.

  2. USB4 v1 docks are not actually fixed by this PR, and the commit message overclaims on the Dell TB4 case. tb_switch_tmu_enhanced_is_supported() requires USB4 v2; a v1 router is USB4, so the patch skips the HIFI_BI branch, MEDRES_ENHANCED_UNI returns -EOPNOTSUPP, and the path falls back to HIFI_BI - where the bidirectional enable never performs the time-sync off-to-on cycle the T6050 firmware needs. Pulsing lane-adapter time sync off then on under the host-managed bidirectional path is the missing piece, and the commit message should not claim the Dell TB4 case is resolved until it is handled and verified.

On evidence standards we agree too: a full boot of the PR head with the regression tuple is the bar we hold our own work to (and the thunderbolt.ko-swap-only A/B, while decisive for the mechanism, does not test the PR head); the Studio Display, resume, and a USB4 v1 dock remain the untested corners, and we cannot help with the dock side from our machines.

What we checked on our side: the diff against #2088 (both gates, the tb_switch_is_usb4 exclusions and their placement), tb_enable_clx()'s depth walk, tb_switch_tmu_enhanced_is_supported()'s USB4 v2 requirement, and the bidirectional enable's missing host-managed sync cycle under QUIRK_HOST_TMU. We have no dock or TB monitor, so everything DP-on-dock stays untested by us - the report and reasoning above is code and log evidence only.

…quirk

QUIRK_TMU_HIFI_BI puts every device router in bi-directional HiFi. On
T6050 the host router's TMU is run by its firmware (QUIRK_HOST_TMU),
and that firmware applies a mode only when the time sync of its lane
adapter goes off and on again, which only the enhanced uni-directional
path does. In bi-directional HiFi it never configures its TMU (no "TMU
CONFIGURED" from the ACIO firmware), and a USB4 dock's DP OUT adapters
have no time base: the DP links train and the displays read as
connected, but the monitors get no picture and the next modeset times
out.

The quirk was made for a Studio Display, whose router is not USB4.
Leave USB4 routers on the previous path, CL states included.

Fixes: 253232b ("thunderbolt: apple: default device routers to bidirectional HiFi")
Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com>
…ost-managed TMU

Where the host router's TMU is run by its firmware (QUIRK_HOST_TMU), the
firmware applies a mode only when the time sync of its lane adapter goes
off and on again. tb_switch_tmu_enable_enhanced() turns time sync off
first for that reason. tb_switch_tmu_enable_bidirectional() only turns
it on, and a router whose TMU reads as off has time sync on already, so
the host router never sees the edge and never configures its TMU.

That is the path a USB4 v1 router takes on T6050: it has no enhanced
mode, CL1 is off (QUIRK_NO_HOST_CLX), so tb_enable_tmu() falls back to
bi-directional HiFi. Turn time sync off first there too, as the enhanced
path does.

Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com>
@Isaac-Duarte
Isaac-Duarte force-pushed the j714s/tmu-usb4-hifi-bi branch from 0475cd1 to d88f46b Compare November 23, 2026 20:41
@Isaac-Duarte

Copy link
Copy Markdown
Contributor Author

Checked all three against the code; all three hold.

  1. CLx guard. Right: the guard has to look at the depth-1 router, whose link tb_enable_clx() acts on. Moved it after the walk (c984f50).

  2. USB4 v1. Right: the first commit sends a USB4 v1 router back to the old fallback, which on T6050 is bi-directional HiFi. That path never turned time sync off, so the host firmware never saw the off-to-on edge, before thunderbolt: apple: default device routers to bidirectional HiFi #2088 or after it. The new commit d88f46b turns time sync off first in tb_switch_tmu_enable_bidirectional() under tb_switch_tmu_host_managed(), the same way tb_switch_tmu_enable_enhanced() does. It only affects T6050, the one host with host_tmu. I left tb_switch_tmu_enable_unidirectional() alone because T6050 never reaches it: CL1 never turns on there (QUIRK_NO_HOST_CLX), so LowRes and HiFi uni are never picked. Case (a) is upstream behaviour I didn't change: a router that reads as bi-directional HiFi at init is left alone, and a freshly attached router reads as off. I've dropped the claim about the Dell TB4 report from the PR body: I have no USB4 v1 device to test it.

    On hardware, the dock forced through bi-directional HiFi with only this commit now gets TMU CONFIGURED: is_master=1, mode=1, time_sync_interval=0 from the ACIO firmware, at attach and after the router wakes from sleep. Stock f9d2146 logs none. All three monitors had a picture.

  3. Evidence. I added a full boot of the PR head (d88f46b on 3989d21, aura 1.0.0b14): TMU CONFIGURED mode=2, all three monitors have a picture, 0 SELinux denials, 0 failed units, and the kernel errors in the first 34 s are identical to the f9d2146 boot. The table is in the PR body. Resume is not covered on that boot: this machine sometimes freezes when it boots with the lid shut and the dock attached. I'm chasing that separately. The module-swap boot did resume from deep sleep, and the dock came back with TMU CONFIGURED. I have no Studio Display, so a check on T6050 from someone who has one would close that gap.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal Pre-PR Checklist Re-Review (§1–§6) — APPROVE

Re-reviewed at verified live head d88f46ba178cbf9e21610e64e4151cfd1498dc13 (Isaac-Duarte:j714s/tmu-usb4-hifi-bi → aurora-silicon/linux:integration/aurora). Live CI: Host tests (45261911752) = success; merge state CLEAN.

Verification of Prior Blockers

  1. tb_enable_clx() depth > 1 bug (drivers/thunderbolt/tb.c:241-252): Resolved. Commit c984f50240cc moves the (sw->tb->nhi->quirks & QUIRK_TMU_HIFI_BI) && !tb_switch_is_usb4(sw) guard after walking sw to depth 1 (if (tb_switch_depth(sw) != 1) return 0;), so CLx gating evaluates the depth-1 router whose link is being configured.
  2. USB4 v1 / QUIRK_HOST_TMU bidirectional fallback gap (drivers/thunderbolt/tmu.c:724-730): Resolved. Commit d88f46ba178c pulses tb_port_tmu_time_sync_disable(up) and tb_port_tmu_time_sync_disable(down) under tb_switch_tmu_host_managed(sw) in tb_switch_tmu_enable_bidirectional() (matching tb_switch_tmu_enable_enhanced()), fixing the host-managed bidirectional HiFi path taken by USB4 v1 routers and gen-3/Studio Display routers on T6050. The untested Dell TB4 claim was removed from the PR body, and forcing the Ugreen dock down commit 2's bidirectional HiFi path confirmed TMU CONFIGURED: is_master=1, mode=1, time_sync_interval=0 with picture on all three monitors (both at attach and after router sleep wake).
  3. §5 Evidence & regression coverage: Resolved. Full boot of exact PR head d88f46ba178c (on 3989d21784d1, aura 1.0.0b14) on J714s (M5 Pro, T6050) with the Ugreen TBT5 dock and three 1080p165 monitors confirms TMU CONFIGURED: mode=2, time_sync_interval=16, picture on all three monitors, 0 SELinux denials, 0 failed units, and kernel errors in the first 34 s identical to the baseline f9d2146 boot. Untested hardware (USB4 v1 dock, Studio Display on T6050) is transparently disclosed.

Pre-PR Checklist Summary (§1–§6)

  • §1 No model gating: PASS — keys on tb_switch_is_usb4(sw) and existing host capability/quirk predicates (QUIRK_TMU_HIFI_BI, tb_switch_tmu_host_managed(sw)).
  • §2 Production-ready, no hacks: PASS — default command line, no delays/retries/hacks, cleanly fixes the #2088 regression across both USB4 v2 and host-managed bidirectional HiFi paths.
  • §3 Safety: PASS — no hardcoded safety limits or bypasses.
  • §4 Clean-room & attribution: PASS — both commits (c984f50240cc, d88f46ba178c) carry human author/committer (Isaac Duarte) and human Signed-off-by: only, zero AI trailers in commits.
  • §5 Evidence: PASS — exact-head full boot with §5 regression tuple plus targeted A/B on both mode=2 and mode=1 paths; Host tests green.
  • §6 Naming: PASS.

Non-blocking Nits

  • drivers/thunderbolt/tmu.c:732-734: if tb_port_tmu_unidirectional_disable(up) fails right after the tb_switch_tmu_host_managed(sw) block disabled time sync on up/down, return ret; bypasses goto out; (tb_switch_tmu_off(sw)). Using goto out; would keep error cleanup consistent.
  • drivers/thunderbolt/tb.c:371-373: the comment above tb_enable_tmu() predates d88f46ba178c and still implies only the enhanced uni-directional path configures a host-managed TMU.

Assisted-by: LLM (Gemini 4 Neon)

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.

3 participants