Skip to content

kboot: T8132 USB3 calibration, AOP handoff and absent-ISP rule by ADT property - #113

Open
techmore wants to merge 3 commits into
aurora-silicon:mainfrom
techmore:m4/j773g-dt-adt-gates
Open

techmore wants to merge 3 commits into
aurora-silicon:mainfrom
techmore:m4/j773g-dt-adt-gates

Conversation

@techmore

@techmore techmore commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Three T8132 (M4) rules in kboot, each decided by what the ADT and the OS tree describe. None has a board list, board-id, model or OS-version test; kboot_is_j773g() is removed.

  • USB3 calibration (kboot_atc.c). A tree node that is apple,t8132-atcphy whose ADT node is atc-phy,t8132 gets the T8132 USB3 bundle when the ADT has every required group, well formed. A PHY that lacks one gets nothing of the bundle and keeps its USB2 fallback; the other PHYs are not affected. The J713/J604 list and the chip-id test are removed.
  • AOP handoff (dt_set_t8132_aop()). The board list is removed. When the tree asks for the handoff (linux-enablement-mac,dapf-handoff lists /arm-io/aop) and the AOP is halted, the segment and DAPF-window reservations are made as one tree transaction and the DAPF is programmed last; it is the only hardware write, and dapf_init_t8132_halted() restores every slice if its read-back fails. A failure at any step leaves no reservation and no changed DAPF slice, and disables the AOP. A tree that does not ask is not changed.
  • Absent ISP (kboot_t8132.c). When the ADT has neither isp nor isp0, an enabled apple,t8132-isp node is disabled together with the DARTs only it uses. No chip-id test. If the rule cannot write the tree it logs that and the boot continues.

What changes on other boards: needs your explicit acceptance

We can test only the J773g. These follow from removing the board lists:

  1. USB3 copy on every T8132 tree. J623-, J624- and J715-class trees with apple,t8132-atcphy nodes now get the bundle wherever their ADT carries it in full. Untested there.
  2. USB device role. With the bundle published, a rear port where the Mac is the USB device fails its role: dwc3-apple …: USB3 PHY setup failed, err=-95 (reported by DjDeveloperr on a J773g, 26.6.2); with USB2 only it ran as a USB2 device. Point 1 extends it to every board that gets the bundle. See "USB device mode" below: the fallback has to be a kernel change.
  3. AOP on other T8132 trees. A tree that asks for the handoff now gets it, or a disabled AOP, on any board; before, only J713 and J604. Untested off the J773g.
  4. J713 and J604, tree not asking. main disabled their AOP in that case; now the tree is left as it is, the same as main does for every other board. This affects only a J713 or J604 tree that enables the AOP without the request; we have not checked which trees in use do.

If any of these is not acceptable, say which and we will narrow it by a property you name.

USB device mode

The loader cannot make device mode fall back. In aurora-silicon/linux integration/aurora (0abc2f38):

  • drivers/phy/apple/atc.c:4728-4731: atcphy_usb3_set_mode() returns -EOPNOTSUPP for PHY_MODE_USB_DEVICE whenever the T8132 PHY is in a USB3 mode; atc.c:5812 puts it in a USB3 mode once the calibration is loaded (ss_tunables, atc.c:6327).
  • drivers/usb/dwc3/dwc3-apple.c:942-952: dwc3_apple_set_role() treats any USB3 PHY error on apple,t8132-dwc3 as fatal instead of continuing on USB2, which gives the err=-95 line.
  • The only thing the loader publishes that this reads is the calibration itself. Withholding it from a PHY would bring device mode back at the cost of SuperSpeed host on that port, and the role is decided by the cable at run time, after the loader has gone.

So the USB2 fallback for device role belongs in one of those two kernel places.

Device-mode row (J773g, 27.2 stub, this head's loader with 4 × FDT: Copied T8132 USB3 calibration, rear port, Thunderbolt 4 cable to a MacBook Pro, kernel = our test tree with aurora-silicon/linux#1702's two commits, one boot):

Seen
PHY phy-apple-atc 40aa90000.phy: USB4/Thunderbolt is not available on this port: serving its USB2 only
Port data=host [device], partner present; no failed to configure Type-C connection, no err=-95
Controller 40a280000.usb mode=device, UDC present
Gadget binds, configured, current_speed high-speed
Host side the MacBook lists the gadget at 480 Mb/s

Without #1702 the same cable fails earlier, in the port controller (sn201202x 1-0a: failed to configure Type-C connection: -19, then cable revalidation failed after 3 attempts), because the partner enters USB4.

This row is a Thunderbolt/USB4 partner, where the PHY serves USB2 only and takes the device role by itself. It does not cover the err=-95 case above (a plain USB 3.x host): the kernel change for that (in dwc3-apple.c: continue the device role on USB2 when the T8132 PHY answers -EOPNOTSUPP) is now in aurora-silicon/linux#2334 (as of 055fed84, for every SoC; our aurora-silicon/linux#2420 was closed in its favour). With #2420's commit, on the same unit and loader, a rear port to a plain USB 3.x host (the USB-C data port of a dock on a MacBook Pro): USB3 PHY has no SuperSpeed device mode, USB2 only, mode=device, the gadget configured at high speed and listed by the host at 480 Mb/s; without it, 3 × err=-95 and no device. A gadget that was configured does not re-enumerate after a software unbind and rebind; that also happens without that commit on this controller, so it is not caused by it. Replug and a SuperSpeed host session afterwards were not run.

Relation to #310

#310 qualifies the J773g through the board list and kboot_is_j773g(); this PR removes both, and the J773g reaches the handoff by property.

Tests

  • test_t8132_aop_gate.py: the production function on J713, J604, J623, J624, J715 and J773g trees: same result on each; each step failed in turn disables the AOP and leaves no reservation; the DAPF write is asserted to come after both reservations; an unrequested handoff leaves the tree byte for byte and touches no hardware.
  • test_t8132_atc_usb3_any_board.py: the production copy on the four PHYs of a J773g ADT (27.2 stub) under five board trees: four served. Bundle incomplete on one PHY, copied on the others: one required group hidden on one PHY (four different groups, four different PHYs in turn): that PHY gets nothing and prints the incomplete line, and the other three must each have the full bundle with the ADT's values. The case fails if a refusal withdraws the bundle from any other PHY. An ADT PHY of another type, and a tree node of another type: none.
  • test_t8132_isp_absent.py: enabled and disabled ISP, a shared DART, a malformed iommus, a full tree, an ADT with isp or isp0; and the real dt_set_isp() order.

Full host suite on the head: no failure that main does not have.

Hardware

J773g (Mac mini), macOS 27.2 (26B123) stub, Stage 1 1.0.0b13, this head's tree as a one-shot ESP Stage 2 (built as dbf4073d before the Signed-off-by was added, hence aura 1.0.0b13-gdbf4073d; 53be8212 has the same tree 9f33b332; built on macOS with clang 23.1.5), 2 boots, both the same:

Decision Loader Tree Linux received
USB3 copy per PHY 4 × FDT: Copied T8132 USB3 calibration, 0 × calibration incomplete 4 apple,t8132-atcphy nodes, 7 apple,tunable-usb3-* each
AOP handoff 15 AOP DAPF windows reserved, AOP handed off with its DAPF and firmware segments aop@390600000 okay, with asc-firmware@… and asc-mmio@… reservations
Absent ISP no line (the tree's ISP is already disabled) ISP and its three DARTs disabled

A third boot of the same loader build with a test tree whose apple,t8132-isp node is enabled, to exercise the absent-ISP rule: FDT: no ISP in the ADT; T8132 ISP disabled with the DARTs only it uses; Linux received isp@48c000000 and its three DARTs disabled; SSH, no Oops or WARNING, no ISP or DART probe line.

Both boots reached SSH with no Oops, BUG or WARNING. The kernel booted has no AOP driver, so nothing started the AOP: the handoff was prepared, not exercised. No SuperSpeed device was plugged in, so no 5/10G link was measured.

Not tested: any other T8132 board; any refusal path on hardware (host tests only); 26.6.2 with this head; a physical replug in device mode.

@techmore

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (efd7963). Two changes:

  • Main now hands off the AOP on the J604 (f1b9978), so "kboot: disable the T8132 AOP on boards without a qualified handoff" keeps the J713 and J604 handoffs and disables the AOP only on the other T8132 boards; its host test and message cover J604 as qualified.
  • The previous revision of this PR added kboot_is_j773g() and the absent-ISP rule to kboot.c, whose code is linked into Stage 1's .init slot. Main's GCC build leaves 96 bytes there, so after the rebase the GCC Stage 1 stopped linking (the build, gcc and stage1-size jobs failed). Both functions now live in a new src/kboot_t8132.c; what stays in kboot.c is the AOP change and the one call to the absent-ISP rule, 24 bytes more than main with GCC 16, and those jobs pass. No behaviour change: the same host tests run against the moved code.

@techmore
techmore force-pushed the m4/j773g-dt-adt-gates branch 3 times, most recently from a43f86d to 5050321 Compare November 14, 2026 01:09
@techmore
techmore marked this pull request as ready for review November 14, 2026 01:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T02:01:01.239717Z 5050321 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5050321975

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/kboot.c Outdated
Comment on lines +11459 to +11460
if (dt_disable_t8132_absent_isp(dt))
return -1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Validate the new disable paths on affected hardware

The commit's validation report explicitly lists the AOP/ISP disable paths as untested on hardware; the reported native boot used an older revision stacked with two additional commits and a tree whose ISP was already disabled. AGENTS.md requires changes to be tested on the hardware they affect before merge. Record a hardware boot of this revision that exercises these paths and verifies the resulting AOP, ISP and unshared DART statuses; the isolated host harnesses do not satisfy that merge requirement.

AGENTS.md reference: AGENTS.md:L15-L15

Useful? React with 👍 / 👎.

Comment thread src/kboot_t8132.c
Comment on lines +63 to +64
if (status && !strcmp(status, "disabled"))
continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Run the absence gate before generic ISP setup

On a camera-less T8132 with an isp alias and enabled ISP/DART nodes, kboot_prepare_dt() executes dt_set_isp() before this helper (src/kboot.c:11457–11460). The generic step fails to find either ADT ISP node and sets the ISP to disabled, so this early skip bypasses all DART cleanup and leaves the unused ISP DARTs enabled in the handed-off tree. Running both production steps in order reproduces an exclusively owned DART remaining okay; move the absence gate before generic ISP setup, or allow it to clean up DARTs when the preceding step disabled the ISP.

Useful? React with 👍 / 👎.

@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.

Holding this for two things:

  1. The ordering issue from the automated review (src/kboot_t8132.c) is real. In kboot_prepare_dt(), dt_set_isp() runs first. On a T8132 whose ADT has no isp/isp0, dt_reserve_asc_firmware() fails, and dt_set_isp() sets the isp node to disabled itself. dt_disable_t8132_absent_isp() then skips that ISP because it's already disabled, so the DARTs only it uses stay okay in the handed-off tree: the case this gate is for. Two possible fixes, either is fine:

    • run the absent-ISP gate before dt_set_isp();
    • let the gate also clean up the unshared DARTs of an ISP that's already disabled when the ADT has no camera.

    A host test that runs both steps in order would pin it.

  2. Your own hardware plan: a J773g boot of this head alone as the ESP Stage 2, recording the AOP disabled, no enabled ISP or ISP-only DART, and the USB3 copy lines. aura's policy wants the affected hardware tested before merge. The AOP disable also changes the J623/J624/J715 trees, which are offline-only so far.

Stage 1 headroom on this head's CI: nix 7536 B, fedora 8160 B, gcc 15784 B. #199 stays behind this one.

techmore added a commit to techmore/aura that referenced this pull request Nov 14, 2026
Stage 2 handles the powered-off post-M4 ANS handoff (nvme.sart=, see
aaec599 "payload: start a post-M4 ANS an earlier stage powered off
before any payload"), but hands a live session without SART entries on
as it found it.

T8132 Stage 1 releases from before the powered-off handoff (v1.0.0b10
and earlier, including 1.0.0b8) leave ANS running and pass no SART
entries. The newer U-Boot tail (1b60b47e, U-Boot aurora-silicon#38 plus aurora-silicon#40) dropped
adoption of such an inherited session and starts ANS from
apple,sart-entries instead, so it refuses what Stage 2 hands on. A Mac
mini M4 (J773g) on Stage 1 1.0.0b8 then stops after the Stage 1 vector:
no Stage 2 display, no U-Boot output, no Linux.

On T8132, when a non-boot= Stage 2 has not used NVMe and no SART
entries were passed, take the inherited session over with nvme_init()
and shut it down normally, so the payload receives ANS off with its
SART entries. If the takeover fails, stop rather than hand over an ANS
in an unknown state. The nvme.sart= and boot= paths and every other
chip are unchanged.

This changes the old-Stage-1 contract for every non-boot= T8132
payload. An older U-Boot that adopts a live ANS but cannot start one
from off would no longer work with an old Stage 1; keep the aura and
U-Boot pins coordinated.

Tested on a J773g with Stage 1 1.0.0b8 and U-Boot 1b60b47e: a Stage 2
from main + aurora-silicon#113 + aurora-silicon#199 with this change booted Linux five times in a
row; without it the same stack stopped before U-Boot.

Assisted-by: LLM
Signed-off-by: Sean Dolbec <sdolbec1@gmail.com>
@techmore
techmore force-pushed the m4/j773g-dt-adt-gates branch from 5050321 to d042241 Compare November 14, 2026 19:29
@techmore

Copy link
Copy Markdown
Contributor Author

Updated to d042241fc03dfa20d462f3a628cf8d84e591bfe0: rebased onto main be9469167b919e45dc906e3dba1dda79cbe35dea and stacked on draft PR #244 ("payload: support live ANS from older T8132 Stage 1", now 3de7351b65bfad60d6d75bee1905137f7b844a04). The four #113 commits build and pass their tests on plain main too.

On the two points in the review:

  1. Ordering: fixed as you suggested first, in "kboot: keep the T8132 ISP disabled on a Mac whose ADT has no camera" (3d86af21): the absent-ISP gate now runs before dt_set_isp() in kboot_prepare_dt(). A second host test runs the real dt_set_isp() and the gate in production order; with the previous order it fails because the ISP ends disabled while its unshared DARTs stay okay.
  2. J773g boot of this head as the ESP Stage 2: the signed head was installed on the ESP as a one-shot trial (Stage 1's aura-try marker naming a new file next to the live Stage 2, which stays untouched and takes every later boot) and booted twice, each reaching Linux on the installed kernel with DMI aura 1.0.0b13-gd042241f, Ethernet up and no RTKit crash. In each, Stage 2's own log (aura_stage2.log, read from Linux through /proc/kcore) has FDT: Copied T8132 USB3 calibration once per PHY (four lines), Stage 1's log has aura-try: marker spent, trying m1n1/aura-trial-113.bin, and the tree Linux received (/sys/firmware/fdt) has the AOP disabled, no enabled ISP and no enabled ISP-only DART, and the seven apple,tunable-usb3-* properties on each of atcphy0..3.

“This head alone”: I booted the literal #113 branch head; that head includes the one #244 commit. I also tried main + only these four #113 commits on the same Stage 1 1.0.0b8 machine. Stage 1 accepted the image but hands Stage 2 a live ANS session with no SART entries; the embedded U-Boot deliberately does not adopt that inherited session, so Linux was not reached and the trial watchdog recovered. #244 converts that old-Stage-1 handoff to ANS off plus apple,sart-entries, which is why this b8 machine cannot boot a #113-only branch. If you need #113 isolated from the draft dependency, I will rebase and boot it after #244 lands, or repeat the #113-only boot with a v1.0.0b11+ Stage 1.

The J773g's own OS tree describes the AOP disabled and has no ISP node, so in a normal boot the AOP gate is not reached and the absent-ISP gate finds nothing to disable. One more boot of the same signed head, installed the same way, used a test OS tree on the same machine and ADT that enables the AOP and adds an enabled apple,t8132-isp node over three DARTs, one of them also used by another node: Stage 2's log has FDT: /soc/aop@390600000: disabling the AOP: no handoff is qualified for this board and then FDT: no ISP in the ADT; T8132 ISP disabled with the DARTs only it uses, ahead of dt_set_isp()'s own FDT: ISP firmware or heap not reserved, disabling the ISP, and Linux received the AOP and the ISP disabled, the two unshared DARTs disabled, and the shared DART and its other user still okay.

The same four patches, except for the two -Oz Makefile lines this rebase drops (range-diff: commits 2 and 3 identical; commits 1 and 4 lose only those lines, and commit 4 the message paragraph about them), were booted five times the same way on the previous base f6aad3a0 (signed head 62318b63).

J623, J624, J715: the AOP rule disables the AOP on every T8132 board except the J713 and J604, so it changes those three trees as well. They are covered by the host test only; we have none of that hardware. The absent-ISP rule applies to any T8132 Mac whose ADT has neither isp nor isp0.

Makefile and Stage 1 headroom: Upstream aa647683 now builds every kboot_*.o with -Oz, so #113 no longer touches the Makefile: its earlier -Oz additions for kboot_t8132.o and kboot_atc.o were dropped in this rebase. Stage 1 headroom (tools/stage1_size.sh, stage1 flavour) on be9469167b91: Homebrew clang 18424 bytes and aarch64-elf-gcc 16.2 18424 bytes, the same as main with each toolchain. The nix and Fedora toolchains were not reproduced locally; their headroom will be reported by CI on the updated head.

Tests on the booted tree: full pytest 729 passed, 52 skipped (main alone: 706 passed, 52 skipped); the three #113 files plus the ANS regression file 173 passed, 8 skipped; on plain main + only the four #113 commits, the three #113 files collect four items and all 4 passed.

HDMI stays dark with this branch: without #199 the DCP mappings are not published, apple-drm defers and Linux has only simpledrm. There are no display photos for these boots (the camera was not facing the display).

Not covered: J713, J604, J623, J624 and J715 boots; USB3 link speed.

@techmore

Copy link
Copy Markdown
Contributor Author

Dependency note: this branch currently carries #244's payload: support live ANS from older T8132 Stage 1 commit (3de7351b). #244 is on hold because that ANS handoff is the same one reported to stop a J773g with stock U-Boot e1ef8b63 before Linux. Treat #113 as blocked on #244 until I either land the #244 fix-up or rebase this branch off that commit. #199 and the display work depend on #113.

@techmore
techmore force-pushed the m4/j773g-dt-adt-gates branch from d042241 to 24812c5 Compare November 15, 2026 00:52
@techmore

Copy link
Copy Markdown
Contributor Author

Updated to 24812c554030b8eb7b45d13570f0e6df2bfd32ed, the deterministic signed form of the decoupled #113 tree at 7cfa251e. The four commits are directly on main eb66d6cd79a46ddcff85628599135a607fd70648; 3de7351b is not an ancestor. The branch no longer carries #244's change. This supersedes my dependency note above (issuecomment-6885735045).

The four commits are patch-identical to the previous branch (git patch-id --stable):

# previous (on #244) now (on main, signed) stable patch-id
1 7e97e70c b3b52c0c fd0dc528adbe
2 833283d2 b3503625 0f864646fb07
3 3d86af21 c53ae6bc 206e32bcff32
4 d042241f 24812c55 b71e84071fae

Host comparison for the decoupled chain through 2d3c654b, against main eb66d6cd through the identical job: gcc pytest was 737 passed, 27 failed, 4 errors versus 733 passed, 27 failed, 4 errors; clang pytest was 676 passed, 27 failed, 64 errors versus 672 passed, 27 failed, 64 errors. The failing/erroring test-ID sets were identical to main for both legs, so the chain introduced no new host-test failures. On macOS the decoupled chain was 739 passed versus main's 735, with the same six host-toolchain items.

Boot-queue 20 PASS: exact signed head 24812c55 ran as a one-shot ESP Stage 2 with stock U-Boot e1ef8b63 on Stage 1 1.0.0b8. It reached the Fedora default kernel and NVMe root with Ethernet carrier 1 at 2.5 Gb/s, 10 CPUs online and zero RTKit crash lines; USB3 tunables were 7/7/7/7, AOP was disabled, ISP was absent, apple,sart-entries and FDT: ANS will be off were absent, and the committed default returned cleanly in 55 seconds.

techmore added a commit to techmore/aura that referenced this pull request Nov 15, 2026
Stage 2 handles the powered-off post-M4 ANS handoff (nvme.sart=, see
aaec599 "payload: start a post-M4 ANS an earlier stage powered off
before any payload"), but hands a live session without SART entries on
as it found it.

T8132 Stage 1 releases from before the powered-off handoff (v1.0.0b10
and earlier, including 1.0.0b8) leave ANS running and pass no SART
entries. The newer U-Boot tail (1b60b47e, U-Boot aurora-silicon#38 plus aurora-silicon#40) dropped
adoption of such an inherited session and starts ANS from
apple,sart-entries instead, so it refuses what Stage 2 hands on. A Mac
mini M4 (J773g) on Stage 1 1.0.0b8 then stops after the Stage 1 vector:
no Stage 2 display, no U-Boot output, no Linux.

On T8132, when a non-boot= Stage 2 has not used NVMe and no SART
entries were passed, take the inherited session over with nvme_init()
and shut it down normally, so the payload receives ANS off with its
SART entries. If the takeover fails, stop rather than hand over an ANS
in an unknown state. The nvme.sart= and boot= paths and every other
chip are unchanged.

This changes the old-Stage-1 contract for every non-boot= T8132
payload. An older U-Boot that adopts a live ANS but cannot start one
from off would no longer work with an old Stage 1; keep the aura and
U-Boot pins coordinated.

Tested on a J773g with Stage 1 1.0.0b8 and U-Boot 1b60b47e: a Stage 2
from main + aurora-silicon#113 + aurora-silicon#199 with this change booted Linux five times in a
row; without it the same stack stopped before U-Boot.

Assisted-by: LLM
Signed-off-by: Sean Dolbec <sdolbec1@gmail.com>
@RyanTheTide

Copy link
Copy Markdown
Contributor

The production boot stub pins at macOS 27.2 (26B123), so please retarget this to 27.2. The gate is validated on 26.6.2 only, so a J773g on a 27.2 stub fails closed. Please validate and admit 27.2.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Tested on the owner's Mac mini J773g (Mac16,10, 26.6.2 stub), 2026-11-19, as aura-try trials.

Stage 2 was the boot-HDMI test series (fdf6510) with this PR's commits on top: b3b52c0c (with the trivial kboot.h conflict against the series' kboot_is_j773g_machine() resolved), c53ae6bc and 24812c55, then #199 and #258.

  • USB3 copy (24812c55): works. Linux (m4gpu1-based kernel, and stock 7.3.0-1-40) no longer prints T8132 calibration incomplete, USB2 only on any of the four PHYs. Before, all four did. No SuperSpeed device was plugged into a rear port, so a 5/10G link isn't measured yet. The front hub needs a PHY change of its own.
    • Side effect worth knowing: a rear port where the mini is the USB device now fails its role (dwc3-apple 40a280000.usb: USB3 PHY setup failed, err=-95, then sn201202x 1-0a: cable revalidation failed after 3 attempts), because the T8132 PHY refuses SuperSpeed device mode. Before, with USB2 only, it ran as a USB2 device.
  • AOP (b3503625): I left it out and handed the AOP over instead. On the J773g that works (===( AOP IS READY )===), and the headphone jack becomes a working sound card. Proposed as kboot: hand the J773g's AOP over to the OS (stacked on #113) #310, stacked on this PR, which keeps every other unqualified board disabled.

🤖 Generated with Claude Code

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the careful J773g work and the thorough test matrix.

The USB3 calibration copy and the AOP decision are selected by a board-and-firmware predicate (src/kboot_t8132.c:26-31 kboot_is_j773g(): board-id 0x2a, J773gAP, os_firmware.version == V26_6_2, tree compatible), used at src/kboot_atc.c:879, plus a board list at src/kboot.c:9031. We select behaviour by a hardware property, not by the machines it was tested on.

Your own comment states the property: "the ADT has every group of this bundle on all four PHYs". Could the copy run on any atc-phy,t8132 PHY whose ADT carries the full bundle (refusing per PHY if a group is missing), with no board or OS-version check? Likewise the AOP handoff could be offered wherever the ADT AOP node has the segments and DAPF it needs, keeping the fail-closed disable on any failure.

dt_disable_t8132_absent_isp() keyed on "no isp in the ADT" is a good example of the shape we mean; its chip_id != T8132 test could go too.

dt_set_t8132_aop() began with a list of boards (J713, J604), so no other
T8132 tree could get the handoff. Its conditions are already checked one
by one: the tree asks for it, the AOP is halted, the ADT's segments and
DAPF windows reserve, and the DAPF programs from the ADT.

Drop the board list. Make the tree edits a transaction and program the
DAPF, the only hardware write, after them: a failed step leaves no
reservation behind and no DAPF slice changed, and disables the AOP. A
tree that does not ask for the handoff is left as it is.

The host test runs the production function on six board trees, fails
each step in turn and checks the order of the hardware write.

Assisted-by: LLM
Signed-off-by: Sean Dolbec <sdolbec1@gmail.com>
A T8132 Mac without a camera has no isp or isp0 node in its ADT, but
nothing stopped a tree from enabling the ISP there: the OS would probe
a camera and ISP power domains that do not exist. dt_set_isp() disables
only the node the isp alias names, and not its DARTs.

When the ADT has neither node, disable every enabled apple,t8132-isp
node and the DARTs in its iommus list that no other node uses, before
dt_set_isp() runs. The rule follows the ADT and the tree only; it lives
in kboot_t8132.c, out of Stage 1's full .init slot. If it cannot write
the tree it says so and the boot goes on.

The host tests cover an enabled and a disabled ISP, a shared DART, a
malformed iommus list, a full tree and an ADT with isp or isp0, and run
the rule with the real dt_set_isp() in kboot_prepare_dt()'s order.

Assisted-by: LLM
Signed-off-by: Sean Dolbec <sdolbec1@gmail.com>
dt_copy_atc_tunables() gave an apple,t8132-atcphy node the T8132 USB3
bundle only under a J713 or J604 tree. The copy itself already decides
per PHY from the ADT: every required group must be present and well
formed, or nothing of the bundle is published and the PHY keeps its
USB2 fallback.

Drop the board list and the chip id test. The bundle goes to any tree
node that is apple,t8132-atcphy whose ADT node is atc-phy,t8132.

The host test runs the production copy on the four PHYs of a J773g ADT
under five board trees; hides one required group on one PHY; and tries
an ADT PHY of another type and a tree node of another type.

Assisted-by: LLM
Signed-off-by: Sean Dolbec <sdolbec1@gmail.com>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the boot-queue row on 24812c5. One more point, beyond the gating question already raised above: the J773g row from 11-19 shows a side effect of the USB3 calibration copy. On a rear port where the mini acts as the USB device, the role now fails (dwc3-apple 40a280000.usb: USB3 PHY setup failed, err=-95, then cable revalidation failed after 3 attempts), where before it ran as a USB2 device. When you rework the copy to run per atc-phy,t8132 PHY from its ADT bundle, could you also make sure device mode still comes up (fall back to USB2 when SuperSpeed device mode is refused, or point to the kernel change that handles it), and add a row with the mini as a USB device on a rear port? A host case for "bundle incomplete on one PHY, copied on the others" would pin the per-PHY refusal. Happy to help test.

@techmore
techmore force-pushed the m4/j773g-dt-adt-gates branch from 24812c5 to 53be821 Compare November 19, 2026 13:22
@techmore techmore changed the title kboot: add fail-closed J773g DT and ADT gates kboot: T8132 USB3 calibration, AOP handoff and absent-ISP rule by ADT property Nov 19, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for 53be821: the USB3 calibration now follows each atc-phy,t8132 PHY's ADT bundle, the AOP handoff no longer has a board list or OS pin, and the absent-ISP rule keys on the ADT alone, which is exactly the shape we were after. The one open item is the rear-port USB device-mode point from the follow-up above (fall back to USB2 when SuperSpeed device mode is refused, plus a row with the mini as a USB device on a rear port).

@techmore

techmore commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

The device-mode rows are in the description: a Thunderbolt/USB4 partner comes up on USB2 with aurora-silicon/linux#1702; a plain USB 3.x host needs aurora-silicon/linux#2420 (draft), with which the gadget enumerates at 480 Mb/s. A configured gadget does not re-enumerate after a software unbind and rebind; that happens without #2420 as well, so it is not caused by it. (Edited: the first version of this comment called that an open defect of #2420.)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for pointing to the device-mode rows and the two kernel changes; that answers the open item. We'll note that this should land together with or after aurora-silicon/linux#2420, so a plain USB 3.x host keeps a USB2 device role.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Heads-up after aura#304 merged into main (7dae354): tests/python/test_t8132_isp_absent.py in this PR no longer compiles against main. Its harness extracts dt_set_isp() but not the helper #304 added that dt_set_isp() now calls (the tree-driven isp_fdt_needs_init / placeholder-fill path). Found by the M4 mini (J773g) post-merge row; GitHub still says MERGEABLE because there's no text conflict. Please rebase onto main and extend the harness to pull in the new helper. On T8132, #304 already keeps the ISP off when the tree has no isp alias (J773g: ISP and its DARTs disabled, nothing binds), so check whether this PR's absent-ISP rule is still needed or is now covered by main.

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