Repository navigation
kboot: T8152: copy the USB-C tunables and router DROMs from the ADT - #498
Conversation
|
Verdict at Blockers: The DART address-map test fails during C compilation. The generated fixture calls Checked: The exact J873g boot evidence in the PR body covers front USB and one rear USB4 link. The known work still needs the targeted USB4 storage and display-mode checks and a previous-generation regression on the shared DART and ATC copies. The window and ownership checks should follow the DART node's register description and ownership data where available. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: HOLD at 155b58f36f0d
Blockers:
src/kboot.c:3371,src/kboot.c:3421,tests/python/test_dart_tunables.py:29-37— CIPytest (ubuntu-latest + llvm)fails to compiletest_dart_tunables_map_by_physical_address(chip_idandT8152undeclared;dt_dart_windowimplicitly declared), which also cancelled the gcc and macOS pytest jobs.- Fix: Drop the
chip_id == T8152gate indt_copy_dart_tunable()(src/kboot.c:3371) and bound every DART by its own DT register window viadt_dart_window(dart)(keeping the0x4000fallback only whendt_dart_window()returns0), matchingdt_copy_router_ap_fw_tunable(). Extractdt_dart_window(intests/python/test_dart_tunables.pyand add coverage for a0xc000window (row past0x4000accepted, row past0xc000rejected). - For the
dart-acio*/dart-apciec*restriction (src/kboot.c:3421), avoid referencing globalchip_id == T8152inside the SoC-agnosticdt_copy_dart_tunables(): pass a parameter (e.g.,bool usb4_only) fromdt_prepare_t8152()vskboot_prepare_dt()(or match on the DT node'sapple,t8152-acio-dart/apple,t8152-pciec-dartcompatible), and exercise that filter intests/python/test_dart_tunables.py.
- Fix: Drop the
- §1 (
src/kboot.c:3371): Gatingdt_dart_window(dart)onchip_id == T8152violates §1 when the register window size is already carried directly by the DT node'sregproperty (resolved by the fix above).
Checked:
src/kboot.c:dt_dart_window()(ac < 1 || sc < 1 || sc > 2,len < (int)((ac + sc) * sizeof(*reg)),fdt32_ldalignment/shift safety),dt_append_acio_tunable()bounds checks againstreg_size, rollback viafdt_delprop()on error, and fail-softdt_prepare_t8152()wiring (older J873g DTs withoutatcphy*/usb4-*aliases and with disabledacio*_dart/pciec*_dartare untouched). Non-blocking nit: movingif (fdt_getprop(dt, dart, tunable.fdt_name, NULL)) return 0;beforedt_dart_window(dart)avoids an unnecessaryfdt_parent_offset()scan when a DART already hasapple,tunable.src/kboot_atc.c:atc-phy,t8152fuse entry (NULL, 0emptyapple,tunable-common-a),apple,fixed-usb3DT property selection (no board/port hardcoding), all 21lane1-cioentries verified equal tolane0-cio + 0x9000, allreg_offset + reg_size <= 0x6c200(inside0x84000corewindow), no T8122/T8142 PMAFSM row appended, andcleanup:removes all T8152 properties cleanly. No non-T8152 path inkboot_atc.cchanges.- §2 Production-ready / §3 Safety / §6 Naming: Pass. Default command line, fail-closed per-port cleanup, no hardcoded safety constants, naming clean.
- §4 Attribution: Commit
155b58f36f0dhas human author/committer (Thomas Glanzmann <thomas@glanzmann.de>) and humanSigned-off-by:with zero trailer issues; PR body disclosure present. - §5 Hardware evidence: Exact-head J873g
aura-tryStage 2 trial (1.0.0b15-g155b58f3) verified all 48 USB4/ATC properties (45 byte-for-byte, 3 DROMs UID/CRC8), all 6 DART tables, 4/4 ATC PHYs, 3/3 routers, front hub 10000M, Router 0 20 Gb/s x2 USB4 training, 0 failed units, 0 DART faults. After the new head fixes CI (and ifdt_dart_window()runs for all SoCs), re-confirm exact-head J873g plus a non-T8152 regression boot row (notekboot.o/kboot_atc.oalso link into Stage 1).
Evidence
- Commit:
155b58f36f0d7d09d8f98c7d3d841c4038d164d7(kboot: T8152: copy the USB-C tunables and router DROMs from the ADT) - CI (11/15 green, 1 failed, 3 cancelled):
- PASS:
build,format-check,ESP stage 2 vital size(811080 B / 1179648 B limit; 368568 B free),stage1-size(gcc,clang-macos,fedora,alarm,nix),Pytest (ubuntu-24.04-arm, native start.S),aurora-agent-policy(policy,selftest) - FAIL:
Pytest (ubuntu-latest + llvm)—tests/python/test_dart_tunables.py::test_dart_tunables_map_by_physical_address(chip_id/T8152undeclared,dt_dart_windowimplicit declaration) - CANCELLED:
Pytest (ubuntu-latest + gcc),Pytest (macos-26 + llvm-brew),Pytest (macos-15 + llvm-brew)
- PASS:
- Cross-check against
aurora-silicon/linux#2178(da3173dfb4c9):atcphy{0..3},usb4-{0,1,3}-{acio,pcie-adapter,nhi,pcie}aliases,apple,fixed-usb3onatc2_phy,0x84000ATC core windows,0xc000usb4_*_dart/usb4_*_pcie_dartwindows, andapple,t8152-acio-dart/apple,t8152-pciec-dartcompatibles all match.
The J873g's device tree carried one Mac's ADT tables for its USB4 routers, NHIs, PCIe-C ports, their DARTs and its four ATC PHYs, and the routers' DROMs. They are per Mac: one ATC row differs between the four PHYs of the same Mac (calibration), and each DROM carries the host router's UID. Fill them from this Mac's ADT instead, as on the J813. - dt_prepare_t8152() runs the copies the other SoCs already use: kboot_setup_atc(), dt_set_acio_tunables() (router RC, PCIe adapter, AP firmware and NHI tables, and the DROM with this Mac's UID), dt_set_pcie_tunables() and dt_copy_dart_tunables(). They act only on nodes the device tree links by alias (atcphyN, usb4-N-*), so a device tree without them is unchanged. A failure there is logged and does not stop the boot: Linux then refuses the port. - dt_copy_dart_tunables() takes a list of ADT name prefixes; T8152 passes dart-acio and dart-apciec (the USB4 routers' and PCIe-C DARTs), because its other DARTs are locked or firmware-owned and their device tree describes them without a table. The other SoCs pass none and copy every DART, as before. - A DART table's rows are bounded by the DART's own register window as its device tree node gives it, instead of a fixed 0x4000; without a window in the node, 0x4000 still holds. The T8152 USB4 DARTs have rows past 0x4000 in their 0xc000 window. tests/python/test_dart_tunables.py covers both: a row past 0x4000 is taken in a 0xc000 window and refused in a 0x4000 one, a row at 0xc000 is refused, and with a prefix list only those ADT DARTs are copied. - kboot_atc.c: atc-phy,t8152 has no fuses, and two tables of the ADT's groups. A port that runs USB3 on lane 0 only (apple,fixed-usb3: the J873g's front hub) gets the USBC0 groups and lane 0's USB list; every other port gets CIO on both lanes, with lane 1 at lane 0 + 0x9000. The T8142/T8122 PMAFSM rows are not added. Checked offline against the J873g's 26A434 and 27.2 ADTs: for all four ATC PHYs, all three routers and their NHIs, DARTs and PCIe-C ports, the copies give the tables the J873g device tree carried, row for row; the DROMs differ only in the UID. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
155b58f to
46c6d9b
Compare
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH at 46c6d9b47308
Blockers:
- §5 Hardware evidence (PR body): the J873g
aura-tryStage 2 row in the PR body is still from the previous head155b58f3(1.0.0b15-g155b58f3), not46c6d9b47308. Please post an exact-head46c6d9b47308J873g boot row plus a non-T8152 Mac regression boot row (sincedt_copy_dart_tunable()now appliesdt_dart_window(dart)on every SoC) showing 0 failed units, 0 DART faults, and 0 new kernel errors. - PR body accuracy: update the
## Changesection, which still says "Every other SoC keeps 0x4000" and "No other SoC's path changes" — in46c6d9b47308,dt_dart_window(dart)runs for every SoC (with0x4000fallback only whenreghas no window size).
Checked:
- Prior code and CI blockers resolved cleanly:
dt_copy_dart_tunable()(src/kboot.c:3372-3374) now usesdt_dart_window(dart)unconditionally after the existingapple,tunableearly-return,dt_copy_dart_tunables(const char *const *only)(src/kboot.c:3395-3427) drops the globalchip_idgate in favor of an explicit prefix list, andtests/python/test_dart_tunables.pycovers both0xc000/0x4000window bounds and the{"dart-acio", "dart-apciec", NULL}filter across all four lab DART shapes. All 15/15 CI checks pass on46c6d9b47308. - Cross-checked all 668 Apple DART nodes across the Linux DTS tree (
0x4000: 408,0xc000: 168,0x20000: 92; zero< 0x4000), confirmingdt_dart_window(dart)never tightens bounds below0x4000on existing SoCs. §1–§4 and §6 pass (src/kboot_atc.cclean, human author/committer andSigned-off-by, clean naming). Non-blocking nit:src/kboot.c:3386-3394has two adjacent block comments abovedt_copy_dart_tunables()that can be combined if the commit is touched again.
Evidence
- Head commit:
46c6d9b473082351c1c21ebf18775a9a248b4761(kboot: T8152: copy the USB-C tunables and router DROMs from the ADT) — single commit, author/committerThomas Glanzmann <thomas@glanzmann.de>, humanSigned-off-by. - CI (15/15 green on
46c6d9b47308):build,format-check,ESP stage 2 vital size,stage1-size(gcc,clang-macos,fedora,alarm,nix),Pytest(ubuntu-latest + gcc,ubuntu-latest + llvm,macos-26 + llvm-brew,macos-15 + llvm-brew,ubuntu-24.04-arm, native start.S),aurora-agent-policy(policy,selftest). - DART
regwindow audit across Linux Apple DTS: 668 DART nodes scanned — 408 at0x4000, 168 at0xc000, 92 at0x20000, 0 smaller than0x4000. - Remaining gap: PR body still cites
1.0.0b15-g155b58f3and "Every other SoC keeps 0x4000" / "No other SoC's path changes", with no46c6d9b47308J873g or non-T8152 regression boot rows yet.
The two front USB-C ports sit behind an on-board VL822 hub on usb-drd2. The hub's USB2 side is on the controller's eUSB2 PHY, which the loader sets up, and its USB3 side on ATC2's Type-C PHY, wired directly without a Type-C mux. So far the controller was limited to high speed and the hub ran at USB2 only. Describe ATC2's PHY as an apple,t8152-atcphy with apple,fixed-usb3, hand it to usb-drd2 as its USB3 PHY and drop the controller's high-speed limit. Nothing changes for usb-drd1 (the back-left port). The PHY's power domains are ATC2's USB_AON, COMMON_DP_0 and COMMON_DP_1 PMGR power states, in a new node for the ATCs' block of PMGR states at 0x308290000, and its common domain, PSD service 57 (ADT clock-gates 57). The T8152 USB3 bring-up runs the power states without automatic power management, so they are marked apple,no-auto-pm. The PHY's tunables are the groups of the ADT's atc-phy2 node that apply to USB3 on lane 0: the common and PLL defaults as common-a, the fabric, PLL and USBC0 groups as common-b and the lane 0 groups as lane0-usb. Some of them differ between the four ATCs of the same Mac, so they are calibration: the bootloader copies them from the Mac's own ADT, through the atcphy2 alias (aurora-silicon/aura#498). With a loader that copies none, the PHY runs USB2 only. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The two front USB-C ports sit behind an on-board VL822 hub on usb-drd2. The hub's USB2 side is on the controller's eUSB2 PHY, which the loader sets up, and its USB3 side on ATC2's Type-C PHY, wired directly without a Type-C mux. So far the controller was limited to high speed and the hub ran at USB2 only. Describe ATC2's PHY as an apple,t8152-atcphy with apple,fixed-usb3, hand it to usb-drd2 as its USB3 PHY and drop the controller's high-speed limit. Nothing changes for usb-drd1 (the back-left port). The PHY's power domains are ATC2's USB_AON, COMMON_DP_0 and COMMON_DP_1 PMGR power states, in a new node for the ATCs' block of PMGR states at 0x308290000, and its common domain, PSD service 57 (ADT clock-gates 57). The T8152 USB3 bring-up runs the power states without automatic power management, so they are marked apple,no-auto-pm. The PHY's tunables are the groups of the ADT's atc-phy2 node that apply to USB3 on lane 0: the common and PLL defaults as common-a, the fabric, PLL and USBC0 groups as common-b and the lane 0 groups as lane0-usb. Some of them differ between the four ATCs of the same Mac, so they are calibration: the bootloader copies them from the Mac's own ADT, through the atcphy2 alias (aurora-silicon/aura#498). With a loader that copies none, the PHY runs USB2 only. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The three rear USB-C ports' ATC PHYs (ADT atc-phy0, 1 and 3) were only known to the display controllers, as register windows they program and power themselves. Describe them as T8152 Type-C PHYs, which the ATC PHY driver runs in CIO mode for USB4: - their core windows (0x403000000, 0x40b000000, 0x413000000, 0x84000 each, also mapped by the display controllers); - the orientation and mode switches, linked to the SuperSpeed port (port@1) of the port's usb-c-connector; - their power domains, in power-up order: the ATC's USB_AON, its common PSD service (55, 56, 58) and its COMMON_DP_0/1 power states, new nodes next to ATC2's. The USB_AON states are kept on, as ATC2's: they hold the rear USB controllers' state the loader set up; - the atcphy0, 1 and 3 aliases, through which the bootloader copies each PHY's CIO tunables from the Mac's own ADT (atc-phyN groups, aurora-silicon/aura#498): the common defaults before the lanes are powered up, the fabric, PLL and remaining common groups after them, then each lane's groups. Without them the PHY runs no CIO mode. The display controllers' usb-c port nodes take the PHYs through their DP PHY, which powers them while a controller drives the port. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Describe the three rear USB4 routers (ADT acio0, acio1, acio3) with their mailboxes, NHI, ACIO DARTs, PCIe-C tunnels and their DARTs, the CIO reset block, the PSD services they need and the LSTX pins. Generated from the J873g ADT. The router, NHI, DART and PCIe-C tunables and the routers' DROMs are not in the device tree: they are per Mac (a DROM carries the host router's UID), so the bootloader copies them from the Mac's own ADT (aurora-silicon/aura#498), through the usb4-N-acio, -pcie-adapter, -nhi and -pcie aliases (ADT acio0, 1 and 3, apciecN), and the DARTs' by their address. With a loader that copies none, the routers, NHIs and PCIe-C ports refuse to start. Each router coprocessor's mailbox has apple,t8152-smc-mailbox as its fallback and the two interrupts of the ADT's acio-cpuN node, which list send-empty first, as the SMC mailbox's do. Each router's Thunderbolt switch (its port@1) is linked to the USB4 port (port@4) of its port's usb-c-connector, as on the J813: the PD controller driver sets the port's ATC PHY to CIO mode and then starts the router with the cable's EUDO and orientation, and stops the router before it takes the PHY out of CIO mode. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
|
@RyanTheTide @DjDeveloperr thanks. Both points are fixed. The head is No chip gate in the DART copy
Other SoCs. The window bound now applies everywhere, so I checked what it changes on the J813 (T8142), offline:
J873g row at
Still not covered: USB4 storage and DisplayPort-mode rows on the J873g. They need the enclosure and a USB-C monitor plugged into the M6. Assisted-by: LLM (Claude:Opus 5.5) |
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
The J873g USB4 storage and DisplayPort rows on this exact head (
The non-T8152 boot row comes next, on the J813. Assisted-by: LLM (Claude:Opus 5.5) |
|
@DjDeveloperr @RyanTheTide the non-T8152 regression row, on the J813 (MacBook Air M5, T8142), on this exact head.
Together with the J873g rows (exact head, USB4 storage and DisplayPort switch), that covers what your review asked for. Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH at 46c6d9b47308
Blockers:
- §4 PR body: remove the trailing
Assisted-by:line at the bottom of the PR description (and please addTested:/Risk:lines while editing sopr-text/pr-readinessare completely clean).
Checked:
- Both exact-head
46c6d9b47308hardware rows now satisfy §5:- J873g (T8152): USB4 storage (20 Gb/s x2, 3.1–3.2 GB/s, checksum verified across replug/flip/port-swap) and DP/CIO port swap with 0 failed units, 0 DART faults, 0 new kernel errors.
- J813 (T8142, non-T8152 regression): A/B vs base
8b1cb8ceconfirms all 123apple,tunable*properties (including all 24 DART nodes) are byte-identical, 0 failed units, 0 DART faults, 0 new kernel errors, and rear USB4 replug matrix clean.
- Code, commit
46c6d9b47308(human author/committer +Signed-off-by:, zero attribution), and 16/16 CI checks are all clean.
Ready for immediate APPROVE once the PR description is cleaned up.
Evidence
- Exact head:
46c6d9b473082351c1c21ebf18775a9a248b4761(OPEN,isDraft: false,MERGEABLE, 16/16 checks passing). - J873g row:
linux#2178#issuecomment-7138430833; J813 regression row:#issuecomment-7138758401(17:08Z).
|
@DjDeveloperr done: the description has no |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 46c6d9b47308
Blockers: none
Checked:
- §4 PR body cleanup verified:
Assisted-by:footer removed, structured withWhat,Tested,Risk, andNot yet; commit46c6d9b47308carries human author/committer (Thomas Glanzmann) andSigned-off-by:with zero attribution. - §5 exact-head
46c6d9b47308hardware evidence complete: J873g (T8152) USB4 storage + DP/CIO port-swap row and J813 (T8142, non-T8152) A/B regression row (all 123apple,tunable*properties including 24 DART nodes byte-identical vs base8b1cb8ce, 0 failed units, 0 DART faults, 0 new kernel errors). - Code and 16/16 CI checks are all green.
Evidence
- Exact head:
46c6d9b473082351c1c21ebf18775a9a248b4761(OPEN,isDraft: false,MERGEABLE, 16/16 CI checks passing). - Rows: J873g (
linux#2178#issuecomment-7138430833), J813 (aura#498#issuecomment-7138758624).
What: On T8152 (the M6 Mac mini, J873g), aura copies the USB-C tunables from the Mac's own ADT, as on the J813: the ATC PHYs', the USB4 routers', NHIs', PCIe-C ports' and their DARTs' tables, and the routers' DROMs with this Mac's UID. They are per Mac (one ATC row is calibration), so linux#2178 and #1799 drop them from the device tree. The DART copy now bounds each table by the DART's own register window.
Tested: J873g M6 Mac mini at
46c6d9b4: all 48 USB4/ATC tables and DROMs come from the ADT; USB4 NVMe on both rear routers across a replug, a flipped replug and a port swap; DisplayPort and USB4 swapped between the ports; 0 failed units, 0 DART faults. J813 M5 Air at46c6d9b4: all 123apple,tunable*properties identical to the base8b1cb8ce, 0 failed units, 0 DART faults.Risk: two-way door · J873g (T8152) for the new copies; the DART window bound runs on every Mac, and no Apple DART in the tree has a window below 0x4000, so it refuses nothing it took before (identical on the J813).
Not yet: boot rows on Macs other than the J873g and the J813.
Details
The J873g's (M6 Mac mini, T8152) device tree carries one Mac's ADT tables for its USB-C hardware: the USB4 routers' RC, PCIe adapter, AP firmware and NHI tables, the ACIO and PCIe-C DARTs', the PCIe-C ports', the four ATC PHYs', and the routers' DROMs. Dj's review of linux#2178 asks for them to come from the machine at boot, as the J813's do (linux#2142 with #302/#435). They are per Mac: one ATC row (
ACIOPHY_CMN_DFLT0x860) differs between the four PHYs of the same Mac, and each DROM carries the host router's UID.Change
dt_prepare_t8152()runs the copies the other SoCs already use:kboot_setup_atc(),dt_set_acio_tunables()(router tables and the DROM with this Mac's UID),dt_set_pcie_tunables()anddt_copy_dart_tunables().atcphyN,usb4-N-*), so a device tree without the aliases, like every J873g one up to now, is unchanged.dt_copy_dart_tunables()takes a list of ADT name prefixes.dt_prepare_t8152()passesdart-acioanddart-apciec, because the other T8152 DARTs are locked or firmware-owned and their device tree describes them without a table. The other SoCs pass none and copy every DART, as before.kboot_atc.c:atc-phy,t8152has no fuses. It gets two tables of the ADT's groups, by name, at the PHY offsets they apply to:apple,fixed-usb3(the front hub) gets the USBC0 groups and lane 0's USB list;Apart from the DART window bound, no other SoC's path changes. On the J813, offline, its 36 ADT DART tables have no row past 0x4000, so the copy gives the same tables as before there.
Evidence
Testing
1.0.0b15-g46c6d9b4), one-shotaura-tryStage 2 trial from the enrolled1.0.0b14-gd7f5a487. The kernel was linux#2178's head1b969ed3f444, whose device tree has no tables, on the M6's default command line.usb-drddefaults stay unset ("no controller"), as before, because the J873g's dwc3 nodes are not matched by PHY.tests/python/test_dart_tunables.pycovers the window bound (a row past 0x4000 taken in a 0xc000 window, refused in a 0x4000 one, a row at 0xc000 refused) and the prefix filter;pytest tests/pythonpasses 1100.make format-checkpasses; the build has no new warnings.8b1cb8ce: all 123apple,tunable*properties identical, the 24 on DARTs included; the rear USB4 replug matrix of linux#2142 on the same boot).