Repository navigation
thunderbolt: apple: run a Studio Display's router in bi-directional HiFi (T6050) - #2088
joshuaswarren wants to merge 1 commit 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 |
[Joshua's agent] One fix: a Studio Display style 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. On the T6050 the display then drops HPD about a second into 5120x2880@60 ("IOAVVideoInterface terminated").QUIRK_TMU_HIFI_BI(BIT(15), the first free bit on this base): every device router is configured for bi-directional HiFi, disabled, offered the host's time and enabled again. On the Studio Display tried, the time post is a no-op (router generation 3, see the 13:47 boot below), so what the quirk does there is the disable and enable. The host router's TMU stays with its firmware whereQUIRK_HOST_TMUis set. It is set for T6050 only; T6040's DP IN is disabled in this tree, so that entry is left alone.Credit: this is Petr Skuta's change. It is commit 5 of #2068 (
07375891752a, "thunderbolt: apple: run T6040's TMU in bi-directional HiFi"), set for T6050 instead of T6040. He is the author of the commit here. #2088 carries the same commit alone: #2068 also definesQUIRK_TMU_HIFI_BIasBIT(15)and has the sametb.chunks andtmu_hifi_bifield, so the two PRs overlap innhi.h,tb.candapple.c. Whichever lands second drops the duplicate.Files:
drivers/thunderbolt/apple.c(10 lines),nhi.h(7),tb.c(23/2).Validated on, and reach
Validated on: a 14-inch M5 Max MacBook Pro (K114c, T6050), with the same commit on two other bases. Neither booted tree is this head; this head is the commit rebased onto the current integration/aurora and it is not booted. Booted trees:
7.3.0-k114c-ARCH-day2d(the commit on a tree withdsc_disable), boot2bc4664a: the journal shows "TMU CONFIGURED: is_master=1, mode=1" and "TMU: mode set to: bi-directional, HiFi" on the display router, and 0 lines with "IOAVVideoInterface terminated". Display kept.7.3.0-k114c-ARCH-a2t(the commit on the A2 source), 5 boots, each started with a VDM reset from a second machine: boots8951f512,21315fd1,c685ab86and7c1ba736kept the display (4 of 4 with a clean boot),16ffd61ais OPEN: its journal runs to 73.9 s, 45.8 s after the second mode set and short of the 60 s hold, so no verdict. Failures: 0. Each kept boot shows 2 of 2 TMU mode sets kept, DP-1 connected and enabled, 0 terminated, DCP crashed 0, Hyprland crashed 0.7.3.0-k114c-ARCH-p2088b(this commit's content,5bb8ce9c, plus the five commits of drm/apple: complete the 27.3 DCP method table, swap size and completion tag #1816, onintegration/aurorabf423bf0), boote76404d0, withthunderbolt.dyndbg="file tmu.c +p". The Studio Display router (381f00000.nhi: 1:) logged "current mode: bi-directional, HiFi" (already so before the driver acted), then "TMU: disabled", then "mode set to: bi-directional, HiFi"; the firmware line "TMU CONFIGURED: is_master=1, mode=1" followed. DP-1 was connected at 5120x2880 at the first read and again 60 s later, and "IOAVVideoInterface terminated" appeared 0 times. The disable and the mode set can only come from the quirk path intb_enable_tmu(). Not seen: "mode change ... requested" (the router already read bi-directional HiFi) and "updated local time" or anylocal_time[n]line.tb_switch_tmu_post_time()returns 0 before it reads the host time whentb_switch_is_usb4()is false, so the post-time half is probably a no-op on this display, and the router is probably not USB4. A later sysfs read by the tester (13:58, about 11 minutes after this boot; the file has no boot id and no reboot is recorded in between) gives/sys/bus/thunderbolt/devices/0-1("Studio Display") generation 3 and the host router0-0generation 4. A router below generation 4 is not USB4 in this tree, sotb_switch_is_usb4()is false and the time post returns early. The effect on this display is therefore the disable and enable, and a check of whether the time post matters would need a USB4 device router. This is a VDM one-shot boot, not a cold start; the display image was not looked at.Keep count: a2t 4 kept, 1 open, 0 failed (baseline 0 of 4). These are VDM resets from a second machine, not a power-off cold start.
Not checked: which display model was on DP-1 in these runs; a power-off cold boot; a suspend or resume with this change (the new branch disables and re-enables a device router's TMU on every
tb_enable_tmu()call, including re-enumeration after resume); this exact head booted alone (p2088b has #1816 on top, and its tree is the same commit content); any other Mac. Dock or hub topologies behind the display are not run.Applies beyond the M5 Max: the quirk is set only in the T6050 hardware table, so other models are not changed. Anything that reads the T6040 table is untouched.
m tester run (omarchy-m-testing.org): feature rows Thunderbolt / external display. The tester needs a Studio Display style display on a T6050 Mac; no tester run is linked to this change.