Repository navigation
payload: start a post-M4 ANS an earlier stage powered off before any payload - #213
Conversation
…payload Since adf5580 a stage that used a post-M4 ANS powers it off and passes its SART entries on as nvme.sart=. An ESP Stage 2 that boots its embedded U-Boot never runs nvme_init(): it only writes the entries to the DT as apple,sart-entries and leaves ANS off. The U-Boot we embed adopts a running post-M4 ANS and can't start one from off, so with a Stage 1 that passes nvme.sart= it fails to probe NVMe: Failed to probe 'nvme@3cdcc0000': err=-19 When nvme.sart= arrived and this stage hasn't started ANS, start it in payload_run() and hand it on running for every payload, as the boot= path already does for Linux. kboot_prepare_dt() then sees a running session and passes no apple,sart-entries, and main()'s nvme_shutdown() leaves the controller and RTKit running. A payload with no nvme.sart= gets ANS as before: as this stage found it, or powered off with the entries passed on if this stage used it. M1-M3 and T8152 never get nvme.sart= and don't change. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Tested on a J616s (M4 Pro, T6040), Stage 1 1.0.0b10-g2296392f, with aura-try one-shot trials. Each trial loads an intermediate stage in place of the configured Stage 2: a packaged 1.0.0b13 ESP Stage 2 (f0f180a) with a
Stage 2 log from the passing trial: The Linux rows match the production boot: Enforcing, no failed units, no AVCs, no DART faults, NVMe namespaces 1 to 3, 4 USB buses with 8 devices, eDP and DP, Wi-Fi, H.264 and HEVC encode. The one difference is that iomem shows 47.5 MiB more reserved (375.9 vs 328.4 MiB). That is the retained heap of the extra aura stage, which holds ANS's buffers. With the old Stage 1 ( Still to do: the same chain on a T8140 (J700). |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Codex (GPT-6.1 Sol), reviewing on @DjDeveloperr’s behalf.
Source review at aaec599, with a second independent review: no blocker found. The new predicate is a saved off-session handoff check; nvme_init() still validates the actual hardware state. The embedded-payload branch starts ANS before preparing the DT, boot= retains its existing path, and chainload= returns through its unchanged path. Successful initialization precedes setting the keep-running flag. The DT reserves the live SART ranges without advertising an off-session, and final main() shutdown validates the live controller/ASC before preserving it. Initialization failure prevents the payload handoff; existing DMA-retention/reboot-required guards remain, and later preparation failure clears keep-running before shutdown.
Verified successful build, Stage 1 size, format, policy and pytest jobs. The GCC job131782399536 actually reports 724 passed/25 skipped; the description's668/50 is the author's separate local run. The new payload harness cases run in that suite; I performed no local build or physical trial.
Ryan's6849586907 J616s report is useful affected-hardware evidence: one-shot b13 intermediate Stage 2 simulates the b11+ off-session handoff, the old second Stage 2 fails to boot NVMe, exact aaec599 boots Linux from NVMe, and the old b10 running-session path still boots. This is not an enrolled Stage 1 replacement test. The extra47.5MiB reservation is attributed to the intermediate-stage retained heap, not a measured cost of the normal two-stage chain.
Leaving this pending the already planned Neo/T8140 result before final merge review. The existing installer/catalog hold through a released fix remains; this review changes no distribution pin or loader. U-Boot#40's current removal of apple_nvme_adopt() contradicts the live-session contract here and remains incompatible; #38 retains that adoption path. No new hardware run requested by this review.
|
[Joshua's agent] Review at aaec599: no blocking defect, OK as a compatibility bridge. Checked:
Two notes, neither needs code beyond a comment:
Not covered by tests: the Not verified: hardware beyond the author's T6040 run. We have no T6050 result for this change; our M5 boots b12 straight to Linux, not via U-Boot. |
Since adf5580 (in 1.0.0b11 through 1.0.0b13) an aura stage that used a post-M4 ANS powers it off and passes its SART entries on as
nvme.sart=. An ESP Stage 2 that boots its embedded U-Boot never runsnvme_init(), so ANS stays off and kboot only writes the entries to the DT asapple,sart-entries. The U-Boot we embed (aurora-wip 25cbb0f0) adopts a running post-M4 ANS and has no start from off, so a Stage 1 from b11 on plus any b11 to b13 Stage 2 leaves U-Boot without NVMe on M4, M4 Pro/Max, T8140 and T6050:A Stage 1 from b10 or earlier passes ANS on running (
nvme.adopt) and isn't affected.Change
In
payload_run(), whennvme.sart=arrived and this stage hasn't started ANS (nvme_post_m4_passed_off()), start it withnvme_init()and hand it on running for every payload, as theboot=path already does for Linux:kboot_prepare_dt()sees a running session: it reserves the SART ranges and writes noapple,sart-entries.main()'snvme_shutdown()leaves the controller enabled and RTKit running, which U-Boot'sapple_nvme_adopt()takes (CC.EN set, so T6040/T6050 skip the handshake path too).Without
nvme.sart=nothing changes: ANS goes on as this stage found it, or powered off with the entries passed on if this stage used it. M1-M3 and T8152 never getnvme.sart=.aurora-silicon/u-boot#38 (U-Boot starts ANS from
apple,sart-entries) is the other way to close this. With this change in Stage 2, U-Boot with or without #38 gets a running session.Compatibility scope: this is a bridge to the existing running-session consumers, not completion of the preferred restart-based handoff design. The new branch applies to every non-
boot=kernel+FDT payload with saved off-session SART state, including a directly embedded Linux payload; it is not restricted to U-Boot.boot=keeps its own existing path, andchainload=returns through its earlier path.The bridge cannot be retired merely because U-Boot #38 or #40 merges. The receiving restart paths and supported old/new Stage 1, Stage 2, U-Boot and Linux pairings need qualification first. U-Boot #40's current removal of running-session adoption is incompatible with this head.
Tests
tests/python/test_m3_defaults_optout.py: the realpayload_run()on the host, both builds (plain andCHAINLOADING+ESP_STAGE2): withnvme.sart=on a post-M4 part the payload gets a started ANS with no shutdown before the handoff; a failed start stops the handoff; withoutnvme.sart=, and on pre-M4, the old path.nvme_post_m4_passed_off()and does not exercise the real predicate. Its new ANS tests cover initialization failure, but notboot_failedcleanup after a successful ANS start. Those paths were source-reviewed; passing this harness is not dynamic proof of them. Joshua reports a surviving cleanup mutation; this review did not independently rerun that mutation.tests/python: 668 passed, 50 skipped.