Skip to content

nvme: apple: backport macOS 15 firmware ABI fixes - #26

Merged
RyanTheTide merged 4 commits into
aurora-wipfrom
fix/apple-nvme-macos15-firmware
Nov 9, 2026
Merged

RyanTheTide merged 4 commits into
aurora-wipfrom
fix/apple-nvme-macos15-firmware

Conversation

@satchlj

@satchlj satchlj commented Oct 30, 2026

Copy link
Copy Markdown
Member

Backports four upstream U-Boot fixes from Janne Grunau for the Apple NVMe driver. Firmware installed with macOS 15 and later stops exposing the PRP NULL check control register at ANS+0x24008, and reading it raises an external abort. Older SoCs running that firmware hit this too.

Observed on an M3 MacBook Air (J613, T8122) running 26.6.2 firmware. U-Boot printed its model line, then took a synchronous abort in apple_nvme_boot(): ESR 0x96000410, FAR 0x30dce4008 (the NVMe base 0x30dcc0000 plus 0x24008). The stock panic path resets, so the machine boot-looped through m1n1.

Upstream commits, in order:

  • f31c5646ccac nvme: apple: Don't set a DMA direction for commands without a data transfer
  • bf7661a63cb9 nvme: apple: Never set the opcode in the NVMMU TCB
  • b63d271ae7c0 nvme: apple: Add WARN_ON_ONCE for non page-aligned admin queue buffers
  • b3f756587082 nvme: apple: Drop the PRP null check chicken bit

The upstream patches don't apply directly because this tree splits the TCB setup into pre-M4 and post-M4 branches. Each commit keeps the original author and trailers, plus a cherry picked from line and a short note on the adaptation. The post-M4 behaviour is unchanged: it already used opcode 0 and direction-specific flags. The pre-M4 path now matches upstream and the Linux driver.

Testing: two U-Boot builds from the same source (the current main driver is identical to 7680260) came out byte-identical, with this exact driver result. The hardware boot on J613 is still pending. The next attempt will run this U-Boot with diagnostics on, and results will be reported here.

…ansfer

Setting the DMA direction for commands that don't do any transfer likely
triggered the PRP NULL check for which we needed a chicken bit. That bit
has disappeared starting with macOS 15 so let's just do this correctly
instead.

Based on Linux kernel commit 94dd5804938d ("nvme-apple: Don't set a DMA
direction for commands without a data transfer").

Link: https://lore.kernel.org/asahi/[email protected]/
Fixes: 50333c9 ("nvme: apple: Add driver for Apple NVMe storage controller")
Signed-off-by: Janne Grunau <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Neil Armstrong <[email protected]>
(cherry picked from commit f31c5646ccac279d11e128b8c42e968847eb7df2 of u-boot/u-boot)
[satchlj: applied to the pre-M4 branch; post-M4 already clears flags without PRP1]
Signed-off-by: Satya Benson <[email protected]>
macOS always sets this to zero and the firmware starting with macOS 15
has started to complain about what we're doing here.

Based on Linux kernel commit cc0fec9b42cf ("nvme-apple: Never set the
opcode in the NVMMU TCB").

Link: https://lore.kernel.org/asahi/[email protected]/
Fixes: 50333c9 ("nvme: apple: Add driver for Apple NVMe storage controller")
Signed-off-by: Janne Grunau <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Neil Armstrong <[email protected]>
(cherry picked from commit bf7661a63cb9f2804cc8851f60686a490355a193 of u-boot/u-boot)
[satchlj: set opcode 0 once for both pre-M4 and post-M4 paths]
Signed-off-by: Satya Benson <[email protected]>
Apple controllers seem to require any queue buffers on the admin queue
to be aligned to the NVMe controller page size. Weirdly, this constraint
does not apply to the i/o queue where any alignment is fine. This has
always been required on pre-M1 controllers and is required starting with
macOS 15 firmware or post-M4 controllers again. On M1/M2/M3 there was a
chicken bit to disable this requirement.

U-boot appears to always use page-aligned buffers for the admin queue.
Add WARN_ON_ONCE to make it very obvious if/when that changes or wasn't
true to begin with.

Signed-off-by: Janne Grunau <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Neil Armstrong <[email protected]>
(cherry picked from commit b63d271ae7c034033a06e771e06d5a72cd41269d of u-boot/u-boot)
Signed-off-by: Satya Benson <[email protected]>
Now that we program the DMA direction correctly the NULL check that used
to make commands fail passes. Another side effect of this bit was that
non-align buffers on the admin queue were silently allowed and that's
been fixed now as well and we this don't need this chicken bit anymore.
More importantly, starting with the firmware installed with macOS 15,
which is required for M4 but can also be installed on the previous SoCs,
the controller no longer exposes this control register and any access
SErrors instead. Just drop the write entirely.

Based on Linux kernel commit 8ce883fd068b ("nvme-apple: Drop the PRP
null check chicken bit").

Link: https://lore.kernel.org/asahi/[email protected]/
Fixes: 50333c9 ("nvme: apple: Add driver for Apple NVMe storage controller")
Signed-off-by: Janne Grunau <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Neil Armstrong <[email protected]>
(cherry picked from commit b3f756587082dac42a828ed74b58f64ac4f336e5 of u-boot/u-boot)
[satchlj: context adjusted: the access lives in apple_nvme_boot() here]
Signed-off-by: Satya Benson <[email protected]>
@satchlj

satchlj commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

Hardware result: this driver boots on J613 (M3 MacBook Air) with 26.6.2 firmware. U-Boot 2026.07 with these four commits got past NVMe init where the unpatched build aborted at ANS+0x24008, served the ESP to Limine, and Linux 7.2.11 came up on the internal NVMe.

Unrelated to this PR: the built-in keyboard didn't respond in Limine on this machine. I'll look into it separately.

Written by Claude on @satchlj's behalf.

Copy link
Copy Markdown

Reviewing exact head 7e340d9. The later J613 boot result clarifies the body's earlier pending status. Could the author/agent record the tested U-Boot source commit and binary SHA256 (plus build config), and whether that boot used the normal packaged chain without diagnostic-only configuration? No firmware contents or machine-private data are needed. This will let us bind the reported NVMe→Limine→Linux success to these four adaptations rather than infer it from the version string.

@satchlj

satchlj commented Oct 31, 2026

Copy link
Copy Markdown
Member Author

Tested builds:

  • NVMe-only boot (C-diag2, 2026-10-30): aurora-silicon/u-boot 7680260 (the pin the packaging used at the time) + these four backports applied as one patch. The resulting drivers/nvme/nvme_apple.c is byte-identical to this PR's head 7e340d90; main's nvme_apple.c at 8295be11 is identical to 7680260's, but other files differ between those two (board: apple: Name the SPI keyboard spikbd in stdin #11). Raw u-boot-nodtb.bin SHA256 5551a88a9ce8dfb051bef7c1f637f6d9ddc1739711a42dc093f49eb922eaec80, ELF 127fbdad36612b62897934c50e4e5bc28c5f657877c4b24b55e062025480f7a4, .config 36ab9dff1b1d725702c8d0dfdc4a3d98c1bdcd91f856dc1057e2ade2b704c7c4. Diagnostic config differences from a normal build: BOOTDELAY=30, PANIC_HANG=y, CMD_WDT=y, ENV_IS_NOWHERE=y. Result: past NVMe init where the unpatched build aborted, ESP served to Limine, Linux up on the internal NVMe.
  • Later boots (C-diag5/6): 983ff193 = this PR's head + one J613 keyboard commit, BOOTDELAY=3, same other knobs. Raw SHA256 e46224bf65cd35218c4651e784527ebc19a9e5ff8854b6b8ed461cb54a5ba928, .config e9e7a812a1e2fa69e46bf2a4271cdb96efc63af70c122010fd974a6d28e0d86d.

Neither boot was the normal packaged chain: both used our custom stage1 and a diagnostic m1n1 build (framebuffer console, stage markers, halt instead of reboot). A packaged-chain boot will follow once this and the m1n1/kernel fixes land.

Written by Claude on @satchlj's behalf.

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

Reviewed 7e340d9 against main 8295be1. All four upstream changes are preserved through the local pre/post-M4 split: no direction for no-data commands, zero TCB opcode, admin-buffer alignment warnings, and removal of the unsupported ANS+0x24008 access. Post-M4 direction behavior and flush-before-doorbell ordering remain intact. No extra CLI opt-in is introduced.

Host checks extracted the actual submit function: 32 candidate route cases pass, the old base fails the changed pre-M4 expectations while its 16 post-M4 cases pass, and four targeted mutants are rejected. Apple builds run 41126728425 passed; the draft-release job was skipped.

Approving the source adaptation. These host checks do not establish hardware cache coherency or fleet compatibility. The later author boot report supersedes the body's pending wording, but exact tested binary/config linkage remains requested in comment 6537476595. No independent physical boot or GPU benchmark is claimed here.

@satchlj

satchlj commented Oct 31, 2026

Copy link
Copy Markdown
Member Author

Thanks @chriskearney. The tested binary/config linkage you asked for is in #26 (comment): source, raw and ELF SHA256, .config hash and the diagnostic config differences for both boots.

Written by Claude on @satchlj's behalf.

@RyanTheTide
RyanTheTide changed the base branch from main to aurora-wip November 9, 2026 11:15
@RyanTheTide
RyanTheTide merged commit aab6ca9 into aurora-wip Nov 9, 2026
2 checks passed
@RyanTheTide
RyanTheTide deleted the fix/apple-nvme-macos15-firmware branch November 16, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants