Skip to content

spi: apple-qspi: admit the J700 GigaDevice boot NOR - #862

Merged
RyanTheTide merged 1 commit into
aurora-wipfrom
fix/j700-gd25uf16e-boot-nor
Nov 2, 2026
Merged

RyanTheTide merged 1 commit into
aurora-wipfrom
fix/j700-gd25uf16e-boot-nor

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Some J700s have a GigaDevice boot NOR. On those Macs RDID returns c88315, but the J700 entry admits only the Winbond W25Q16 (ef6515), so every NVRAM program and erase fails with -ENODEV and aurora-bless cannot select a boot volume. This builds on #724, which added a second JEDEC slot per board.

c88315 is the GigaDevice GD25UF16E (1.2 V, 16 Mbit). Its datasheet (DS-01151, Rev 1.0, 9Fh table: C8 83 15) gives the same geometry as the Winbond part: 2 MiB, 3-byte addresses, 256-byte pages, 02h page program and 20h 4 KiB erase. So the J700 partition [0x24000, 0x1f4000) and the mutation policy hold unchanged. Read (03h) runs up to 40 MHz even in low-power mode, above the DT's 25 MHz, and erase and program maximums (400 ms, 4 ms) are well inside the driver's 3 s poll. The status registers do differ:

Bit W25Q16 (Winbond check) GD25UF16E
SR1 bit 5 TB, left as found BP3
SR1 bit 6 SEC, left as found BP4
SR2 bit 2 reserved SUS2 (program suspend)
SR3 bit 2 WPS, refused LPE (low-power mode), configuration only

SR2 bit 7 is SUS (SUS1 on GigaDevice), bit 6 is CMP, and bits 5:3 are LB on both. QE is bit 1 on both and is fixed at 1 on the GD25UF16E. Under the Winbond check a GigaDevice part with BP3 or BP4 set, or with a suspended program, would have passed.

What changes

  • The J700 entry names the GD25UF16E in its second JEDEC slot.
  • apple_qspi_gd_status_allows_write(): WIP, WEL, CMP, SUS1 and SUS2 are refused. BP2 to BP0 are allowed only where the board allows them (0x1c on the J700, where iBoot leaves BP0 over the top 64 KiB). BP3 and BP4 are refused. SRP0, SRP1, QE, LB and SR3 stay as found.
  • apple_qspi_part_status_allows_write() picks the Winbond, Macronix or GigaDevice check from the manufacturer the flash reports.
  • flash_status prints all three registers for GigaDevice parts too.

The kernel default is unchanged: the NOR stays read-only until root opts in. aurora-silicon/aurora-bless#2 makes aurora-bless open that opt-in only around its own write.

Testing

  • tools/asahi/qspi-nvram-tests.py passes, also through run-host-tests.py --only qspi. New J700 GD25UF16E cases:

    • a verified program and erase with BP0 and QE set
    • SR2 and SR3 reads on the wire
    • SRP0, SRP1, LB and the SR3 bits left as found
    • refusals before WREN for WIP, WEL, BP3, BP4, CMP, SUS1 and SUS2, for BP0 where the board does not allow it, and for a different GigaDevice ID
    • the same SR1 bit 5 still admitted as TB on the W25Q16

    There are five new changed-guard controls: gd-dispatch, gd-bp34, gd-sus2, gd-cmp and j700-gd-id.

  • KUnit apple-qspi-nvram-policy passes 11 of 11 under UML, with new qspi_policy_gd_status and qspi_policy_part_status cases.

  • checkpatch.pl --strict is clean.

  • On our Neo (Winbond ef6515, jedec=ef6515 sr1=04 sr2=02 sr3=20), with fleet14o and this driver swapped in as a signed module:

    Result
    flash_status, read_only after load unchanged, Y
    Page 0 of the nvram partition written back unchanged, read_only=N no fault; SHA-256 of the partition 1360cd52... before and after
    aurora-bless --set-boot 2 -y (Aurora, already the default) with Open the boot NOR only around an NVRAM write aurora-bless#2, no manual opt-in rc=0 in 0.70 s; read-back equals the dry run on a copy (159 bytes, all 1 to 0, one bank, no erase); read_only back to Y; default and next boot still Aurora
    dmesg no NVRAM denied or write fault from the writes
    SELinux enforcing, no new AVCs

    An unchanged bless still appends one record, so the partition hash after it matches the dry run rather than the pre-bless image. The GigaDevice path needs a GigaDevice Neo; see below.

Test on a GigaDevice Neo

Run this on a kernel with this change and aurora-bless from aurora-silicon/aurora-bless#2. The steps take about a minute and change nothing: they set the default to the volume that is already the default.

cat /sys/bus/platform/drivers/apple-qspi/*/flash_status   # jedec=c88315 sr1=.. sr2=.. sr3=..
cat /sys/module/spi_apple_qspi/parameters/read_only       # Y
grep . /sys/class/mtd/mtd*/name /sys/class/mtd/mtd*/size  # nvram 1900544
sudo aurora-bless --list-volumes                          # * marks the default
IDX=$(sudo aurora-bless --list-volumes | sed -n 's/^\*\([0-9]*\)).*/\1/p'); echo IDX=$IDX
sudo dd if=/dev/mtd/by-name/nvram of=/var/tmp/nv-before.bin bs=64k status=none
cp /var/tmp/nv-before.bin /var/tmp/nv-dry.bin
sudo aurora-bless -d /var/tmp/nv-dry.bin --set-boot "$IDX" -y   # dry run on a copy
sudo aurora-bless --set-boot "$IDX" -y; echo rc=$?
sudo dd if=/dev/mtd/by-name/nvram of=/var/tmp/nv-after.bin bs=64k status=none
cmp /var/tmp/nv-dry.bin /var/tmp/nv-after.bin && echo MATCHES-DRY-RUN
cat /sys/module/spi_apple_qspi/parameters/read_only       # Y again
sudo aurora-bless --get-boot                              # same volume as before
sudo dmesg | grep -iE "NVRAM (denied|write fault)|qspi.*timed out" || echo no-qspi-faults

The expected results are rc=0, MATCHES-DRY-RUN, read_only back at Y, the same default volume, and no-qspi-faults. If flash_status shows SR1 bit 5 or 6 set, or SR2 bit 2, 6 or 7 set, the write is refused with EACCES by design. Please post the line in that case.

🤖 Generated with Claude Code

Some J700s carry a GigaDevice GD25UF16E boot NOR (RDID c8 83 15) in
place of the Winbond W25Q16 the board entry names. On those Macs every
NVRAM program and erase fails with -ENODEV, so asahi-bless cannot select
a boot volume.

The part is also 2 MiB, takes 3-byte addresses and uses the same 02h
page program and 20h 4 KiB erase, so the J700 partition and mutation
policy hold unchanged. Its status registers differ from Winbond:

- SR1 bits 6:2 are BP4 to BP0. Winbond has SEC and TB at bits 6:5,
  which the Winbond check leaves as found.
- SR2 bit 2 is SUS2, program suspend. It is reserved on Winbond.
- SR3 has no WPS. Bit 2 there is LPE, a low-power setting.

Name the part in the second JEDEC slot of the J700 entry and give
GigaDevice its own status check: WIP, WEL, CMP, SUS1 and SUS2 are
refused, BP2 to BP0 only where the board allows them, and BP3 and BP4
always on the J700. The check is picked from the manufacturer the flash
reports. flash_status prints all three registers for GigaDevice parts
too.

The bit layout is from the GD25UF16E datasheet, Rev 1.0 (DS-01151).

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide merged commit 0652b3b into aurora-wip Nov 2, 2026
@RyanTheTide
RyanTheTide deleted the fix/j700-gd25uf16e-boot-nor branch November 2, 2026 14:10
notmysegv pushed a commit to notmysegv/linux that referenced this pull request Nov 4, 2026
…nto integration/aurora

Bring integration/aurora up to the aurora-wip tip 9ff2b9a. After this
merge the two branches have the same tree.

The range contains the fleet14o source c243830 (aurora-silicon#857, aurora-silicon#858, aurora-silicon#795,
aurora-silicon#859), which was promoted on all four machines on 2026-11-02 and 03, and
the merges after it: aurora-silicon#861 (apple-dcp selftest stubs for aurora-silicon#858), aurora-silicon#860
(SEP keybag in the shared xART window, the aurora-wip copy of aurora-silicon#856),
aurora-silicon#724 (J616s boot NOR, both parts), aurora-silicon#779 (ALS colour temperature ABI),
aurora-silicon#862 (J700 GD25UF16E boot NOR, the Neo bless fix), aurora-silicon#863 (J616s ANE H16
start stall), aurora-silicon#797 (T6000 DCS whole-word writes) and aurora-silicon#803 (G17 keeps
innocent clients alive across another client's recovery).

aurora-silicon#858 and aurora-silicon#860 make the same changes integration/aurora already had as
aurora-silicon#855 and aurora-silicon#856, so they merge without conflicts.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
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