Skip to content

nvme: apple: restart ANS cleanly after a refused T8122 warm sleep - #3445

Merged
RyanTheTide merged 4 commits into
mainfrom
fix/t8122-nvme-refused-warm-sleep
Nov 28, 2026
Merged

RyanTheTide merged 4 commits into
mainfrom
fix/t8122-nvme-refused-warm-sleep

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What: On T8122, a warm sleep refused after ANS was idled now restarts ANS the way a refused firmware sleep does. The SART entries and power word are written back, and the old RTKit session's buffers stay kept until ANS acknowledges a clean RTKit shutdown. Before this, the refusal ended in an SError panic or a lost disk. Fixes #3435
Tested: J615 M3 Air 15" at 718d688: forced late refusal 3/3 recovered on the same boot (NVMe read/write + eDP OK), default cmdline boot + s2idle 3/3, 0 failed units. J413 M2 Air at 718d688 (second family, unaffected check): boot + s2idle 3/3, NVMe read + fsync'd write OK, 0 failed units. KUnit sart 79/79 on arm64 QEMU.
Risk: two-way · M3 (T8122) NVMe warm-sleep path; the SART replay change touches every Mac that replays SART entries after a firmware wake (M1, M2), covered by KUnit and the J413 row.
Not yet: a committed T8122 deep sleep that wakes (the J615 on 27.2 firmware doesn't wake from deep yet, a separate open issue); no M1 row.

Fixes #3435.

Problem. On T8122 the warm sleep (hw->warm_sleep) idles ANS (RTKit IDLE) and clears its run bit in .suspend, and keeps the RTKit session for the restart after the wake. If the sleep is refused after that, there is no firmware resume, so apple_nvme_t8122_warm_resume() falls back to the cold path in the reset work: reset assert, apple_rtkit_reinit(), deassert, boot. After a warm idle that path fails twice:

  1. The reinit is the first thing to free the session's buffers. It frees them through apple_nvme_sart_dma_destroy() → apple_sart_remove_allowed_region() → sart3_get_entry() while the SART is held in the ANS reset (T8122 shares it), and that is an asynchronous SError (Kernel panic - not syncing: Asynchronous SError Interrupt, nvme-reset-wq).

  2. With only (1) fixed, ANS doesn't come back: ANS did not boot, Reset failure status: -62, the disk is gone, and btrfs goes read-only and hangs. What the firmware-sleep start puts back (SART entries, mailbox enables) is needed after this reset; the SART power word itself read 0x1 before and after. The M1 class's firmware sleep (7dfc208) already handles the same thing for a refused sleep.

  3. Once restarted, ANS runs on its old session's buffers: it reports on (IOP/AP power 0x0 -> 0x20) without asking for new ones. Freeing them (before or after the boot) either lets it DMA into freed memory or, with their SART entries gone, blocks it and storage hangs.

Fix.

  • A refused warm sleep takes the same start as a refused firmware sleep. Before the warm idle, save the SART's entries (apple_sart_save_now()) and the NVMe block's SART power word, dropping them again if the idle fails. On the refusal (!pm_resume_via_firmware()), set fw_sleep_restart, so after the reset the reset work writes back the power word, the SART entries and the mailbox enables.
  • While that restart runs, the shmem_destroy callback keeps the torn-down session's buffers (allocated, in the SART and in used_entries) instead of freeing them. Nothing touches the SART inside the shared reset, and every entry written back is live.
  • The kept buffers are freed only after ANS acknowledges an RTKit shutdown (AP QUIESCED, IOP SLEEP), with the SART live. That's the point where the driver already frees its session's own buffers; every shutdown of a running ANS goes through apple_nvme_rtkit_shutdown(). If the shutdown fails or ANS isn't running, they stay kept. Every kept buffer is tracked on a list.
  • SART: a region removed after a firmware wake is dropped from the snapshot kept for apple_sart_replay(), so a later replay can't map reclaimed memory again. This also covers the session's own buffers. KUnit sart_test_replay_after_remove.
  • dev_dbg per SART entry written back from a snapshot (boot entries marked).

A committed warm sleep keeps its warm restart. The only change on that path: its SART snapshot is taken just before the idle instead of in the SART's suspend_late. No SoC, board or firmware gate: everything is under the existing t8122_warm_sleep / hw->warm_sleep state.

Rows. J615 (M3 Air 15", macOS 27.2 firmware). The kernel is this PR's two commits on top of #3413's head 66923b1, which adds the test-only apple_sleep.refuse_late (kernel 7.3.0-aurora-m3pr7+; the same patch on that base). The first table is from the first commit alone (m3pr4); the current head's rows follow it. DT-only trial with main's J615 DTB, GPU module blacklisted, apple_t8122_display.dcpext=0, apple_sleep.deep=1.

row before (#3413 head only) with this patch
deep, forced late refusal (refuse_late=1 + untested_commit) SError panic in sart3_get_entry (reset work) → reset 3/3: refused, 9 entries written back after a sleep that didn't happen, ANS boot and NVMe init completed, same boot; after each: eDP enabled, NVMe 4.3-4.9 GB/s O_DIRECT read, write + sync OK, / rw, btrfs device stats 0
with only the buffer-free part — ANS did not boot, reset failure -62, disk lost (why the SART restore is needed)
deep dry run every check passed every check passed, eDP enabled
deep commit reset 60 s after the commit unchanged (the open J615 27.2 wake issue, not NVMe)
default cmdline: boot smoke + s2idle 3/3 OK OK: rc=0 ×3, eDP enabled, NVMe 5.2 GB/s, Wi-Fi, MTP, Enforcing, 0 failed units; only the baseline dwc3 genpd_prepare -11 lines

Notes:

  • During the refused-sleep ANS boot, RTKit logs received syslog message but no syslog_msg_buffer three times: ANS logs into its kept syslog buffer, which this RTKit session has no record of. Harmless; the messages are dropped until the next full start.
  • One default-cmdline boot showed the eDP DPMS Off from boot. It did not reproduce on a fresh boot of the same kernel, and this patch doesn't touch display code.

Evidence (lab store): traces/power/20261128-m3-deepsleep/rows/pr4-summary.txt, pr3drl3/kmsg.log, pr2Drl/.

Rows at b0ced07 (m3pr7); the current head 718d688 (m3pr9) repeats them with the same results, see rows/pr9/:

  • refuse_late ×3, same boot: the boot entries 0–4 and 6 and the kept session entries 5/7/8 are written back. The session entries are the same live addresses in all three rows, with 0 removals and no new allocations. After each: read 4.4–4.9 GB/s, 64 MiB fsync'd write OK, eDP enabled.
  • Then s2idle: ANS allocates new buffers into 9/10/11, and after ANS booted successfully the kept 8/5/7 are freed. Disk OK (5.1 GB/s, write OK). Repeated once more: refuse_late keeps 9/10/11, the next s2idle allocates 5/7/8 and frees 9/10/11.
  • Default cmdline: smoke + s2idle 3/3 OK (5.1–5.2 GB/s, eDP enabled, Wi-Fi, Enforcing, 0 failed; only the baseline dwc3 lines).
  • Intermediate versions, for the record: freeing the buffers before the reset with a refreshed snapshot (m3pr5), or after the boot (m3pr6), both hang storage after the refusal. Evidence: traces/power/20261128-m3-deepsleep/rows/pr7/, pr5drl/, pr6rl/.

The T8122 warm sleep idles ANS (RTKit IDLE) and clears its run bit in
.suspend, and keeps the RTKit session for the restart after the wake.
When the sleep is refused after that (no firmware resume), the resume
falls back to the cold path in the reset work: reset assert,
apple_rtkit_reinit(), deassert, boot. That has two problems after a
warm idle:

- The reinit is the first to free the session's buffers. It does that
  through the SART, which on T8122 shares ANS's reset, so it reads a
  SART held in reset and takes an asynchronous SError:

    Kernel panic - not syncing: Asynchronous SError Interrupt
    sart3_get_entry
    apple_sart_remove_allowed_region
    apple_nvme_sart_dma_destroy
    apple_rtkit_reinit
    apple_nvme_reset_work_impl

- With that out of the way, ANS doesn't boot ("ANS did not boot",
  reset failure -62) and the disk is lost: in IDLE ANS gates its SART,
  and the reset drops its entries, as on the M1 class's firmware sleep.

Treat a refused warm sleep as that path already treats a refused
firmware sleep: save the SART's entries and the word that gates it
before the idle (and drop them again if the idle fails), and on the
refusal take the start after a firmware sleep (fw_sleep_restart: SART
power word, SART entries, mailbox enables). Free the session's buffers
before the reset assert, with the SART power word written back first.
A committed warm sleep keeps its warm restart; its SART snapshot is
now taken before the idle instead of in the SART's suspend_late.

Closes: #3435
Signed-off-by: Ryan Murray <[email protected]>

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

The refused-sleep path saves the SART table while the old RTKit buffers are still mapped. apple_rtkit_reinit() frees those buffers and removes their live entries, but apple_sart_restore_early() later replays the pre-idle snapshot. For SARTv3 the replay filter selects any saved nonempty entry, so it can restore a DMA mapping for freed memory and leave the hardware table inconsistent with used_entries. Refresh or invalidate the old session entries in the snapshot after teardown with SART powered and before asserting reset. Add a refused-sleep row that verifies that protected boot entries survive and all old session mappings stay absent until a fresh allocation claims them.

@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Merge readiness at 718d6882: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text, pr-text / pr-text
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok comment at 718d6882
Conflicts ok none
PR text no add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: area:platform

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

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Nov 28, 2026
… them

After a refused T8122 warm sleep, ANS comes back from the cold start on
its old session's buffers: it reports on (IOP and AP power 0x0 -> 0x20)
without asking for any new one. The previous change freed those buffers
early and then wrote their SART entries back from the pre-idle snapshot,
so ANS kept DMAing into freed memory through entries that used_entries
no longer accounted for. Taking the snapshot again after the teardown
instead removes the entries, and ANS's DMA is then refused: storage
hangs (seen on J615).

Keep them instead. While that restart runs, the shmem_destroy callback
stashes the torn-down session's buffers, still allocated and still in
the SART (and in used_entries), instead of freeing them, so the reinit
no longer reads the SART inside the shared reset either; the early
reinit and its SART power-word write go. The pre-idle snapshot written
back now holds only live entries. The kept buffers are freed (with the
SART out of reset) after a later start in which ANS allocates new
buffers: the next one with a full handshake, such as after s2idle. If a
start fails they stay kept, as ANS's state is unknown; buffers still
kept at removal are not freed.

Also log each SART entry written back from a snapshot (dev_dbg), with
the boot loader's entries marked.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Thanks, the stale snapshot was real, and worse than stale entries: chasing it showed what ANS actually does after this restart. Fixed in b0ced07 (new commit on top, no force push).

What ANS does. After a refused warm sleep, ANS comes back from the cold start on its old session's buffers. It reports on (IOP/AP power 0x0 -> 0x20) and asks for no new buffers. So at 243f979 it really was DMAing into freed memory, through entries that used_entries no longer covered. Your suggested refresh (re-snapshot after the teardown) removes those entries, and then ANS's DMA is refused and storage hangs. Rowed on J615: hung_task panic with I/O stuck in writeback. The same hang happens if the buffers are freed after the boot.

Fix. Keep them. While that restart runs, the shmem_destroy callback stashes the torn-down session's buffers instead of freeing them: still allocated, still in the SART and in used_entries. The snapshot written back therefore holds only live entries. The kept buffers are freed, with the SART out of reset, after a later start in which ANS allocates new buffers. That's the next full handshake, e.g. after s2idle. The early reinit and its power-word write are gone, because nothing reads the SART inside the shared reset any more. A dev_dbg per written-back entry (boot entries marked) gives the row its evidence.

Row you asked for (J615, exact tree, kernel 7.3.0-aurora-m3pr7+):

  • refuse_late ×3, same boot: each writes back the boot entries 0–4 and 6 (marked (boot)) plus the kept session entries 5/7/8. They're the same live addresses in all three rows, nothing is removed, and ANS comes back without allocating. After each: 256 MiB O_DIRECT read 4.4–4.9 GB/s, 64 MiB fsync'd write OK, eDP enabled.
  • Then s2idle: ANS does a full handshake and allocates 3 new buffers (entries 9/10/11). After ANS booted successfully, the kept 8/5/7 are removed and freed. Read 5.1 GB/s, write OK.
  • Again: refuse_late keeps 9/10/11 (0 removals); the next s2idle allocates into 5/7/8 and clears 9/10/11. Disk fine.
  • Default cmdline: smoke + s2idle 3/3 OK (5.1–5.2 GB/s, eDP enabled, Enforcing, 0 failed).

The M1 firmware-sleep path has the same snapshot/teardown ordering; filed as #3446 (not changed here).

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

Verdict: HOLD at b0ced070.

Blocker: drivers/nvme/host/apple.c:2173 treats any successful shared-memory allocation as proof that ANS has retired every retained mapping. RTKit handles buffer requests per endpoint. If a boot obtains a new crashlog buffer but still uses its old syslog or I/O-report buffer, the aggregate counter changes and the driver removes all of the old mappings while that boot can still use them. The boot-status check establishes that ANS initialized. It supplies no evidence about which endpoint buffers were replaced. Reclaim only replacements whose ownership the protocol establishes, or reclaim after a proven DMA-quiescent boundary. Please cover a partial replacement and a failed restart. Keep every retained allocation tracked so overflow cannot silently leave an unowned live mapping.

Checked: Read the full patch, RTKit allocation and reinit paths, and the J615 receipt. The refusal path now replays live entries, which resolves the original stale-snapshot finding. The receipt exercises zero replacements on refusal and all three replacements on the subsequent s2idle cycle. The partial replacement case remains unverified. Hosted checks and a second-family regression are pending.

The previous change freed the buffers kept from a refused warm sleep
after any start in which ANS allocated a new buffer. RTKit hands out
buffers per endpoint, so a start that replaces only some of them would
have freed others that ANS still uses.

Free them instead where the driver already frees its session's own
buffers: after ANS acknowledges an RTKit shutdown (AP QUIESCED, IOP
SLEEP), with its SART still out of reset. All shutdowns of a running
ANS go through apple_nvme_rtkit_shutdown() for that: the cold reset,
s2idle's suspend, removal and system shutdown. If the shutdown fails,
or ANS isn't running, the buffers stay kept.

Track every kept buffer in a list (__GFP_NOFAIL for the small node),
so that none can be left mapped without an owner.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Replies to the review of b0ced07. Fixed in b58b626 (new commit on top).

  1. Aggregate counter / partial replacement. Agreed: a new allocation doesn't show which endpoint stopped using its old buffer. Reclaim no longer depends on replacements at all. Kept buffers are freed only at a proven DMA-quiescent point: after ANS acknowledges an RTKit shutdown (AP QUIESCED, IOP SLEEP). That's the same point where the driver already frees its live session's buffers, with the SART still out of reset. Every shutdown of a running ANS goes through the new apple_nvme_rtkit_shutdown(): the cold reset, s2idle's suspend, removal and system shutdown. A partial replacement therefore can't free anything early. Whatever ANS still uses stays mapped until it is shut down.
  2. Failed restart. If the restart fails, shmem_defer is cleared and the kept buffers stay on the list. They are freed only by a later successful shutdown; if ANS never answers one, they are never freed. So a failure can't free memory ANS might still reach. I couldn't force a failed restart on hardware; this is from the code path.
  3. Tracking / overflow. The fixed array is gone. Every kept buffer is a node on kept_shmem (kmalloc(GFP_KERNEL | __GFP_NOFAIL), a small struct, process context), so none can be left mapped without an owner.

J615 rows at the exact tree (66923b1 + this PR, kernel 7.3.0-aurora-m3pr8+), one boot:

  • refuse_late: keeping RTKit buffer … ×3 (the live session), 9 SART entries written back, ANS on, no allocation. Two more refusals keep them (nothing new to keep). After each: 256 MiB read 4.5–5.2 GB/s, 64 MiB fsync'd write OK, eDP enabled.
  • s2idle: the three kept buffers are removed right after the shutdown, before the next RTKit: Initializing; then ANS allocates three new ones. Disk OK.
  • refuse_late again keeps the new three; the next s2idle frees them the same way. Disk OK.
  • Default cmdline: smoke + s2idle 3/3 OK (5.1–5.3 GB/s, eDP enabled, Wi-Fi, Enforcing, 0 failed).

Evidence: traces/power/20261128-m3-deepsleep/rows/pr8/ (seq.sh / seq.out + dmesg per step). A second-family regression (J473) is next.

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

Verdict: HOLD at b58b6264.

Blocker: The shutdown acknowledgement fixes the partial-replacement issue, but reclaim also has to retire the saved SART entries. Consider a refused warm sleep (buffers kept), then a successful firmware sleep (the live entries populate saved[] and resume makes replay_valid true), then a normal NVMe reset. apple_nvme_rtkit_shutdown() frees the kept buffers and clears their live entries. apple_sart_remove_allowed_region() leaves saved[] unchanged. The non-firmware reset path then calls apple_sart_replay(), and SARTv3's replay predicate accepts a nonempty saved entry even after used_entries has been cleared. This restores access to reclaimed memory.

Please retire the saved mappings as part of successful removal, or refresh the replay state at the quiescent, SART-live boundary before reset. Preserve protected boot entries and add a regression covering a successful firmware resume followed by reclaim and reset replay. The J615 refusal → s2idle row is useful, but s2idle clears replay_valid in late suspend and therefore does not cover that path.

Checked: Read the patch delta, RTKit shutdown and reinit, the legacy reset sequence, SART entry removal, the replay predicate and the J615 log. The new list removes the fixed-array overflow, and partial replacement alone no longer frees a kept buffer.

After a firmware-driven wake the SART keeps its snapshot for
apple_sart_replay() (replay_valid), which a coprocessor's driver calls
before it sets the run bit again, e.g. in the NVMe reset that follows a
later failure. A region its driver removed in the meantime, freeing the
memory behind it, stays in that snapshot, and the replay writes the
entry back: the coprocessor can reach freed memory again. With
nvme-apple, the buffers kept from a refused T8122 warm sleep and freed
after a later shutdown are one case; the session's own buffers, freed by
any RTKit shutdown after a wake, are another.

Drop a removed region from the snapshot while it is kept for a replay.
The bootloader's entries are never removed, so they stay. Before the
wake, while the snapshot still waits for it, nothing changes: that wake
writes back what was there when it was taken.

Add a KUnit case: snapshot, a removal before the wake (kept), wake,
removals after it (dropped; a protected entry can't be removed), power
loss, replay.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Reply to the review of b58b626. Fixed in 718d688 (new commit on top).

Replay of reclaimed regions. Agreed, and it isn't limited to kept buffers. After any firmware wake, the session's own buffers, freed by a later RTKit shutdown, stay in the snapshot that apple_sart_replay() uses. So the fix is in the SART: apple_sart_remove_allowed_region() now drops the region from the snapshot while it is kept for a replay (replay_valid). Protected boot entries can't be removed, so they stay. Before the wake, while the snapshot still waits for it, nothing changes: that wake writes back what was there when it was taken. So the M1 firmware-sleep restore path (#3446) behaves as before.

Regression for firmware resume → reclaim → reset replay. The J615 can't complete a firmware resume (the open 60 s post-commit wall), so the sequence is covered in KUnit: sart_test_replay_after_remove, for SARTv0/v2/v3/v4. It takes a snapshot, removes one region before the wake (kept), wakes, removes regions after it (dropped; removing a protected entry fails and it stays), then power loss and replay. Only the boot entry and the still-used region come back. On arm64 QEMU: 79/79 pass. With the new call disabled, the case fails on all four layouts.

Exact-head J615 rows (66923b1 + this PR, kernel 7.3.0-aurora-m3pr9+), unchanged from b58b626:

  • refuse_late ×3 keeps the three live buffers; then s2idle frees them right after the shutdown, before the next RTKit init, and ANS allocates three new ones.
  • A second refuse_late + s2idle round does the same.
  • After every step: 256 MiB read 4.4–5.2 GB/s, 64 MiB fsync'd write OK, eDP enabled; all on the same boot.
  • Default cmdline: smoke + s2idle 3/3 OK.

Evidence: traces/power/20261128-m3-deepsleep/rows/pr9/ (seq.out, dmesg per step, kunit-sart-v7.log). The second-family (J473) row is queued; the J473 is busy with REBOOT-HANG.

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

Verdict: MERGE at 718d6882 when hosted checks and landing evidence are recorded.

Checked: Successful SART removal now retires the matching saved mapping when replay is valid. Protected entries, unrelated entries and a snapshot still waiting for its wake are preserved. I compiled the exact helper in a small host fixture and verified those cases, including a matching address with a different length. The recorded arm64 KUnit run passed 79/79, including replay after removal. The J615 log verifies repeated refused entry, shutdown-boundary reclaim, fresh allocations after s2idle and working storage at this head.

This clears the replay finding. The completed firmware-resume sequence is covered by KUnit. Hosted checks and the independent-family J473 regression remain pending.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Second-family row: J413 (MacBook Air M2, T8112), same kernel 7.3.0-aurora-m3pr9+ (this head 718d688 on #3413's 66923b1), non-default one-shot on its production Stage 2. Boot: 0 kernel errors, Enforcing, 0 failed units. s2idle 3/3 rc=0; after each: NVMe 256 MiB O_DIRECT read 4.1 GB/s + 64 MiB fsync'd write OK, eDP enabled, Wi-Fi up, 0 errors. The SART shows the normal per-cycle churn (shutdown frees 3 session buffers, the restart allocates 3). Restored: fleet89 saved and running, test kernel removed, 0 failed. (J473 was held by REBOOT-HANG; J413 is the same SoC family.) Evidence: traces/power/20261128-m3-deepsleep/rows/j413-pr9/.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Nov 28, 2026
satchlj added a commit to satchlj/linux that referenced this pull request Nov 28, 2026
Keep .untested = true and .display_no_restart = true on t8122_sleep_soc
so /sys/power/mem_sleep remains [s2idle] by default until all T8122
deep-sleep prerequisites (aurora-silicon#3425, aurora-silicon#3504, aurora-silicon#3445, aurora-silicon#3452) have landed and
27.2-firmware T8122 boards (J615) have a matching display sleep path.

With .untested and .display_no_restart preserved, default s2idle and
apple_sleep.deep=1 dry runs stay intact on both 26.6.2 (J613) and 27.2
(J615), while committed J613 deep sleep runs via apple_sleep.deep=1
apple_sleep.untested_commit=1.

Signed-off-by: Satya Benson <[email protected]>

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at exact head 718d6882:

  • drivers/nvme/host/apple.c: deferring RTKit shmem buffer teardown via shmem_defer / kept_shmem across a refused T8122 warm sleep and releasing those buffers only after ANS acknowledges shutdown in apple_nvme_rtkit_shutdown() cleanly prevents tearing down buffers ANS still uses or touching the SART during shared reset. shmem_defer is properly cleared on both boot success and reset failure paths.
  • drivers/soc/apple/sart.c: apple_sart_forget_replay() retires non-protected removed entries from sart->saved[] once sart->replay_valid is set, preventing stale reclaimed mappings from being written back on a subsequent apple_sart_replay().
  • drivers/soc/apple/sart-test.c: sart_test_replay_after_remove covers pre-wake preservation, post-wake retirement, protected-entry immutability, and replay across SART versions.

(Looks like adding the Tested: and Risk: lines to the PR description is all that remains for pr-text / pr-readiness.)

@RyanTheTide
RyanTheTide merged commit 18058ea into main Nov 28, 2026
28 of 32 checks passed
@RyanTheTide
RyanTheTide deleted the fix/t8122-nvme-refused-warm-sleep branch November 28, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:platform Area from CODEOWNERS (bot) ci-failing A check failed at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nvme: apple: T8122 refused deep sleep panics in the reset's SART access (SError in sart3_get_entry)

2 participants