Repository navigation
nvme: apple: restore the SART after a refused T8122 warm sleep - #3438
Closed
DjDeveloperr wants to merge 2 commits into
Closed
DjDeveloperr wants to merge 2 commits into
DjDeveloperr wants to merge 2 commits into
Conversation
On J615 a late refusal leaves ANS idle with RUN clear. The reset worker asserts the shared ANS reset and frees the old RTKit buffers. Removing their DMA ranges reads the SART while reset is asserted. Moving the read before reset would still expose it to the firmware's IDLE gate. Save the SART entries and gate while ANS is running. After the idle acks, stop mailbox delivery before clearing RUN. On a refusal pulse the reset, restore the gate and entries, and start a fresh handshake with the same buffers. Keep the syslog geometry too, since firmware may keep using its pre-sleep addresses without a new request. Use Oliver Gregory's retaining RTKit reinit from the non-warm ANS sleep fix in PR #3381. Only the refused warm path uses it here. The regular T8122 firmware wake still takes the warm handshake. Fixes: 038447c ("nvme: apple: skip T8122 warm sleep on dry runs and fall back on refused sleeps") Link: #3435 Link: #3381 Signed-off-by: DjDeveloperr <hey@djdev.me>
Contributor
Author
|
J516s (M3 Pro, T6030) at a019c98: PASS. Three s2idle cycles plus one NVMe controller reset. Every digest matched. No storage, RTKit, SART or SError errors.
|
The session reset now frees the buffers in its own helper, and apple_rtkit_reinit() wraps a session reinit that can keep them. The controls pulled only the old function names, so the generated harness no longer compiled and every mutation was reported as stale. Pull the helper and the session reinit too, where the driver has them. Older revisions still build as before. Signed-off-by: DjDeveloperr <hey@djdev.me>
Contributor
Author
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.
Refs #3435
What
On J615, a refused late T8122 warm sleep leaves ANS idle with RUN clear. The reset worker then asserts the shared ANS reset and frees the old RTKit buffers. Freeing them removes their SART ranges, and that reads SART MMIO while the reset is asserted and after ANS has acknowledged IDLE. That read is the SError in #3435. Moving the free before the reset would still leave the read behind the firmware's IDLE gate, so this patch keeps the buffers instead:
The RTKit helper that keeps the buffers across a reinit is the one from #3381 by Oliver Gregory, with one comment changed. This patch uses it only on the refused warm path. Whichever lands second should drop its copy of the helper.
Tested
drivers/nvme/host/apple.o,drivers/soc/apple/rtkit.oanddrivers/soc/apple/sart.obuild with AArch64 GCC 16.1.1,-WerrorandCONFIG_APPLE_SOC_SLEEP=y, with no warnings. Clang 23 context analysis prints the same 14 diagnostics for the base driver and for this patch.J615 test steps
Boot a one-shot kernel built from #3413 plus this patch, with its modules, the J615 DTB, serial or kmsg capture and an external recovery timer. Add these to the command line:
Then, as root, on an internal NVMe filesystem with 256 MiB free:
A pass shows
test: refused at the last check (refuse_late), the SART early-restore message andANS: recovered after refused sleepin the kernel log, the same boot ID, a live controller and matching digests. Repeat three times on one boot, settingrefuse_lateagain before each attempt (once it has been used, the next attempt really sleeps). The log must have no SError, RTKit boot, geometry or syslog errors, SART missing or full errors, I/O timeouts or filesystem errors. Also run a dry control withuntested_commit=0, which should print "dry run: every check passed".Risk
The change only affects T8122 when a warm sleep is refused. The early SART save also runs before a warm sleep that succeeds, and on that path the supplier skips its own late save. If the firmware asks for a different buffer size after the restart, the restart fails and I/O is held, instead of the controller being removed.
Not yet
nvme resetrow, to check the non-warm path is unchanged.