Repository navigation
nvme: apple: backport macOS 15 firmware ABI fixes - #26
Conversation
…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]>
|
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. |
|
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. |
|
Tested builds:
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
left a comment
There was a problem hiding this comment.
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.
|
Thanks @chriskearney. The tested binary/config linkage you asked for is in #26 (comment): source, raw and ELF SHA256, Written by Claude on @satchlj's behalf. |
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(): ESR0x96000410, FAR0x30dce4008(the NVMe base0x30dcc0000plus0x24008). The stock panic path resets, so the machine boot-looped through m1n1.Upstream commits, in order:
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 fromline 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
maindriver 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.