Skip to content

payload: support live ANS from older T8132 Stage 1 - #244

Closed
techmore wants to merge 2 commits into
aurora-silicon:mainfrom
techmore:techmore/upstream/aura-t8132-stage1-b8-ans-compat-20261114
Closed

techmore wants to merge 2 commits into
aurora-silicon:mainfrom
techmore:techmore/upstream/aura-t8132-stage1-b8-ans-compat-20261114

Conversation

@techmore

@techmore techmore commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

On T8132, stock U-Boot (e1ef8b636fc9) can only adopt a running ANS, while the deployed U-Boot
#38/#40 family (0ac2fb76985e, including 1b60b47ef6a2) can start ANS from off with
apple,sart-entries and refuses a running inherited session. Stage 1 1.0.0b10 and older hand Stage
2 a live ANS without entries; newer Stage 1 hands it off with nvme.sart=. Main gives the payload a
running ANS in both cases, which suits stock and fails the #38/#40 family.

Two commits on main eb66d6cd79a46ddcff85628599135a607fd70648:

  1. 9a6b0dfe (stable patch-id 0d4874f4c298) adds the T8132 takeover needed to turn an inherited live
    session into off plus entries. It stops the boot if takeover fails.
  2. 4678159e (stable patch-id 995147c6d070) chooses that off contract affirmatively. In default
    nvme.handoff=auto, Stage 2 requires the AArch64 U-Boot identity and the contiguous legacy
    apple,sart-entries consumer diagnostic (including its newline) present in the deployed kboot: name the product without its release date #38/Release aura 1.0.0b2 #40
    builds. Missing, unrelated, truncated, split, non-U-Boot, or invalid input falls back to main's
    running handoff. If a future off-only U-Boot changes that diagnostic, auto therefore logs that
    the signature was not found and hands ANS on running; that U-Boot will refuse the mismatched
    contract instead of booting Linux. Integrators can recover explicitly with nvme.handoff=off
    (or force the stock contract with nvme.handoff=running). The decision and reason are logged;
    boot= and other chips are unchanged.
Stage 1 handoff stock U-Boot U-Boot #38/#40 family
1.0.0b10 and older: ANS live, no SART entries running/adopted - exact v2c hardware boot reached Linux, NVMe root, Ethernet, and 10 CPUs with zero RTKit crashes taken over, off plus 10 entries - exact v2c hardware boot reached Linux, NVMe root, Ethernet, and 10 CPUs with zero RTKit crashes
1.0.0b11 and newer: ANS off, nvme.sart= started and running - host test only left off, saved entries passed - host test only

Host tests on 4678159e398d97f3e1e0b2ac906b7aa5308dd633 (tree 59ed6e9f633df7fd5ba9b4eb93a3b4e97a8f38d9): the four-cell table, auto|running|off and invalid-value
behavior, the reviewer's unrelated-string/non-U-Boot/truncated-or-short/split-boundary negatives,
takeover failure, boot=, other chips, and the real nvme_sart_entries() path. The table test is 8
failures when overlaid on the first commit alone; the exact v2 head has 71 focused passes. The full
Ubuntu 24.04 CI-equivalent job has gcc 809 passed (main 733) and clang 748 passed (main
672); its 31 / 91 failing or erroring IDs are exactly main's LeakSanitizer/host set.
make format-check passes. Stage 1 headroom is gcc 18152 B and clang 83920 B, unchanged from
main (18152 / 83920).

The hardware rows are one-shot ESP Stage 2 boots on the J773g with Stage 1 1.0.0b8; the live Stage 2
and installed default kernel are untouched. The stock tail is our own apple_m1_defconfig build of
e1ef8b63, not a shipped binary.

Not covered: a Stage 1 1.0.0b11 or newer (nvme.sart=) hardware boot; a direct appended Linux
kernel; other T8132 boards. The long-term ABI should be a versioned capability deliberately emitted
by U-Boot; this revision keeps a bounded legacy probe for the already-deployed unmarked builds.

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 techmore/upstream/aura-t8132-stage1-b8-ans-compat-20261114 branch from 9783b3d to 3de7351 Compare November 14, 2026 19:29
@techmore

Copy link
Copy Markdown
Contributor Author

Rebased onto main be9469167b919e45dc906e3dba1dda79cbe35dea (now 3de7351b65bfad60d6d75bee1905137f7b844a04). src/nvme.h conflicted only in context, next to the new nvme_cold_handoff() declaration; the added and removed lines are unchanged. Upstream's new ANS handling (bfefda98, 40cde2d0) quiesces or cold-starts ANS for XNU under sptm_virt and does not change this path.

Tests on this head: test_m3_defaults_optout.py 169 passed, 8 skipped; full pytest 725 passed, 52 skipped (main alone: 706 passed, 52 skipped).

Hardware (J773g Mac mini, macOS 26.6.2, Stage 1 1.0.0b8; each image installed on the ESP as a one-shot aura-try trial next to the untouched live Stage 2):

Not covered: unchanged from the description.

@FatBoy721

Copy link
Copy Markdown

Hardware result on a second J773g (Mac mini M4; Stage 1 aura 1.0.0b8, stub 26.6.2, stock Aurora U-Boot e1ef8b63):

A Stage 2 containing ccb99cd hangs before the payload. I built it from techmore/fix/aura-j773g-disp0-regions-20261114 (7fdadb3), with and without the TEST-ONLY 227c32f (keep ANS running). The aura-try marker is spent, Linux writes no logs, and the trial watchdog returns the Mac to the committed Stage 2.

The same tree without ccb99cd (b8461a8 + 083dbc3 + 79fcfc0 + 7fdadb3) boots 3/3 to apple-drm HDMI and G16 READY.

Happy to run a debug build or capture a console if that helps.

@techmore

Copy link
Copy Markdown
Contributor Author

Please hold this PR: the current head should not be merged.

@FatBoy721's result is consistent with an ANS handoff mismatch:

  • Aura Stage 1 through 1.0.0b10 hands the post-M4 ANS over live, without saved SART entries. Version 1.0.0b11 is the first release with the powered-off handoff.
  • On the T8132 non-boot= path, this PR makes Stage 2 take that live session over with nvme_init(), shut it down with nvme_shutdown(), and publish apple,sart-entries to the payload.
  • The reported stock Aurora U-Boot e1ef8b63 adopts a live ANS session and has no start-from-off path.
  • The post-M4 restart work in U-Boot #38 plus U-Boot #40 (0ac2fb76) starts from off using apple,sart-entries, removes live-session adoption, and rejects an inherited live ANS.

That makes the report consistent with the code: without this change, e1ef8b63 can adopt the live session; with this handoff, it receives ANS powered off and cannot start it. I have not yet reproduced the reported hang on our J773g with e1ef8b63.

I am working on a follow-up that chooses a handoff the appended U-Boot can consume, and I will boot it with both U-Boot generations before asking for review again.

Thank you for testing this. A console capture of the hang would help if it is easy to get, but it is not needed to proceed.

Dependencies: #113's branch is currently stacked on this PR's commit, so merging #113 as it stands would also bring in this change. #199 is stacked on #113's J773g work, the display-regions draft is stacked on #199, and the kernel side is linux #1192. I will either land the fix-up here first or rebase #113 so it no longer carries this commit, and I will say which on #113.

Identify the deployed legacy U-Boot consumer by its ARM64 header, version banner, and exact adjacent property/diagnostic string-table bytes. Add an explicit nvme.handoff override while making auto and invalid input fail toward the running-ANS contract.

Cover the four handoff cells and the review-blocking negative payloads, including unrelated, non-U-Boot, truncated, short, and boundary-split strings.

Assisted-by: LLM
Signed-off-by: Sean Dolbec <sdolbec1@gmail.com>
@techmore
techmore force-pushed the techmore/upstream/aura-t8132-stage1-b8-ans-compat-20261114 branch from 3de7351 to 4678159 Compare November 15, 2026 02:53
@techmore

Copy link
Copy Markdown
Contributor Author

@FatBoy721, thank you for the second-machine result. It exposed that the held revision gave stock
U-Boot the wrong ANS contract. Since the hold reply, I replaced that unconditional off handoff with
4678159e398d97f3e1e0b2ac906b7aa5308dd633: the previous commit rebased on main eb66d6cd79a46ddcff85628599135a607fd70648 (9a6b0dfe, stable patch-id 0d4874f4c298), plus
v2c 4678159e (stable patch-id 995147c6d070). The first fix-up then treated any exact
apple,sart-entries bytes as capability proof; the independent review correctly showed that
unrelated data or a non-U-Boot payload could still receive ANS off and reproduce the stock-tail
hang, so v2c removes that bare-string decision too.

Default nvme.handoff=auto now first identifies an AArch64 U-Boot image, then requires the exact
legacy property-plus-consumer diagnostic, including its newline, carried by the deployed #38/#40 builds. Any missing,
unrelated, truncated, split, non-U-Boot, or invalid input falls back to main's running handoff. An
integrator can explicitly select nvme.handoff=running|off. Stage 2 logs the mode, evidence, and
chosen state. If a future off-only U-Boot changes that diagnostic, auto logs the miss and selects
running, so the mismatch is visible and the U-Boot refuses rather than silently receiving ANS off;
nvme.handoff=off is the documented recovery override.

Stage 1 handoff stock U-Boot (e1ef8b636fc9) U-Boot #38/#40 family
1.0.0b10 and older: ANS live, no SART entries running/adopted - exact v2c hardware boot reached Linux, NVMe root, Ethernet, and 10 CPUs with zero RTKit crashes off plus 10 entries - exact v2c hardware boot reached Linux, NVMe root, Ethernet, and 10 CPUs with zero RTKit crashes
newer: ANS off, nvme.sart= started and running - host test only left off with saved entries - host test only

Host coverage includes the four cells, all override modes, the reviewer's four negative classes,
takeover failure, boot=, other chips, and the real SART-entry path. The exact v2 head has gcc
809 passed (main 733) and clang 748 passed (main 672) in the full Ubuntu 24.04
CI-equivalent job, with
exactly main's 31/91 failing IDs; format-check passes and Stage 1 headroom is unchanged at
gcc 18152 B / clang 83920 B.

Both hardware rows use the exact v2 tree on J773g Stage 1 1.0.0b8 as one-shot Stage 2 transports.
The newer-Stage-1 row remains host-test only. This is a compatibility bridge for already-deployed
unmarked U-Boots. I suggest an explicit versioned capability deliberately advertised by U-Boot as
the long-term ABI, so a diagnostic wording change cannot affect contract selection.

I am not asking for merge. The PR stays draft, and maintainers can decide whether and when to lift
the hold after reviewing this revision and its two hardware results.

@techmore

Copy link
Copy Markdown
Contributor Author

Closing: not needed. Stage 1 b13.1 with the current Stage 2 boots this machine without it.

@techmore techmore closed this Nov 19, 2026
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.

2 participants