]> www.infradead.org Git - nvme.git/commit
apple-nvme: Support coprocessors left idle
authorHector Martin <marcan@marcan.st>
Thu, 13 Feb 2025 16:12:58 +0000 (11:12 -0500)
committerKeith Busch <kbusch@kernel.org>
Tue, 18 Feb 2025 15:41:10 +0000 (07:41 -0800)
commit3f22421f6a240b33ab8ffbf662bf0a8f336f405b
treeb3ec7d712ffca5fedb96364a4ffb36a71bb8dc11
parenteefa72a15ea03fd009333aaa9f0e360b2578e434
apple-nvme: Support coprocessors left idle

iBoot on at least some firmwares/machines leaves ANS2 running, requiring
a wake command instead of a CPU boot (and if we reset ANS2 in that
state, everything breaks).

Only stop the CPU if RTKit was running, and only do the reset dance if
the CPU is stopped.

Normal shutdown handoff:
- RTKit not yet running
- CPU detected not running
- Reset
- CPU powerup
- RTKit boot wait

ANS2 left running/idle:
- RTKit not yet running
- CPU detected running
- RTKit wake message

Sleep/resume cycle:
- RTKit shutdown
- CPU stopped
- (sleep here)
- CPU detected not running
- Reset
- CPU powerup
- RTKit boot wait

Shutdown or device removal:
- RTKit shutdown
- CPU stopped

Therefore, the CPU running bit serves as a consistent flag of whether
the coprocessor is fully stopped or just idle.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Reviewed-by: Sven Peter <sven@svenpeter.dev>
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/apple.c