Skip to content

arm64: dts: apple: t6050: share the K boards' NVRAM, writable - #3383

Merged
RyanTheTide merged 2 commits into
mainfrom
k114s/nvram-writable
Nov 27, 2026
Merged

RyanTheTide merged 2 commits into
mainfrom
k114s/nvram-writable

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem

aurora-bless --next and --set-boot fail on the K114s with EACCES, even as root. /dev/mtd3 "nvram" has no MTD_WRITEABLE, because t6050-k114s.dts marks the partition read-only. The K114c's partition is read-only too ("until a later change lifts it"), and the K116s and K116c describe no boot NOR at all. The J616s, J713 and J700 leave the partition writable, and blessing works there (the J615 keeps its own read-only, as it has no NVRAM write entry yet). Lanes need one-shot blesses on the K boards.

Change

One device-tree commit. The boot NOR and its NVRAM partition move into t6050-k114-k116.dtsi, without read-only, together with the nvram alias. The live K114s, K116s and J716c ADTs and the K114c and K116c 27.2 DeviceTrees all give /arm-io/qspi/spinor/anvram at 0x700000, 0xc0000 bytes. The flash is single-wire, as on the K114s and J775D. spi-apple-qspi is unchanged: it still starts read-only, and after root opts in it only admits bounded, verified programs and 4 KiB erases inside this partition, on a flash part it knows.

Tested: DTB checks only so far. All 11 T6050 DTBs were built and compared with main. K114s and K114c lose read-only (the K114c also states the single-wire default), K116s and K116c gain the NOR and its partition, and the other seven are byte-identical. dtschema shows the same messages as main (0 new).

Risk: two-way · K114s, K114c, K116s, K116c: the NVRAM partition becomes writable through spi-apple-qspi's verified write path (root opt-in, known part, NVRAM banks only). K116s/K116c also start probing the boot NOR.

Still to run

  • K114s: /dev/mtd* "nvram" writeable, the qspi part accepted, aurora-bless --next --set-boot "Macintosh HD" then a reboot lands in macOS once, and the next boot is back on Aurora.
  • K116s / K114c / K116c rows from their owners, if they can.

asahi-bless and aurora-bless cannot set the next boot on the K114s:
the DT marks its NVRAM partition read-only, so MTD never sets
MTD_WRITEABLE and every write fails with EACCES, even as root. The
K114c's partition is read-only too, and the K116s and K116c describe
no boot NOR at all. Every other Mac with a boot NOR leaves the
partition writable.

The live K114s, K116s and J716c ADTs and the K114c and K116c 27.2
DeviceTrees give the same NVRAM: /arm-io/qspi/spinor/anvram at
0x700000, 0xc0000 bytes. Describe it once in t6050-k114-k116.dtsi,
single-wire as on the K114s and J775D, without read-only, with the
nvram alias. spi-apple-qspi still starts read-only; once root opts in,
it admits only bounded, verified programs and 4 KiB erases of a known
part inside this partition.

The K114s and K114c DTBs lose read-only (the K114c's flash also
states the single-wire default), the K116s and K116c gain the NOR and
its partition, and the other seven T6050 DTBs are byte-identical.
dtschema reports nothing new.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide requested review from a team as code owners November 27, 2026 12:54
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

@joshuaswarren this lifts the read-only you put on the K114c's nvram partition in 18cfec4 ("until a later change lifts it"). On the K114s the same property makes aurora-bless --next fail with EACCES (mtd flags 0x800), which blocks one-shot boots there. The flash write gate is spi-apple-qspi's, unchanged: it starts read-only, and root has to opt in before it allows checked programs and 4 KiB erases inside the 12 NVRAM banks of a known part. Is there a K114c reason I'm missing for keeping it read-only? A K114c row at this head would be very welcome (cat /sys/class/mtd/mtd*/flags for the nvram partition, then an aurora-bless --next round trip).

The shared NVRAM comment said every other Mac with a boot NOR leaves the
partition writable; the J615 keeps its own read-only. Name the Macs whose
writable partitions these follow (J616s, J713, J700) instead, and point
the K114s header at the partition's new place.

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

Copy link
Copy Markdown
Contributor Author

Independent adversarial review at 715ef4b (author side, not the merge review): no blockers.

  • Write path: dropping read-only changes only the MTD partition flag and the driver's window setup (apple_qspi_window_valid). Every flash write still goes through apple_qspi_exec_op (spi-apple-qspi.c:954-971), which starts read-only. Root can opt in only after probe, and a write fault switches it back for good. Even then, only 0x02 page programs and 0x20 4 KiB erases inside the window, on a known part, after the 12-bank header check, with read-back. Status-register writes, 4-byte mode, reset, OTP and larger erases are refused. spi-nor's unlock-at-probe and quad-enable don't look at the partition flag, and they would get EACCES anyway.
  • Geometry: the live K114s, K116s and J716c ADTs give anvram 0x700000 + 0xc0000 (12 x 64 KiB, 4 KiB aligned). It doesn't overlap the firmware or syscfg regions, and the spinor nodes are identical, 25 MHz included. aura's dt_set_nvram rewrites reg/status from the ADT anyway.
  • Checks: dtschema on the four K DTBs: 0 warnings. qspi's clock and power domain come from t6050-die0.dtsi, and no K116 file touches &qspi.

Nits addressed in a6e5536: the comment no longer claims every other Mac is writable (the J615 keeps its own read-only), and the K114s header now points at the partition's new place.

Open: the K boards' NOR part ID isn't recorded anywhere yet. If it isn't one of the driver's known parts, bless fails with "part" (ENODEV) instead of EACCES: still safe, but not fixed. The K114s row will show which one it is.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

K114s (14-inch M5 Pro, 27.2 firmware), part 1 of the row: the K114s DTB from Aura Stage 2 with this PR's effect (the nvram partition no longer read-only, nothing else changed). Kernel 7.3.0-42, plain reboot.

  • Before: /sys/class/mtd/mtd3 "nvram" flags 0x800 (no MTD_WRITEABLE). aurora-bless --next fails with EACCES.
  • After: flags 0xc00 (writeable), size 786432 (0xc0000), DT partition has no read-only.
  • Flash: flash_status jedec=c88317 (GigaDevice GD25UF64E, in spi-apple-qspi's known-part table), sr1=00 (no block protection). read_only module parameter still Y at boot, so writes still need root's opt-in.
  • System: SELinux Enforcing, 0 failed units, internal display up.

Part 2, the aurora-bless --next --set-boot "Macintosh HD" round trip, follows.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

K114s row, part 2: on the same boot, aurora-bless --next --set-boot "Macintosh HD" from Linux succeeded, and the next reboot took the one-shot entry (00:07, seen on the debug link about 22 s later). Before this change it failed with EACCES. The default entry stays Aurora; the reboot back into it after the one-shot follows when the other lane next restarts the Mac.

@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 a6e55368ddb3, once dt-checks and host-tests finish green and the K114s aurora-bless --next round trip (part 2) is posted.

Blockers: none.

Checked: read the whole diff and spi-apple-qspi's write gate; built all 11 T6050 DTBs at main and with this PR and compared them; checked the NVRAM geometry and the flash clock against the live K114s, K116s and J716c ADTs; confirmed aurora-bless opens the driver's write window itself, so nothing manual is needed on the default command line; ran the CI device-tree checks locally; no gates, no attribution.

Evidence
  • Semantic DTS diff, main 2d96d922 vs main plus this PR: K114s loses read-only only. K114c loses read-only and gains explicit single-wire (spi-rx/tx-bus-width = <1>, the same as its default). K116s and K116c gain qspi okay, flash@0 (jedec,spi-nor, 25 MHz, single-wire), the 0x700000/0xc0000 nvram partition and the nvram alias. The other seven T6050 DTBs are unchanged.
  • ADT: /arm-io/qspi/spinor/anvram reg = 0x000c0000_00700000 (offset 0x700000, size 0xc0000) in the live K114s, K116s (Axboe) and J716c ADTs. The spinor reg's second word is 0x19 = 25, matching spi-max-frequency = <25000000>.
  • Write path: dropping read-only only lets MTD set MTD_WRITEABLE. spi-apple-qspi still starts with read_only=Y; apple-nvram's WriteWindow (aurora-bless) clears it for the write and restores it, and the driver admits only page programs and 4 KiB erases inside the nvram partition of a known part, latching read-only on a fault. The J616s, J713 and J700 work the same way.
  • K114s part 1 (00:07, this DTB effect only): mtd nvram flags 0x800 -> 0xc00, GD25UF64E (jedec c88317, a known part), SR1 00, Enforcing, 0 failed.
  • Not blocking: the K116s and K116c gain a NOR probe that nobody has booted yet (Axboe / Joshua rows, already under Still to run). The probe is a JEDEC read, and writes still need the known-part gate.
  • Local CI device-tree checks (scripts/dtc/apple-dt-check.sh, dtschema 2026.9, main 2d96d922 vs main plus this PR): 139 DTBs both sides, 1188 = 1188 warning lines, 0 new, 0 removed. apple-dart-pd-check: 0 new. CI's own dt-checks run is still queued.
  • Merge order: this conflicts with #3376 (t6050-k114s.dts) and #3363 (t6050-k114c.dts). Merge this first; its CI is already queued, and those two take main afterwards.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

K114s row, round trip complete: the other lane booted its macOS guest five times tonight (00:07-00:33), each time with aurora-bless --next --set-boot "Macintosh HD" from Linux on this change's DT. Each one-shot was taken. In between, the Mac came back to the Aurora default (where the next --next was run), so the one-shot doesn't stick and the default stays Aurora. The NVRAM part of this row is done.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Non-author merge-train review at a6e55368: MERGE.

Checked

  • The boot NOR and its NVRAM partition (anvram at 0x700000, 0xc0000) move into the shared K dtsi without read-only, plus the nvram alias, matching the J616s, J713 and J700 where blessing already works. The 7 J/other T6050 DTBs are byte-identical.
  • The single-wire bus width means no quad-enable status write at probe on the K116s/K116c NOR they now gain.
  • spi-apple-qspi is unchanged: it starts read-only, and after root opts in it allows only 0x02 page programs and 0x20 4 KiB erases inside the partition, on a known part (GD25UF64E here, sr1=00), with read-back. A fault switches it back to read-only for good.
  • Rows: K114s at this head. mtd3 becomes writable, and aurora-bless --next --set-boot works where it gave EACCES before. Five one-shot macOS boots each returned to Aurora as the default. Enforcing, 0 failed units.
  • CI green (dt-checks, host-tests). KREVIEW and the review bot approved.

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.

1 participant