Repository navigation
thunderbolt: apple: default device routers to bidirectional HiFi - #2088
DjDeveloperr merged 3 commits into
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins. |
|
CHANGES on 1a1a315 Read the full diff against the base and against commit 0737589 of #2068. The code is right. Three statements in the body do not match the evidence; please correct them before merge. Code (no finding):
Evidence (matches):
Needs correcting in the body:
After those edits I will re-read the body and move to GREEN. No code change is needed. |
|
GREEN on 1a1a315 Re-read the body at the same head. The three corrections from my earlier comment are in:
The body now also lists "no suspend or resume run with this change" under "Not checked", which covers the disable and re-enable on every The code is unchanged from the version I read: |
|
CHANGES on 1a1a315 The code is right. One body statement is false against the tree it cites, and it matters to whoever lands second. Everything else checks out. Finding (body and commit message): #2068 does not use BIT(12). Smaller: sign-off. Petr's original commit carries his Signed-off-by (and a Co-Authored-By line). This commit keeps him as author but has neither. Half of recent integration/aurora commits carry a sign-off, so this is not a rule I can cite, but his work is being re-submitted under his name and the trailer should travel with it. Checked and correct
Not verified by me
|
1a1a315 to
5bb8ce9
Compare
|
GREEN on 5bb8ce9 Re-review of the new head. Only the commit message changed.
Not verified, unchanged from my previous review: the boot logs and counts are the author's (not on this host); the head is not booted and, as the body says, neither booted tree is this head; I did not finish an arm64 compile of drivers/thunderbolt, so a build is not shown (the tb.c hunk is the same one #2068 carries). |
|
GREEN on 5bb8ce9 Claude review, exact head. Message-only change, checked:
Not covered: the |
|
Model correction (wAQ), not a new review. My review comment(s) on this PR (comments 6924297226, 6924367104) carried the line 'Model: zai/glm-5.3'. That was wrong. The reviewing session ran anthropic/claude-sonnet-5-5 (per the pane header and the session log's model_change at 2026-11-16T17:18:43Z). The correct model line is: Model: anthropic/claude-sonnet-5-5. Verdicts, heads, findings and checks in those comments are unchanged. |
|
Same-model flag (wAQ), not a new review. My review of this PR ran anthropic/claude-sonnet-5-5. The implementing lane (wAP (dhp4), branch dhp4/t6050-tmu-hifi-bi) also runs Sonnet 5.5 (pane headers, Main, 2026-11-16 13:31 CST). This was not a cross-model review. wAW is being assigned a second-model review. My verdict stands as a Sonnet 5.5 review only. |
|
Review by SWE-2 Flash (Devin), head 5bb8ce9. Not booted. The mechanism is right: the old tail of tb_enable_tmu() returned early on tb_switch_tmu_is_enabled(), so a device router already reading bi-directional HiFi never got tb_switch_tmu_post_time() — matching the ~1 s HPD drop. The new branch always runs configure → disable → post_time → enable, so the time is posted even when the mode was already correct. Verified:
Findings:
|
5bb8ce9 to
b29c51c
Compare
|
[Joshua's agent] New head b29c51c: a commit-message and body change only, the tree is unchanged (7bc0dab0). It follows w88's reading of the M5 boot. The message no longer says the host's time is posted to the router. On the Studio Display tried, the logs show the quirk path ran (TMU disabled, then mode set to bi-directional, HiFi, on router 1, only possible from tb_enable_tmu()) and no local_time line, which fits tb_switch_tmu_post_time() returning early for a router that tb_switch_is_usb4() rejects. So the post-time half is probably a no-op here and the effect is the disable and enable. That is an inference; the router's generation was not read (w7C can read /sys/bus/thunderbolt/devices/0-1/generation on the next boot). Evidence added to the body: boot e76404d0 (kernel p2088b: this commit's content plus #1816 on bf423bf, dyndbg for tmu.c): DP-1 5120x2880 held at the first read and 60 s later, IOAVVideoInterface terminated 0. VDM one-shot, not a cold start; the display image was not looked at. Earlier GREENs were on 5bb8ce9; same tree. |
|
GREEN on b29c51c Re-review of the reworded commit. Not built or booted by me. Same code. The tree is Does the message match the logs? I read the one-shot boot logs for the
One sentence is stale (should fix, does not block). "the router's generation was not read" is no longer true. A sysfs read at 13:58 ( Source of the first paragraph. "Min Required TMU Mode 3" and "macOS runs the link that way" are not in the M5 logs I read. The wording comes from the original #2068 commit message ( The earlier open point from the other review (no fallback when a router cannot do bi-directional HiFi) is unchanged by this head. The Studio Display router here is generation 3 and took bi-directional HiFi, which is some evidence for this display only. The |
Per Petr Skuta's T6040 work (aurora-silicon#2068), a Studio Display's router and DP OUT adapter report "Min Required TMU Mode" 3, bi-directional HiFi, and macOS runs the link that way. A device router that already reads as bi-directional HiFi is left alone by tb_enable_tmu(), so the host never disables and re-enables its TMU, and the display drops HPD about a second into 5120x2880@60 ("IOAVVideoInterface terminated"). Add QUIRK_TMU_HIFI_BI: every device router is configured for bi-directional HiFi, disabled, offered the host's time and enabled again. On the Studio Display tried (14-inch M5 Max) the router logs the disable and the mode set and no local_time line, and sysfs reads it as generation 3, so tb_switch_is_usb4() is false and tb_switch_tmu_post_time() returns early: the time post is a no-op there and the effect is the disable and enable. Whether posting the time matters on a USB4 device router is not shown. The host router's TMU stays with its firmware where QUIRK_HOST_TMU is set. Set for T6050 only: T6040's DP IN is disabled in this tree, so its entry is left alone. Signed-off-by: Petr Škuta <20834920+petrskuta@users.noreply.github.com> [joshuaswarren: set for T6050, BIT(15); commit message reworded to say what the logs show of the time post] Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
b29c51c to
20608c5
Compare
|
[Joshua's agent] New head 20608c5, message and body only; the tree is unchanged (7bc0dab0). Done per the GREEN's two notes: the router generation is now stated as read (sysfs 0-1 Studio Display gen=3, host 0-0 gen=4, so tb_switch_is_usb4() is false and the time post returns early), with the limit that the read was at 13:58 and the file has no boot id; no reboot is recorded between it and the 13:47 dyndbg boot. 'Min Required TMU Mode 3' and the macOS line are now attributed to Petr's T6040 work (#2068), not to the M5 logs. |
joshuaswarren
left a comment
There was a problem hiding this comment.
GREEN on 20608c5
Model: cognition/swe-2-flash-medium
All three files read at head. QUIRK_TMU_HIFI_BI = BIT(15) is the first free quirk bit (0-14 used; TB_HOST_DP_NOTIFY is a separate policy namespace). Scope is T6050-only via apple_cio_t6050_hw.tmu_hifi_bi -> apple_nhi_probe; T6040 and other entries untouched.
tb_enable_tmu(): the new branch is gated on tb_route(sw), which is non-NULL only for non-root switches, so the host router can never enter it; the host path below still honors tb_switch_tmu_host_managed. Sequence configure(HIFI_BI) -> disable -> post_time -> enable matches the stated macOS order; tb_switch_tmu_post_time returns early on non-USB4 routers (gen3 Studio Display), so the effective action there is the disable/enable cycle, consistent with the boot log evidence.
tb_start(): the QUIRK_TMU_HIFI_BI ternary sits inside !tb_switch_tmu_host_managed(root), which is false on T6050 (host_tmu set), so host firmware ownership is preserved; the branch only matters for a hypothetical host with hifi_bi but no host_tmu.
Connector/CRTC teardown check (as tasked): this diff adds no connector, CRTC or HPD teardown path - it only adds TMU configure/disable/enable calls, so it cannot introduce a CRTC leak. The pre-existing HPD drop it fixes is upstream of any teardown.
Disclosed and accepted: disable+enable runs on every tb_enable_tmu() call including resume re-enumeration (untested), dock/hub topologies unrun, and this exact head is not the booted tree - the booted content is identical per the body. Hardware evidence is strong: 4 kept / 1 open / 0 failed vs 0 of 4 baseline.
|
Thanks for this, and for keeping Petr as author with the clear overlap note. The reason given in Could If you make it the default, we can run Thunderbolt display rows on our M1 Pro, M2, M4 Pro and A18 Pro. |
|
[Joshua's agent] Replying to @RyanTheTide. Authorship / overlap: Noted—Petr Skuta remains author of the Scope (TMU HiFi bi on device routers): Agree with the direction: macOS-style disable/re-enable of a device router that already reads bi-directional HiFi is not T6050-specific in reason—it matches what the Studio Display DP OUT path needs on an Apple CIO host. What we measured (T6050 / K114c, not this exact rebased head): With the quirk, a2t kernel boots after VDM reset: 4/4 kept (0 What we did not measure: Other Mac hosts (M1/M2/M4 Pro rows), cold power-off, suspend/resume with the re-enable on every On defaulting the quirk: We are happy to set |
|
Thanks for the clear account of what was and was not measured, and for agreeing on the direction. Merge order with #2068 is not a hardware reason, though, so we would rather make |
Apply the TMU quirk in the common Apple CIO probe rather than in the T6050 hardware table. Keep host-router TMU policy unchanged. Bidirectional HiFi does not support CL states. Skip negotiating them and disable any firmware-configured states before selecting the mode. Share the existing disable, post-time and enable path. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
|
Note 🤖 GPT responding on behalf of Joshua Warren
HiFi BI does not need the checks used for uni mode. The driver keeps CL states off for HiFi BI. It clears any CL state set at boot before it switches modes. The tested Studio Display is gen 3, so the time-post call does not write there. The local path check and checkpatch passed. The four Mac tests you offered can now use this head. Please include resume and idle power where you can. |
|
Thanks, 253232b is the shape we asked for. What's left:
CI is still queued. |
|
Note 🤖 OpenAI Codex responding on behalf of joshuaswarren Host tests passed on |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Thanks. 253232b is the shape Ryan asked for. QUIRK_TMU_HIFI_BI is now set for every Apple CIO host in apple_nhi_probe() (drivers/thunderbolt/apple.c:2698-2699), and the T6050-only flag is gone. Once this lands, #2068 can drop its nhi.h and tb.c hunks and its T6040 flag.
I read it against the integration/aurora tip (391fac6):
tb_switch_tmu_configure()acceptsTB_SWITCH_TMU_MODE_HIFI_BIon every router, with no capability check (tmu.c:1118). So the lost -EOPNOTSUPP fallback that the SWE-2 review raised can't trigger.- The host router still stays with its firmware where
QUIRK_HOST_TMUis set, because the new branch requirestb_route(sw)(tb.c:370). - The early return in
tb_enable_clx()(tb.c:235) is required, not just tidy. Upstream already picks HiFi BI only while CL1 is off, andtb_increase_switch_tmu_accuracy()only touches LowRes routers, so nothing moves a router back. - integration/aurora has changed
apple.csince your base (the DP IN admission and the aura loader-name logs). A local three-way merge is clean and only touches the quirks line.
Two behaviour changes worth knowing. Neither blocks:
- CL states now stay off on every Apple host's device links, including the T8103, T6020, T6030 and T8142 tables, which don't set
no_host_clxtoday (apple.c:177-210). That is the idle-power row Ryan listed. - During discovery the scan path logs "discovery, not touching CL states" (
tb.c:1457), but the new branch callstb_switch_clx_disable()anyway. That's harmless on Apple because iBoot builds no tunnels, but a short comment there would help the next reader.
host-tests is green on 253232b. Approving and merging. These rows come after the merge, with a revert ready:
- your K114c run on this head: 5K60 at boot, then unplug and replug, then suspend and wake with the cable attached;
- Ryan's Thunderbolt display rows on the M1 Pro, M2 and M4 Pro, with resume and idle power, plus a USB4 v2 device if one is around, since this also replaces the enhanced uni-directional mode there.
5d33615
into
aurora-silicon:integration/aurora
|
Merged as 5d33615 (host-tests green on the updated head 4f42922). Post-merge verification as in my review: the K114c run on the merged kernel (5K60 at boot, unplug and replug, suspend and wake with the cable attached), and Ryan's Thunderbolt display rows on the M1 Pro, M2 and M4 Pro with resume and idle power. A revert is ready if it doesn't hold. #2068 can now drop its |
|
J775c (lobata) row request — Studio Display 5K60 and resume (sheet rows P1-P2) Posted by Joshua's lane (wB4) from the 2026-11-20 K114c row set. We supply no image for this; it needs a tree with the J775c DTB. Re-pin first: the sheet procedure pins a K114c DTB with ACIO enabled, and lobata needs its own J775c DTB with ACIO before this row can book; steps and pass lines are otherwise unchanged. Head: the merged PR content, Commands: boot the candidate once with the Studio Display attached; save Pass: visible 5K60 for 60 s at boot and after same-port replug; |
|
Thanks for the merge. |
|
Thanks for #2088. I'm on a J714c (14" M5 Max, non-touch, 27.2 stub) with a Dell U4025QW over Thunderbolt on the right port. The DP tunnel comes up (HBR2 x4, EDID read, modeset done, DCP reports the pipe on), but the screen stays black. Same result on integration/aurora a84637d with #2088 and on the omarchy-m5 v272 tree with #2088 + #2187. Two questions: does your Studio Display show an actual picture on the K114c, or does it only hold the link? And could you share the ACIO / DP-in part of your k1152.dtb (the recipe says it's what makes the external display work)? Upstream's t6050-k114c.dts says the DisplayPort route isn't described, so I can't reproduce your setup from merged trees. |
|
Adding detail to my question above, from the Dell (TB4, router gen 4) with #2088 as merged:
Could you share the whole k1152.dtb (or its decompiled dts), not only the ACIO part? Our ACIO and DP IN already come up, so the difference may be in other nodes. |
[Joshua's agent] The Studio Display dropped its 5K link on a 14-inch M5 Max MacBook Pro. The original board-specific patch kept the link up in four completed trials, compared with zero of four without the patch. One further trial ended before the 60-second hold and has no result.
Apple CIO now defaults device routers to bidirectional HiFi. The driver cycles the TMU even when the router already reports that mode. It leaves host-router TMU policy unchanged and keeps CL states off because bidirectional HiFi does not support them. On the tested generation-3 display router, the time-post helper is a no-op.
The previous M5 tests used related trees and resets from a second machine. The wider head,
253232bc7660e7fec4b11b9674f3aba61f601e59, has not run on hardware. The M1 Pro, M2, M4 Pro and A18 Pro display rows are pending. Please include coldplug, hotplug and resume where available.Related: #2068. The two PRs overlap in the TMU quirk; the one that lands second can drop its duplicate.