Skip to content

Commit 3053678

Browse files
committed
nvme-apple: Restart a stopped resident ANS without a PMGR reset
When a previous boot stage has run the ANS and stopped it cleanly, the driver finds CPU_CONTROL.RUN clear and takes its soft-reset path, which asserts the ANS reset. On post-M4 SoCs that assert raises an SError. The stopped firmware stays resident, so on these SoCs set RUN and run a fresh RTKit boot handshake instead, as U-Boot does, and keep the reset path for the older generations. This was tested on T8140 (MacBook Neo, J700) booting Linux from the internal NVMe through a chain whose first m1n1 stage runs the ANS and stops it (CPU_CONTROL.RUN clear, firmware still resident) before chainloading the stage that boots Linux. It does not recover an ANS that Linux itself has stopped: once Linux has shut RTKit down and cleared RUN, as suspend did, the RTKit boot after setting RUN again times out. Satya wrote this change for Aurora's tree on 2026-09-18, after the reset path raised the SError on his J700, and has been booting Omarchy from the internal NVMe with it since 2026-09-16. It is carried here with the restart message demoted to dev_dbg; his Signed-off-by is outstanding. (cherry picked from commit 711f8f6) Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
1 parent 9101a16 commit 3053678

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎drivers/nvme/host/apple.c‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,22 @@ static void apple_nvme_reset_work(struct work_struct *work)
11421142
if (!(readl(anv->mmio_coproc + APPLE_ANS_COPROC_CPU_CONTROL) &
11431143
APPLE_ANS_COPROC_CPU_CONTROL_RUN)) {
11441144

1145+
if (anv->hw->needs_ioq_registers) {
1146+
/*
1147+
* Post-M4 ANS cannot be reset through PMGR: the reset
1148+
* assert raises an SError. A previous boot stage that
1149+
* stopped the coprocessor cleanly leaves its firmware
1150+
* resident, so mirror the qualified U-Boot handoff:
1151+
* set RUN and run a fresh RTKit boot handshake.
1152+
*/
1153+
dev_dbg(anv->dev,
1154+
"post-M4 firmware handoff: restarting stopped ANS without reset\n");
1155+
writel(APPLE_ANS_COPROC_CPU_CONTROL_RUN,
1156+
anv->mmio_coproc + APPLE_ANS_COPROC_CPU_CONTROL);
1157+
ret = apple_rtkit_boot(anv->rtk);
1158+
goto booted;
1159+
}
1160+
11451161
ret = reset_control_assert(anv->reset);
11461162
if (ret)
11471163
goto out;
@@ -1162,6 +1178,7 @@ static void apple_nvme_reset_work(struct work_struct *work)
11621178
ret = apple_rtkit_wake(anv->rtk);
11631179
}
11641180

1181+
booted:
11651182
if (ret) {
11661183
dev_err(anv->dev, "ANS did not boot");
11671184
goto out;

0 commit comments

Comments
 (0)