Repository navigation
spi: apple-qspi: fix J873g nvram partition size and admit W25Q80 (ef6514) - #3441
Conversation
…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>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
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()preservespart->sizefor all existing entries (sfdp_size == 0) while admittingW25Q80(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.dtsifixesreg = <0x24000 0xd0000>(0x24000 + 0xd0000 = 0xf4000 <= 0x100000), matching ADT and preventing wrap-around ontosyscfgat0x100000. - Hardware row on J873g (T8152 Mac mini M6): confirmed wrap before fix, verified default
read_only=Yrefusal, and verifiedasahi-bless --nextset/readback/restore across all 13 banks with 0 faults. - CI at
65b4f4a1:dt-checks,host-tests,readiness,pr-textall PASS.
|
Merge-train status at |
|
@RyanTheTide @DjDeveloperr Added second-family hardware regression row at exact head
|
|
Merging at |
What: Fix the J873g (Mac mini, M6)
nvrampartition size inarch/arm64/boot/dts/apple/t8152-j873-qspi.dtsifrom0x1d0000(2 MiB J700 copy that wrapped past0x100000ontosyscfg) to0xd0000(13 × 64 KiB banks0x24000..0xf4000, matching the J873g ADT), and admit the J873g's Winbond W25Q80 boot NOR (ef6514,sr1=00 sr2=02 sr3=20, physical size0x100000,bp_ok=0, factory SFDP BFPT0x00ffffff=0x200000) inspi-apple-qspiwith full KUnit and host mutation-test coverage.Tested:
7.3.0-aurora-j873-main-1127+:mtd0[0x000000:0x0d0000] == mtd0[0x100000:0x1d0000]byte-for-byte, andmtd0[0x0dc000](abs 0x100000) reads"iPCB"(0x000000syscfg).0x000000024000-0x0000000f4000 : "nvram",mtd0: 000d0000):read_only=Yrefusesasahi-bless --next --set-boot(NVRAM denied: reason=read-only).read_only=N,spi-apple-qspiqualified all 13 banks (nvram window [0x24000, 0xf4000): 13 stores, writes in [0x24000, 0xf4000), part ef6514), set--nextto"Macintosh HD"and read it back (default=LinuxStub next=Macintosh HD), then restored--nextto"LinuxStub"and read it back (default=LinuxStub next=LinuxStub), and re-armedread_only=Y, with zero faults or errors../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 (includingsfdp-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'snvrampartition to match the J873g ADT (preventing wrap-around ontosyscfg), and addsW25Q80(ef6514) with strict 1 MiB physical bound,bp_ok=0, and exact SFDP0x200000match; default remainsread_only=Y, no existing part's policy changes.Not yet: None.
Details
arch/arm64/boot/dts/apple/t8152-j873-qspi.dtsi: changenvramregfrom<0x24000 0x1d0000>to<0x24000 0xd0000>(matching ADT/arm-io/qspi/spinor/anvramand/chosen/nvram-bank-count = 13).drivers/spi/spi-apple-qspi-policy.h&drivers/spi/spi-apple-qspi.c: add optionalsfdp_sizetostruct apple_qspi_part+apple_qspi_part_sfdp_size(), and addAPPLE_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: coverW25Q80status (00/02/20), BP0 refusal, 1 MiB physical bound (refusing oversized0x1f4000window before WREN/SFDP), SFDP mismatch refusal, and mutation controls.Evidence
flash_status:jedec=ef6514 sr1=00 sr2=02 sr3=20ptp=0x80 dw1=0xfff920e5 dw2=0x00ffffff(0x200000), physical wrap at0x100000dmesg: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=0spi-nor spi0.0: nvram window [0x24000, 0xf4000): 13 stores, writes in [0x24000, 0xf4000), part ef6514apple-qspi-nvram-policy:Ran 17 tests: passed: 17python3 tools/asahi/qspi-nvram-tests.py: exit 0 (PASS W25Q80 J873g part,PASS j873g-w25q80-id,PASS j873g-w25q80-size,PASS sfdp-size)