Skip to content

nvme: post-M4: start an ANS running from iBoot again from a reset - #593

Merged
RyanTheTide merged 9 commits into
mainfrom
fix/ans-stage1-fallback
Dec 1, 2026
Merged

RyanTheTide merged 9 commits into
mainfrom
fix/ans-stage1-fallback

Conversation

@erikwb

@erikwb erikwb commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What: A post-M4 stage that finds ANS running from iBoot (Stage 1 on the M4 MacBook Air, J713) gets a bounded handshake and the reset recovery a start from off has. Today that stage's one plain rtkit_boot() fails NVMe for the boot when the firmware sends no HELLO, and waits for the IOP power report forever when it says HELLO and then nothing. Stacked on #449 and on f547c53e (wip/ans-hello-then-silent): review the top three commits (compare).
Tested: J716c (M5 Max, T6050) at e3303b33: one-shot aura-try Stage 2 (ESP_STAGE2=1, installed alongside the default Stage 2, which was not touched) booted the default Linux 7.3.0 kernel to the desktop with the NVMe root and the RTKit endpoints (SMC, MTP, GPU) up, 1 failed unit (aurora-peripherals.service, also failed on the default boot; 0 new), 0 LSM denials (no SELinux or AppArmor loaded), 0 GPU or MMU faults, 0 Oops/WARN/SError lines, the same 41 kernel err+ lines as the default boot apart from which DCP node prints the md-manager service line, eDP-1 3456x2234@120, Wi-Fi 0% loss, and vkcube --c 240 --wsi wayland clean. J713 (M4 Air, T8132, 27.2 firmware, battery, default command line) at e3303b33: one-shot aura-try Stage 2 (ESP_STAGE2=1, 1.0.0b17-ge3303b33; default Stage 2 left untouched) booted Linux 7.3.0 to the desktop with the NVMe root up (nvme: ANS started from off, RTKit v12, IOP power state 0x20, non-regression of rtkit_wait_for_power() and Stage 2 NVMe paths; Stage 1 stayed at 1.0.0b17-gd82fa5db with nvme: entry RUN=1, so the running-ANS path was not entered), 0 failed units (system and user), 0 AppArmor denials, 0 Oops/WARN, eDP-1 2560x1664@60 enabled, and kernel err lines = baseline 3. Hosted CI at e3303b33: 19 successful, 11 skipped, 0 failing; local host tests (1526 passed in full run, 52/52 targeted NVMe/RTKit tests passed) and clang RELEASE=1 CHAINLOADING=1 builds (ESP_STAGE2=1, Stage 1, and Stage 1 with NVME_TEST_RUNNING_FALLBACK) pass at e3303b33.
Risk: one-way door: it ships in Stage 1, which a revert doesn't undo on a Mac that enrolled it · post-M4 Macs whose ANS has the split secure BAR (T8132, T6040, T6041, T6050, T8140, T8142), only when a stage finds ANS running from iBoot and its handshake fails. A handshake that works is unchanged.
Not yet: J713 Stage 1 rows at e3303b33 (requires machine-owner Stage 1 / 1TR enrollment): an enrolled Stage 1 built with NVME_TEST_RUNNING_FALLBACK (the reset path on a healthy ANS), then the real Stage 1 with warm reboots. No other post-M4 Mac. The real failure can't be produced on demand.

Details

Why. #449 recovers a start from off, which is what Stage 2 does on the J713. Stage 1 there finds ANS running from iBoot (nvme: entry RUN=1), skips that path and does one plain handshake. A did not receive HELLO was seen once on a J713 after a restart from macOS; which stage printed it wasn't captured. With NVMe down, Stage 1 can't load Stage 2 and stops in the proxy until the proxy fallback restarts the Mac, which resets ANS anyway.

rtkit: count a power report read just before the wait's deadline. rtkit_wait_for_power() checked its deadline before the state the last receive changed, so a report of the target state read by the call that reached the deadline became a timeout. It now checks the state first. Every RTKit power wait gets this.

nvme: post-M4: start an ANS running from iBoot again from a reset.

  • rtkit_boot_bounded() is rtkit_boot() with the IOP power report bounded. It doesn't wait for the AP power state and leaves the later timeouts as they were.
  • nvme_ans_boot_running() takes the handshake with the 6 s the other post-M4 starts give the report. A failed start is made again only when:
    • the firmware sent no HELLO, or HELLO and then nothing at all (nvme_ans_silent()),
    • the start granted it no buffers,
    • nothing arrives in the mailbox for another 0.5 s (one grace for either case), nor at a last look just before the stop. The mailbox is only looked at, so a late HELLO stays queued and stops the reset.
  • The restart resets ANS alone and starts it cold, as iBoot starts it, then once more after a power cycle of ANS and its PCIe block, through nvme_ans_reset_for_start() with iBoot's SART entries put back. The cold start asks this stage for new buffers, so nothing iBoot gave the firmware is used after the reset.
  • nvme_ans_reset_for_start() now stops ANS's CPU right after its last look and only then drains the mailbox (rtkit_stop()), for nvme: post-M4: start ANS again from a reset when its start from off fails #449's from-off resets too. A message sent as the CPU stops is logged and the reset goes on.
  • After a reset, a failure keeps the queues and needs a reboot. The SART snapshot is for the resets only and is dropped afterwards, so nothing reports ANS as powered off while it runs. A session that started from a reset is handed on as one that came running, like iBoot's, so the next stage's handoff (live on T6040/T6041) is unchanged.
  • Worst case added to a boot, with a firmware that stays quiet: about 20 s (the handshake and two cold starts, each 6 s for the report and 0.5 s of grace), two resets and one power cycle.
  • NVME_TEST_RUNNING_FALLBACK (test builds only) takes the reset path on a healthy ANS: no handshake, iBoot's session is idled instead, and ANS is reset only once the firmware acknowledged the idle.

M1-M3 and the adopted path are unchanged. The from-off start keeps its own retry selection (which failures take the reset path is unchanged), but it shares the two changes above that are not specific to a start from iBoot: nvme_ans_reset_for_start() stops ANS's CPU before it drains the mailbox, and every RTKit power wait counts a report read at its deadline.

Stack. The first five commits are #449's code commits, carried unchanged onto main e019f3e6, then f547c53e (restart a start that said HELLO and then nothing, the second J713 signature reported on #449). When #449 lands, main gets merged in here.

Evidence
  • Hosted CI at e3303b33fef2: 19 successful, 11 skipped, 0 failing (build, ESP stage 2 vital size, format-check, gcc, stage1-size across gcc/clang-macos/fedora/alarm/nix, Pytest across ubuntu/macos/arm, pr-text, readiness).

  • J713 (M4 Air, T8132, firmware 27.2, battery 50% to 43%, default command line) one-shot Stage 2 at e3303b33fef2: default Stage 2 (1.0.0b17-gf547c53e, m1n1/boot-ctxr-272.bin SHA-256 9a013b9c1b6c89d8766922671fe68418bc7c539c708d0a5c6981f9ff8cb89222) left in place; trial image = ESP_STAGE2=1 RELEASE=1 CHAINLOADING=1 aura.bin built at e3303b33fef2 (SHA-256 3e3242dfc4abdfb9df9ba0b38e5b4339300b0e086127f86ce85c9e60df6fa357) followed by the default image's device-tree and U-Boot tail (trial image SHA-256 7a0a5f5c0ea736a945a147cb84b5eef5148794ef9dbe3368ff2278cb5101ce91), armed once through aura-try (spent after boot). /proc/device-tree/chosen/asahi,m1n1-stage2-version read 1.0.0b17-ge3303b33; Stage 1 remained 1.0.0b17-gd82fa5db (nvme: entry RUN=1, so the running-ANS path of this PR was not taken). Stage 2 logged nvme: entry RUN=0 ... saved SART entries=9, rtkit(nvme): booting with version 12, IOP power state 0x20, nvme: ANS started from off, nvme: initialized, and Linux 7.3.0 mounted the NVMe root filesystem and reached the desktop (0 failed units system and user, 0 AppArmor denials, 0 Oops/WARN, eDP-1 2560x1664@60 enabled, kernel err lines = baseline 3). Restored: default Stage 2 hash unchanged, aura-try returned to its previous spent content, trial image removed.

  • J716c (M5 Max, T6050, firmware 27.2, AC 100%, default command line) one-shot Stage 2 at e3303b33fef2: aura.bin SHA-256 3e3242dfc4abdfb9df9ba0b38e5b4339300b0e086127f86ce85c9e60df6fa357 (ESP_STAGE2=1, built from the head), chained from the default Stage 2 through aura-try with the trial watchdog armed, then the default boot tail and the default Linux 7.3.0 kernel and DTB. The device tree's aurora,trial property named the chained trial Stage 2 path (aurora/<dir>/stage2.bin) the device tree's asahi,m1n1-stage2-version read 1.0.0b17-ge3303b33 (the head; the default Stage 2 reads 1.0.0b17-g42243c6b), and the aura-try marker went to spent; the default Stage 2 (SHA-256 b0a2f222b5a9151c201f5a89af4e13bae7078942bd14d1b7abcde941f30017b4) was not modified. NVMe: root on nvme0n1p10, nvme0n1 p1 to p11 enumerated. RTKit: SMC, MTP and GPU endpoints initialised (protocol version 12). Failed units: aurora-peripherals.service (1, same on the default boot). Kernel err+: 41 lines on both boots; only difference is the md-manager DCP service line printed for 302e00000 and 306e00000 instead of 392e00000, and one fewer shutdown watchdog line. 0 GPU fault/MMU fault/firmware-timeout/DeviceLost/recovery lines, 0 Oops/BUG/WARN/SError lines. This branch is based on main e019f3e6, so the trial Stage 2 does not carry the later main commits the J716c default Stage 2 has (42243c6b8); it was exercised on the default kernel only.

  • Clean merge check against origin/main (2a7854a30d16): git merge-tree --write-tree succeeds cleanly (a772b3c4bb5a, 0 conflicts).

  • Host tests at e3303b33: cd tests/python && python -m pytest -q -p no:cacheprovider . gives 1526 passed, 26 skipped, 2 failed (test_proxyclient/test_aura/test_loadobjs.py::test_tool_output_lines, ::test_run_tool, which need proxyclient tools the build host doesn't have and fail on the base too). Targeted re-run (test_nvme_ans_running_restart.py, test_rtkit_iop_power_silent.py, test_nvme_ans_warm_start.py, test_nvme_adoption.py, test_nvme_poisoned_io.py): 52/52 passed.

  • New tests/python/test_nvme_ans_running_restart.py (17 cases): clean start, BOOT_STATUS failure, no HELLO, HELLO then nothing, after a power cycle, never, cold start answers and fails, reset fails, answered, buffers granted, a message at each look (in the grace, before the reset, at the helper's look, as the CPU stops), and the test build with and without an acknowledged idle. The stubs fail any case that drains the mailbox before the CPU stop; putting the old order back fails 20 tests here and in test_nvme_ans_warm_start.py. test_rtkit_iop_power_silent.py gets power-on-at-deadline. test_nvme_adoption.py and test_nvme_poisoned_io.py take the new function into their extracted fragments.

  • make format-check with clang-format 20.1.8: clean (touched files also clean under clang-format 23.1.5).

  • Builds (clang, RELEASE=1 CHAINLOADING=1), the same warnings as the base:

    Build Room
    Stage 1 (ESP_STAGE2=0) code 12224 B, data headroom 61752 B
    Stage 1 with NVME_TEST_RUNNING_FALLBACK code 12128 B, data headroom 61752 B
    ESP Stage 2 (ESP_STAGE2=1) builds cleanly (aura.bin / aura.macho / aura-boot.macho)

fbalazsy and others added 9 commits November 29, 2026 13:44
pmgr_reset_held() is declared in every build but only built with
SPTM_VIRT. A Stage 2 needs it to reset an idle ANS, which refuses a
plain pmgr_reset(). Build it everywhere, and look the device up with
pmgr_find_device_by_name() as pmgr_reset() does, so that a virtual
child sharing its parent's name isn't picked.

Signed-off-by: František Balázsy <fbalazsy@users.noreply.github.com>
…ails

A post-M4 ANS whose CPU was stopped without a reset since it last ran
sends no HELLO after the run bit, then or later. A Stage 2 that meets it
in nvme_ans_power_on() stops with "ANS didn't start from off; it stays
down until a reboot" and parks in the proxy. On a J616s (T6040) the state
survived a watchdog reset taken while Linux had ANS stopped for sleep,
and every warm reboot after it; only a power-off cleared it.

Make that start again from a reset ANS, as XNU starts it: stop the CPU,
reset ANS alone through PMGR with its gate held on (pmgr_reset_held()),
drop what is left in the mailbox, put the SART entries back, and start it
warm (the HELLO the firmware sends unasked), then after another reset
cold (INIT, then HELLO). If that fails too, power-cycle ANS and its PCIe
block first and do the same once more. A start that granted the
firmware buffers isn't retried. Nothing changes when the first start
works.

J616s, Stage 2 with this change as an aura-try trial behind an installed
1.0.0b13.1 Stage 1, with a test-only hook that idles ANS (acknowledged)
and starts it from off again without its power-off or a reset: CPU
status 0x6e and "did not receive HELLO"; after the reset 0x6a, HELLO,
started in 0.12 s, and the boot went on to Linux.

Signed-off-by: František Balázsy <fbalazsy@users.noreply.github.com>
2945f30 ("pmgr: build pmgr_reset_held() outside the SPTM_VIRT build")
also changed how pmgr_reset_held() finds its device: virtual entries
became skipped. Its existing caller, the T8140 cold handoff, may then
pick another entry than before, and that wasn't checked there. Keep the
lookup as it was; the change only needs the function built everywhere.

Signed-off-by: František Balázsy <fbalazsy@users.noreply.github.com>
rtkit already records a start whose firmware sent no HELLO, for
rtkit_boot_or_adopt(). Give callers an accessor, so that they can tell
a firmware that never answered from one that answered and then failed
a later step of its start.

Signed-off-by: František Balázsy <fbalazsy@users.noreply.github.com>
110acee ("nvme: post-M4: start ANS again from a reset when its start
from off fails") resets ANS after any failed start from off. A start
also fails when the firmware sent HELLO and the endpoint map but its
power report didn't come in time, or when BOOT_STATUS didn't turn OK.
Such a firmware is running its resume, may be doing NAND work around
it, and must not be reset under it. Reset only when the failed start
got no HELLO at all (rtkit_no_hello()); any other failure stays on the
"stays down" path, as before that commit.

The cold start from a reset used rtkit_boot(), whose wait for the
power report has no limit: a firmware that says HELLO and never
reports would hang the stage. Use rtkit_boot_timed() with the 6 s the
warm start gives the same report. The comment no longer says where
the sequence was seen: it is the normal RTKit start.

Some machines name ANS's PMGR device ANS2, as nvme_ans_sleep_and_reset()
notes; the reset now tries both names. The gate listed for /arm-io/ans
is not used, since on T8140 it is the virtual APCIE_SYS_ST-V.

Worst case added to a boot: the recovery runs only after starts that
got no HELLO, each of which waits 1 s, so at most 4 s for the four
retried starts, four held resets (a PMGR mode change and 10 us each)
and one power cycle of ANS and its PCIe block. The last start then
has the limits every start has (1 s for HELLO, 6 s for each power
report, 1 s for BOOT_STATUS). There is no loop beyond the five starts.

J616s (T6040), this Stage 2 as an aura-try trial behind an installed
1.0.0b13.1 Stage 1, with a test-only hook that idles ANS (acknowledged)
and starts it from off again without its power-off or a reset:
- warm after reset: CPU status 0x6e, "did not receive HELLO"; after
  the reset 0x6a, HELLO, started 0.12 s after the reset.
- cold after reset (hook also skips the first reset): two starts with
  no HELLO, then the reset (0x6e -> 0x6a) and the cold start, started
  0.12 s after the reset.
- without the hook: the first start works and nothing else runs.
Each boot went on to Linux with NVMe working.

Signed-off-by: František Balázsy <fbalazsy@users.noreply.github.com>
On the J713 (T8132, firmware 27.2) a warm reboot can leave ANS answering
HELLO and the endpoint map and then sending nothing more: "timed out
waiting for IOP power state 0x20 (last 0)" after 6 s, CPU status 0x6e.
The no-HELLO narrowing leaves that start on the "stays down until a
reboot" path, so the boot stops in the proxy.

rtkit now records, for each boot attempt, whether its IOP power wait gave
up on the timeout (not on a receive error) with no message of any kind
read during the wait and no crash. Nothing else changes in a failed boot,
so DCP and the other RTKit users see the same behaviour as before.

nvme asks for more only when it would restart ANS:
rtkit_silent_after_power_wait() also requires the mailbox to stay empty
for another 0.5 s. It only looks at the mailbox and never reads it, so a
late message stays queued and nothing is handled (no buffer granted) on
the way to a restart. nvme_ans_silent() treats such a start like one with
no HELLO, and nvme_ans_reset_for_start() looks at the mailbox once more
just before the stop that would discard it. A firmware that reported any
power state, sent any message, or got as far as BOOT_STATUS is still left
alone.

The retry bounds are unchanged: at most five starts, four resets and
one power cycle, now up to 6.5 s each when the firmware stays quiet.

Signed-off-by: Erik Bourget <erik@ebourget.net>
rtkit_wait_for_power() checks its deadline after each rtkit_recv(), and
only then the state that receive may have changed. A report of the target
state handled by the call that reaches the deadline is then turned into a
timeout, and the start fails although the IOP answered in time.

Check the state first, so a report read within the deadline counts. A
wait that ends without one is unchanged.

Signed-off-by: Erik Bourget <erik@ebourget.net>
A stage that finds ANS running from iBoot (Stage 1 on the J713) gives it
one plain RTKit handshake. The from-off start's resets don't cover it:
a firmware that sends no HELLO fails NVMe for the boot, and one that
says HELLO and then nothing waits for the IOP power report forever,
since rtkit_boot() has no timeout.

rtkit_boot_bounded() is rtkit_boot() with the IOP power report bounded.
It doesn't wait for the AP power state and leaves the later timeouts as
they were, so a handshake that works is unchanged.

nvme_ans_boot_running() takes that handshake with the 6 s the other
post-M4 starts give the report. A failed start is made again only when
the firmware sent no HELLO, or HELLO and then nothing at all
(nvme_ans_silent()), the start granted it no buffers, and nothing at all
arrives in the mailbox for another 0.5 s (one grace for either case),
nor at a last look just before the stop. The mailbox is only looked at,
so a late HELLO stays queued and stops the reset. Otherwise ANS is left
untouched, as before.

nvme_ans_reset_for_start() now stops ANS's CPU right after its last
look and only then drains the mailbox (rtkit_stop()), for the from-off
resets too: before, the drain came first, and a message sent between
the look and the stop was dropped unseen. One sent as the CPU stops is
logged; the reset goes on, since the firmware is stopped by then. Without the restart the boot stops with NVMe down,
and the reboot that follows resets ANS as well.

The restart resets ANS alone and starts it cold, as iBoot starts it,
then once more after a power cycle of ANS and its PCIe block, through
nvme_ans_reset_for_start() with iBoot's SART entries put back. The cold
start asks this stage for new buffers, so nothing iBoot gave the
firmware is used after the reset. After a reset a failure keeps the
queues and needs a reboot, as for a start from off. The SART snapshot
is for the resets only and is dropped once they are done, started or
not, so nothing reports ANS as powered off while it runs. A session
that started from a reset is handed on as one that came running, like
iBoot's (it was started cold, as iBoot's is), so the next stage's
handoff is unchanged.

M1-M3 and the from-off and adopted paths are unchanged. Worst case
added to a boot, with a firmware that stays quiet: about 20 s (the
handshake and two cold starts, each 6 s for the report and 0.5 s
grace), two resets and one power cycle.

NVME_TEST_RUNNING_FALLBACK (test builds only) takes the reset path on a
healthy ANS: no handshake, iBoot's session is idled instead, and ANS is
reset only once the firmware acknowledged the idle.

Signed-off-by: Erik Bourget <erik@ebourget.net>
The host stubs kept cpu_stopped set after a reset's first stop, so a
later attempt that drained the mailbox before stopping ANS would have
passed. Clear it whenever a fresh RTKit instance is taken.

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb
erikwb marked this pull request as ready for review November 30, 2026 21:17
@erikwb
erikwb requested review from a team as code owners November 30, 2026 21:17
@erikwb
erikwb requested review from Acelogic and malik-na November 30, 2026 21:17
@github-actions github-actions Bot added blast:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) blast:neo Macs affected, from Merge risk (bot) door:one-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Merge readiness at e3303b33: ready to merge

Check Detail
CI at head ok 30 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at e3303b33
Conflicts ok none
PR text ok Risk: one-way · it ships in Stage 1, which a revert doesn't undo on a Mac that enrolled it · post-M4 Macs whose ANS has the split secure BAR (T8132, T6040, T6041, T6050, T8140, T8142), only when a stage finds ANS running from iBoot and its handshake fails. A handshake that works is unchanged.

Areas: none matched in CODEOWNERS
Merge: gh pr merge 593 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@aurora-silicon-review aurora-silicon-review 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.

Superseded 12-01: not a hold under the merge bar (no shown failure). Only metadata/CI checked; follow-ups: J713 forced-fallback reset row and Stage 1 warm-reboot rows

Verdict: HOLD at e3303b33

Blockers:

  1. Missing hardware verification for a one-way-door Stage 1 NVMe reset-recovery change. As noted under Not yet, no Mac has booted e3303b33 yet; Stage 1 enrollment requires the planned J713 hardware rows (NVME_TEST_RUNNING_FALLBACK exercising the reset path on a healthy ANS, followed by real Stage 1 warm-reboot cycles).

Checked:

  • Metadata, commits (02096c6f, 7a55e1da, e3303b33, +760/-33, 9 files), MERGEABLE against main.
  • All CI suites (build, test, format-check, stage1-size, esp-stage2-size, pr-text, aurora-agent-policy, pr-readiness) passed at e3303b33.
Evidence
  • CI is completely green; holding for J713 hardware testing of both the forced fallback reset path and real Stage 1 warm reboots.

@erikwb

erikwb commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Verified e3303b33fef2 locally and against origin/main (2a7854a30d16):

  • git merge-tree --write-tree origin/main e3303b33fef2 is clean (a772b3c4bb5a, no conflicts); live hosted CI at e3303b33fef2 is 19 successful, 11 skipped, 0 failing.
  • Local targeted NVMe/RTKit host suite (test_nvme_ans_running_restart.py, test_rtkit_iop_power_silent.py, test_nvme_ans_warm_start.py, test_nvme_adoption.py, test_nvme_poisoned_io.py) passed 52/52.
  • Local clang (RELEASE=1 CHAINLOADING=1 BUILTIN_LOGO=aurora) builds of ESP_STAGE2=1, Stage 1 (code 12224 B, data headroom 61752 B), and Stage 1 with -DNVME_TEST_RUNNING_FALLBACK (code 12128 B, data headroom 61752 B) succeeded.
  • #449 remains open; once it lands on main, main will be merged into this branch.
  • J716c (M5 Max, T6050): a one-shot aura-try ESP_STAGE2=1 Stage 2 built from e3303b33fef2 booted the default kernel cleanly (NVMe root and the SMC, MTP and GPU RTKit endpoints up, 0 new failed units, 0 LSM denials, 0 GPU/MMU faults, 0 Oops/WARN, the same kernel err+ set as the default boot apart from which DCP node prints md-manager); the default Stage 2 was left untouched.
  • J713 (M4 Air, T8132, firmware 27.2): a one-shot aura-try ESP_STAGE2=1 Stage 2 built from e3303b33fef2 (1.0.0b17-ge3303b33; default Stage 2 left untouched) booted Linux 7.3.0 to the desktop with the NVMe root up (nvme: ANS started from off, RTKit v12, IOP power state 0x20, non-regression of rtkit_wait_for_power() and Stage 2 NVMe paths; 0 failed units, 0 AppArmor denials, 0 Oops/WARN, eDP-1 2560x1664@60, kernel err lines = baseline 3); Stage 1 remained at 1.0.0b17-gd82fa5db (nvme: entry RUN=1), so nvme_ans_boot_running() was not entered.
  • Hardware still open: nvme_ans_boot_running() only runs when a stage finds ANS running from iBoot (!from_off), which on J713 (T8132) is Stage 1. Stage 1 enrollment (NVME_TEST_RUNNING_FALLBACK and warm reboots on J713) requires machine-owner approval (1TR) and remains under **Not yet:**.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 1, 2026

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

Reviewed the bounded handshake, reset admission, SART restoration, and queue preservation on failed recovery. The Stage 2 boots and host checks are recorded. Merge still needs the owner-run J713 Stage 1 forced-fallback and normal warm-reboot rows, plus size verification on the current base.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 1, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at e3303b33fef2 (B2 merge train, 12-01 merge bar). Approval at this head: DjDeveloperr. Row: in the PR body at e3303b3. CI: aura train A5 = main 34534c5 + #593: gcc normal + ESP_STAGE2 build pass, CI-gcc 13.3 stage1_size pass (esp-stage2 headroom 7416 B), pytest 1782 passed Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit d577aaa into main Dec 1, 2026
35 checks passed
@RyanTheTide
RyanTheTide deleted the fix/ans-stage1-fallback branch December 1, 2026 15:55
@erikwb

erikwb commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up on J713 (M4 MacBook Air, T8132, firmware 27.2):

Enrolled a RELEASE=1 CHAINLOADING=1 ESP_STAGE2=0 Stage 1 built from main 0745e344 (1.0.0b18-70-g0745e344, carrying #432 and #593) via 1TR on J713 (with Stage 2 1.0.0b18-gd8eb8ad4 and Linux 7.3.0):

  • Cold boot after 1TR enrollment: reached Linux cleanly (nvme0n1 up at 0.57s, 0 NVMe/ANS errors, 0 failed units).
  • Warm reboot (systemctl reboot): came back cleanly to Linux in 23s (nvme0n1 up at 0.53s, 0 NVMe/ANS errors, 0 failed units, kernel err+ lines unchanged from baseline).
  • Not run: the fault-injected -DNVME_TEST_RUNNING_FALLBACK Stage 1 build.

fbalazsy pushed a commit to fbalazsy/aura that referenced this pull request Dec 2, 2026
On the M4 Mac mini (J773g, T8132), 1 boot in 7 the ANS warm start after
the Stage 1 hand-off answers HELLO and the endpoint map, then crashes
before its IOP power report (CPU status 0x68), and the next stage has no
NVMe (aurora-silicon#613). Two gaps:

- The crash report is lost. A warm start grants no crash log buffer, so
  rtkit_crashed() returned at "IOP crashed!". The crash message names the
  buffer the earlier stage granted; under SART its address is physical.
  Read the log from it when the whole buffer lies inside one SART entry
  (the entries the earlier stage set, put back before the start), never
  anywhere else, and never free it. sart_covers() does the check.

- The start isn't retried. Since aurora-silicon#593 a warm start that got HELLO and then
  nothing is reset and made again (warm, cold, power cycle), but a crash
  message counted as "answered" and stopped that. A warm start that
  crashed before reporting power, with no buffer granted by this start
  (rtkit_crashed_in_warm_start()), now takes the same reset ladder: the
  firmware isn't resuming, and the session holds no queue or grant.

Host tests: the RTKit harness gains a warm start through a SART whose
firmware crashes after the endpoint map, with its log inside and outside
the SART entry.

Link: aurora-silicon#613
Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blast:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) blast:neo Macs affected, from Merge risk (bot) door:one-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants