Repository navigation
nvme: apple: restart a pre-M4 ANS that the previous stage left running - #23
Merged
Merged
Conversation
After some reboots of the M1 Pro and the M2, U-Boot cannot bring the NVMe up and the Mac cannot boot. The previous stage (aura Stage 1) asks the ANS to sleep, stops its CPU and resets it. When the sleep request times out, the CPU is left with RUN set and the reset lands under it, possibly with the late answer still queued in the mailbox. U-Boot then sets RUN on a CPU that is already running and asks for INIT, but the first message is not HELLO, so apple_rtkit_boot() fails. Every later probe does the same. Finish the stop the previous stage could not, as Linux does before it restarts the coprocessor: when RUN is already set, drop queued messages, clear RUN, drop anything that arrived meanwhile and reset the block through its PMGR reset. A stopped ANS still gets its stale messages dropped. If the firmware does not start, do that once more and try again before giving up. A clean handoff takes the same path as before. test/py: a host model of the ANS (HELLO only after a fresh start, a FIFO that keeps what it last sent) covers a clean handoff, a timed out sleep with RUN set, a stale message, one failed start and a dead firmware. Dropping the stop from either path fails it. Assisted-by: LLM Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After some reboots of the M1 Pro (T6000) and the M2 (T8112), U-Boot cannot bring the NVMe up, so the Mac cannot boot Linux. Retrying from the U-Boot prompt fails the same way.
Cause
aura Stage 1 hands the ANS over by asking it to sleep, stopping its CPU and resetting it. Since aura 1.0.0b1, the sleep request sometimes runs past its 1 s bound. The firmware finishes its GC bitmap rebuild and saves its context first, which takes 0.4 to 0.55 s on the M2 by its own log. When the request runs over, Stage 1 logs
rtkit(nvme): IOP power transition timed outand resets the ANS with CPU_CTRL.RUN still set. The late answer may still be queued in the mailbox.apple_nvme_boot()then sets RUN on a CPU that is already running and sends INIT.apple_rtkit_boot()requires HELLO as the first message, so it fails, and every later probe does the same. The aura side is fixed in aurora-silicon/aura (fix/ans-shutdown-handoff). This PR lets U-Boot recover with the Stage 1 that is already installed, which needs a 1TR visit to replace on these machines.Change
This is the same recovery Linux's apple-nvme runs before it restarts the coprocessor:
resetsin the DT).Tests
test/py/tests/test_apple_nvme_restart.pyruns on the host with--noconftest. It builds the driver's realapple_nvme_boot()against a model ANS that sends HELLO only after a fresh start and keeps its last message in the FIFO. It covers a clean handoff, a timed-out sleep with RUN set, a stale message, one failed start and a dead firmware. If the stop is removed from either path, the timed-out case fails.u-boot-nodtb.bin701,720 B.🤖 Generated with Claude Code