Skip to content

spi: apple-qspi: admit the J773g's GigaDevice boot NOR - #2625

Closed
DjDeveloperr wants to merge 1 commit into
mainfrom
djdev/qspi-j773g-gd25uf64e
Closed

DjDeveloperr wants to merge 1 commit into
mainfrom
djdev/qspi-j773g-gd25uf64e

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

The J773g (Mac mini, M4) entry in the boot NOR table assumed the J713's Winbond W25Q64 (ef6517). A J773g actually carries a GigaDevice GD25UF64E:

flash_status: jedec=c88317 sr1=00 sr2=02 sr3=20

apple_qspi_nvram_modify() therefore refused every program and erase with -ENODEV, so asahi-bless could not save the NVRAM on the mini, even with read_only=N.

This PR admits the GD25UF64E as the J773g's part and keeps the W25Q64 as the second ID, the same pattern as the J616s and J700 entries. The existing GigaDevice status rule already covers the part: SR1 has no block protection and SR2 has only QE, so bp_ok stays 0. A KUnit case for that status is added.

Tested on a J773g (27.2 firmware, 7.3.0-ARCH-m4drv8)

The patched file is byte-identical to the mini kernel's, apart from this change. It was built as an external module against that kernel, signed with its key and swapped in at runtime.

  • After the swap the flash and its contents are unchanged: same flash_status, same /dev/mtd2ro hash.
  • With read_only=N:
    • asahi-bless --next --set-boot "Macintosh HD" -y returned 0, and --get-boot --next read back Macintosh HD (default Trace).
    • asahi-bless --clear-next -y returned 0, and --get-boot --next read back Trace.
  • read_only was set back to Y afterwards. A full NVRAM backup was taken first.

Before the fix, the same asahi-bless --next failed with ENODEV on save and left the NVRAM unchanged.

Superseded by #2817 and #3099, which admit the J773g NVRAM partition and its GigaDevice boot NOR through the generic QSPI policy.

The J773g entry assumed the J713's Winbond W25Q64 (ef6517). A Mac mini
(M4, J773g) reads a GigaDevice GD25UF64E instead:

  flash_status: jedec=c88317 sr1=00 sr2=02 sr3=20

so every program or erase failed the JEDEC check with -ENODEV and
asahi-bless could not save the NVRAM, even after read_only=N.

Admit the GD25UF64E as the J773g's part and keep the W25Q64 as the
second ID, as the J616s and J700 entries do. The GigaDevice status rule
already covers this part: SR1 has no block protection set and SR2 has
only QE, so bp_ok stays 0. Add that status to the KUnit cases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Diljit Singh <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Looks right. The GD25UF64E is 8 MiB, so the 1 MiB window at 0x700000 fits. It uses the same 05h/35h/15h status registers and program/erase commands as the parts already admitted, and the existing GigaDevice rule reads SR1 0x00 / SR2 0x02 as unprotected, which the new KUnit case pins down. Keeping the W25Q64 as the second ID follows the J616s and J700 entries, and every other T8132 board keeps the J713's part. The before/after asahi-bless --next and --clear-next round trip, with read_only restored to Y, is the right test.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merge-train adversarial review (MERGETRAIN-LINUX2) at aff2742: NO BLOCKERS.

Code read only, nothing built here. Before the merge it still needs Dj's verdict at this head; the missing rows are listed below.

Full review

#2625 spi: apple-qspi: admit the J773g's GigaDevice boot NOR @aff2742b

VERDICT: NO BLOCKERS

Blockers: none.

What I checked:

  • drivers/spi/spi-apple-qspi.c:146-148: the J773g row now has primary c88317 and alt ef6517.
  • :744-745: the JEDEC gate accepts either ID.
  • :750-755: apple_qspi_part_status_allows_write() then picks the rule from the manufacturer byte the flash itself reports (0xc8 -> the GD rule in spi-apple-qspi-policy.h:93-98). For the reported sr1=00 sr2=02, !(0x00 & 0x03) && !(0x00 & 0x7c) && !(0x02 & 0xc4) is true, so the write is allowed. SR3 is read but not checked on the GD path.
  • bp_ok is shared by both IDs and is 0. That is correct for the W25Q64 alt too: the Winbond rule refuses any BP bit.
  • The J773g DT gets the nvram partition <0x700000 0x100000> from t8132-jxxx.dtsi:147-150, through t8132-desktop.dtsi:12. That matches the row, so nvram_write_candidate is reached (:1039-1045).

Nits:

  1. Commit aff2742 carries Co-Authored-By: Claude Opus 5.5. Pushed history: leave it.
  2. spi-apple-qspi-policy.h:83: the GD rule's comment still names only the "GigaDevice GD25UF16E". It now also covers the GD25UF64E, so name both or say "GD25UFxxE".
  3. This extends the existing per-board of_machine_is_compatible() JEDEC table (:123-160). It is not a new gate. But the safety comes from the JEDEC check plus the per-manufacturer status rule, so a per-part allowlist would cover the next mini or iMac without another per-board row. Follow-up, not this PR.
  4. The board comment at :141-145 says "others may carry the J713's part". No J773g has been seen with the W25Q64, so the alt ID is an assumption, the same as the J604/J623/J624 rows.

Missing rows:

  • The only proof is on 7.3.0-ARCH-m4drv8 with an external module swapped in at runtime. Needed: a J773g on the fleet kernel at tip with this commit built in, default cmdline. Run the same asahi-bless --next / --clear-next round trip with read_only=N, then read_only=Y again, and confirm flash_status and the /dev/mtd2ro hash are unchanged afterwards.
  • The PR body does not show a run of the KUnit case added to spi-apple-qspi-policy-test.c:184-185 (kunit.py run of the qspi policy suite).
  • No other board's row changed, so J713/J715/J616s/J700 need no new row.

@github-actions github-actions Bot added needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) merge-conflict Conflicts with the base branch (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-conflict Conflicts with the base branch (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.

2 participants