Skip to content

spi: apple-qspi: fix J873g nvram partition size and admit W25Q80 (ef6514) - #3441

Merged
RyanTheTide merged 2 commits into
aurora-silicon:mainfrom
sithglan:feat/j873-qspi-nvram
Dec 1, 2026
Merged

RyanTheTide merged 2 commits into
aurora-silicon:mainfrom
sithglan:feat/j873-qspi-nvram

Conversation

@sithglan

Copy link
Copy Markdown
Contributor

What: Fix the J873g (Mac mini, M6) nvram partition size in arch/arm64/boot/dts/apple/t8152-j873-qspi.dtsi from 0x1d0000 (2 MiB J700 copy that wrapped past 0x100000 onto syscfg) to 0xd0000 (13 × 64 KiB banks 0x24000..0xf4000, matching the J873g ADT), and admit the J873g's Winbond W25Q80 boot NOR (ef6514, sr1=00 sr2=02 sr3=20, physical size 0x100000, bp_ok=0, factory SFDP BFPT 0x00ffffff = 0x200000) in spi-apple-qspi with full KUnit and host mutation-test coverage.

Tested:

  • Mac mini (M6, J873g, T8152), firmware 27.2, Linux 7.3.0-aurora-j873-main-1127+:
    • Confirmed physical 1 MiB wrap-around before the DT fix: mtd0[0x000000:0x0d0000] == mtd0[0x100000:0x1d0000] byte-for-byte, and mtd0[0x0dc000] (abs 0x100000) reads "iPCB" (0x000000 syscfg).
    • With the fixed DT (0x000000024000-0x0000000f4000 : "nvram", mtd0: 000d0000):
      • Default read_only=Y refuses asahi-bless --next --set-boot (NVRAM denied: reason=read-only).
      • With read_only=N, spi-apple-qspi qualified all 13 banks (nvram window [0x24000, 0xf4000): 13 stores, writes in [0x24000, 0xf4000), part ef6514), set --next to "Macintosh HD" and read it back (default=LinuxStub next=Macintosh HD), then restored --next to "LinuxStub" and read it back (default=LinuxStub next=LinuxStub), and re-armed read_only=Y, with zero faults or errors.
  • Host checks:
    • ./tools/testing/kunit/kunit.py run ... apple-qspi-nvram-policy: 17/17 passed.
    • python3 tools/asahi/qspi-nvram-tests.py: all tests + all changed-guard mutation controls (including sfdp-size, j873g-w25q80-id, j873g-w25q80-size) passed.
    • make ARCH=arm64 CHECK_DTBS=y apple/t8152-j873g.dtb: zero QSPI/MTD/partition warnings.

Risk: two-way door — shrinks t8152-j873-qspi.dtsi's nvram partition to match the J873g ADT (preventing wrap-around onto syscfg), and adds W25Q80 (ef6514) with strict 1 MiB physical bound, bp_ok=0, and exact SFDP 0x200000 match; default remains read_only=Y, no existing part's policy changes.

Not yet: None.

Details
  • arch/arm64/boot/dts/apple/t8152-j873-qspi.dtsi: change nvram reg from <0x24000 0x1d0000> to <0x24000 0xd0000> (matching ADT /arm-io/qspi/spinor/anvram and /chosen/nvram-bank-count = 13).
  • drivers/spi/spi-apple-qspi-policy.h & drivers/spi/spi-apple-qspi.c: add optional sfdp_size to struct apple_qspi_part + apple_qspi_part_sfdp_size(), and add APPLE_QSPI_JEDEC_W25Q80 ({ 0xef, 0x65, 0x14 }, size = 0x100000, bp_ok = 0, sfdp_size = 0x200000).
  • drivers/spi/spi-apple-qspi-policy-test.c & tools/asahi/qspi-nvram-tests.py: cover W25Q80 status (00/02/20), BP0 refusal, 1 MiB physical bound (refusing oversized 0x1f4000 window before WREN/SFDP), SFDP mismatch refusal, and mutation controls.
Evidence
  • flash_status: jedec=ef6514 sr1=00 sr2=02 sr3=20
  • SFDP BFPT: ptp=0x80 dw1=0xfff920e5 dw2=0x00ffffff (0x200000), physical wrap at 0x100000
  • Live dmesg:
    • 0x000000024000-0x0000000f4000 : "nvram"
    • spi-nor spi0.0: NVRAM denied: reason=read-only opcode=06 addr=0x0 addr_bytes=0 len=0 width=1 addr_width=0 dummy=0 dir=0 ro=1 candidate=1 fault=0
    • spi-nor spi0.0: nvram window [0x24000, 0xf4000): 13 stores, writes in [0x24000, 0xf4000), part ef6514
  • KUnit apple-qspi-nvram-policy: Ran 17 tests: passed: 17
  • python3 tools/asahi/qspi-nvram-tests.py: exit 0 (PASS W25Q80 J873g part, PASS j873g-w25q80-id, PASS j873g-w25q80-size, PASS sfdp-size)

…0xd0000)

The J873g (Mac mini, M6) boot NOR is a 1 MiB Winbond W25Q80 (ef6514),
not a 2 MiB J700 part. Its ADT /arm-io/qspi/spinor lists ranges
0x100000 and anvram reg <0x24000 0xd0000> (13 x 64 KiB banks, matching
/chosen/nvram-bank-count = 13), with syscfg at 0x0..0x24000.

With the previous copied J700 length (0x1d0000, ending at 0x1f4000),
reads past 0x100000 wrapped back to 0x0 ('iPCB' syscfg header at offset
0xdc000 in mtd0, and banks 0x124000..0x1f4000 byte-identical to
0x24000..0xf4000). Fix the nvram partition to <0x24000 0xd0000>.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
…ition can be written

The J873g (Mac mini, M6) boot NOR reads JEDEC ID ef 65 14 (Winbond
W25Q80, 8 Mbit / 1 MiB) with no block protection left set:

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

Hardware reads confirm the chip physically wraps at 0x100000 (0x100000
aliases 0x000000 'iPCB', and 0x124000..0x1f4000 mirrors 0x024000..0x0f4000),
matching ADT /arm-io/qspi/spinor ranges = 0x100000 and anvram
[0x24000, 0xf4000) (13 banks of 64 KiB). However, its factory SFDP BFPT
encodes 16 Mbit (DWORD 2 = 0x00ffffff -> 0x200000).

Add an optional sfdp_size field to struct apple_qspi_part (defaulting
to size when 0) and admit W25Q80 with physical size 0x100000, bp_ok 0,
and sfdp_size 0x200000. The physical size still bounds window_end
(refusing any oversized 2 MiB partition before WREN or SFDP), while
apple_qspi_qualify() checks SFDP against the exact 0x00ffffff table the
part reports.

Cover the W25Q80 status, part table, physical bound, SFDP match, and
changed-guard mutations in KUnit and tools/asahi/qspi-nvram-tests.py.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan
sithglan requested review from a team and DjDeveloperr as code owners November 27, 2026 21:31
@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Merge readiness at 65b4f4a1: not ready yet

Check Detail
CI at head ok 3 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok comment at 65b4f4a1
Conflicts ok none
PR text ok Risk: two-way · — shrinks t8152-j873-qspi.dtsi's nvram partition to match the J873g ADT (preventing wrap-around onto syscfg), and adds W25Q80 (ef6514) with strict 1 MiB physical bound, bpok=0, and exact SFDP 0x200000 match; default remains readonly=Y, no existing part's policy changes.

Areas: area:bringup, area:gpu

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@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 65b4f4a1

Blockers: none.

Checked: no Apple material, no AI attribution, no chip/board/firmware gates (uses existing JEDEC ID part table), no cmdline hacks, human Signed-off-by, NVRAM partition shrink (0x24000..0xf4000, 13 banks) prevents 1 MiB wrap onto syscfg, W25Q80 (ef6514) physical size 0x100000 / bp_ok=0 / sfdp_size=0x200000 guards, KUnit (17/17) and host mutation tests (qspi-nvram-tests.py), J873g hardware verification row PASS, all 4 CI checks green.

Evidence
  • Inspected all 5 files (t8152-j873-qspi.dtsi, spi-apple-qspi-policy.h, spi-apple-qspi.c, spi-apple-qspi-policy-test.c, qspi-nvram-tests.py).
  • Verified apple_qspi_part_sfdp_size() preserves part->size for all existing entries (sfdp_size == 0) while admitting W25Q80 (ef6514) with a strict 1 MiB physical window bound (0x100000), bp_ok = 0 (refuses BP0), and exact factory SFDP density match (0x200000).
  • Verified t8152-j873-qspi.dtsi fixes reg = <0x24000 0xd0000> (0x24000 + 0xd0000 = 0xf4000 <= 0x100000), matching ADT and preventing wrap-around onto syscfg at 0x100000.
  • Hardware row on J873g (T8152 Mac mini M6): confirmed wrap before fix, verified default read_only=Y refusal, and verified asahi-bless --next set/readback/restore across all 13 banks with 0 faults.
  • CI at 65b4f4a1: dt-checks, host-tests, readiness, pr-text all PASS.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merge-train status at 65b4f4a1: App-approved, CI green, J873g NVRAM row. spi-apple-qspi is the guarded NVRAM write path that the J616s, J713, J700 and K boards use for aurora-bless, so before merge this needs a regression row on a second family. For example, on a J713 or K114s at this head: the known part is accepted, aurora-bless --next round trip works, there are no refused writes, and the policy KUnit passes. @DjDeveloperr code-owner ping (6-point rule, point 6): merge earliest 16:55 AEDT once that row is in. Revert: git revert -m 1 <merge>.

@sithglan

Copy link
Copy Markdown
Contributor Author

@RyanTheTide @DjDeveloperr Added second-family hardware regression row at exact head 65b4f4a13e57:

  • Hardware row (65b4f4a13e57) — MacBook Air (M5, J813 / T8142), firmware 27.2, 7.3.0-aurora-j813-pr3441+: PASS
    • Known part accepted on spi0.0 (nvram partition 0x000000700000-0x000000800000): spi-nor spi0.0: nvram window [0x700000, 0x800000): 16 stores, writes in [0x700000, 0x800000), part ef6517.
    • aurora-bless --next round trip: initial default=Stub next=Stub -> aurora-bless --next --set-boot "Macintosh HD" -y -> readback default=Stub next=Macintosh HD -> aurora-bless --next --set-boot "Stub" -y -> readback default=Stub next=Stub; read_only=Y confirmed afterward.
    • 0 refused writes (NVRAM denied), 0 QSPI/MTD errors or faults in dmesg.
  • Policy KUnit at 65b4f4a13e57: apple-qspi-nvram-policy: 17/17 passed (Ran 17 tests: passed: 17).

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at 65b4f4a13e57 (B2 merge train, 12-01 merge bar). Approval at this head: aurora-silicon-review[bot]. Row: J813 comment at 65b4f4a. CI: linux train L1 = main 595e754 + #3503 #3499 #3240 #3208 #3696 #731 #2634 #2110 #3325 #3441 #3650 (candidate ef98b31c): Apple driver compile (defconfig + asahi.config, LLVM=1, Rust) pass, Apple DTBs W=1 pass, planned KUnit clpc/dcp-fabric/dcp-topology/dcp-display/pmgr-pwrstate/mt7932/asahi all pass; host-tests green (or path-skipped) at this head. The rest of the hosted run is queued behind the ~19 h backlog. Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit 755050b into aurora-silicon:main Dec 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:bringup Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants