Skip to content

P105 NAND: Cascadia's 16 GB support and write-failure handling on top of #93; checkpointed data fix - #210

Merged
henrikklee merged 8 commits into
mainfrom
p105-nand-fusion
Nov 23, 2026
Merged

henrikklee merged 8 commits into
mainfrom
p105-nand-fusion

Conversation

@henrikklee

Copy link
Copy Markdown
Contributor

On top of #93 (now merged), for the iPad mini 1 (P105) internal storage:

  • docs: docs/bring-up/p105-nand-merge-proposal.md, Orchard's stack as the base with Cascadia's tested parts ported on top.
  • Read the 16 GB package as well as the 64 GB one; SDR bring-up from Cascadia's controller driver (rzxvx's authorship).
  • Survive a failed program instead of stopping; load a medium with a torn page and move off it; test-only failure injection.
  • Shayne's fix (4814063): checkpointed subtype-1 data in open blocks no longer reads as a torn write. With it the whole 64 GB disk read back identical to an independent reconstruction from raw flash (954 ranges).

Reclamation stays off on the P105 (reclaims = false). Writing is still untested on a device.

henrikklee and others added 8 commits November 20, 2026 07:30
…ted write-failure handling and 16 GB support ported on top

Compares Shayne Legault's merged H2FMI/apple-sftl stack and draft #93
with rzxvx's apple_ppn/apple_ftl in Project Cascadia ad28ba4, and lists
what each side keeps, what is ported and in which order it is qualified.

Assisted-by: LLM
The P105's translation layer registered only on the 64 GB NAND package.
Port Cascadia's 16 GB layout into it (patch 0018, authored by rzxvx):
four banks of 1064 blocks of 256 pages, 1055 superblocks, the VFL in
blocks 1062/1063, iOS 8.4.1's context and summary rules. A 16 GB P105 now
gets a read-only applesftl disk of 16,000,000,000 bytes. 0017 first moves
#93's fixed 64 GB constants into a geometry descriptor, unchanged in
behaviour for the 64 GB package.

KUnit gains a synthetic 16 GB medium (3 cases); all 84 apple-sftl and
apple-h2fmi cases pass. Untested on hardware.

Assisted-by: LLM
H2FMI only worked in the DDR interface iBoot leaves and refused to probe
otherwise. Patch 0019 (authored by rzxvx) ports Cascadia's controller
facts into it: the SDR bring-up order with the power state set after the
NAND reset, the measured timing, firmware and bad-block table reads, and
SDR page transfers as one start per 4112-byte unit. The DDR path is
unchanged; nothing on today's boot chain takes the SDR path yet.

The armv7 config turns on STRICT_DEVMEM and IO_STRICT_DEVMEM, so /dev/mem
can no longer reach the NAND controller's registers that H2FMI claims.
Cascadia added this after a user-space tool reset the controller in the
middle of a program and tore a page (its 2026-11-16 incident).

KUnit: 85 cases pass. Untested on hardware.

Assisted-by: LLM
A failed program stopped the P105's NAND writer and every later I/O on
that bus. Patch 0021 (authored by rzxvx) ports Cascadia's session
give-up: the failed block is abandoned, its live pages move to a new
block, and the write completes there; after eight failures in a session
the writer still stops. 0020 lets H2FMI reset the packages after a
failed transaction instead of refusing all further I/O, which the
give-up needs because every superblock spans both buses. Torn pages
still stop the writer until the next patch.

KUnit: 87 cases pass (the old stop-on-failure cases now assert the
give-up). Untested on hardware.

Assisted-by: LLM
A torn page at the end of an open block made the whole P105 medium
unreadable. Patch 0022 (authored by rzxvx) ports Cascadia's
give_up_torn: the load skips that one page and its four sequences, and
the first write moves the block's live pages elsewhere. Only malformed
metadata on the block's last programmed page counts as torn; read
errors and unknown statuses still stop the load, as #93 decided.

KUnit: 89 cases pass. Untested on hardware.

Assisted-by: LLM
…oposal

Patch 0023 (authored by rzxvx) adds CONFIG_MTD_APPLE_H2FMI_FAULT_INJECT,
default n: debugfs fault attributes make a page program fail before or
after it reaches the NAND, or an erase fail, so the give-up paths can be
exercised on a tablet as Cascadia did. KUnit gains Cascadia's fault
script on synthetic media: 90 cases pass.

The merge proposal now lists what each port became, compares #93's
native context encoder with Cascadia's iOS 8.4.1 encoder field by field
(port 2, offline: the w0c dump is private), and marks what needs a
tablet or the dump in its order section. device.toml notes that the
16 GB read path is untested.

Assisted-by: LLM
Fusion patch 0022 treats native data with an older user epoch as a torn
page. When another programmed page follows, SFTL aborts the map load
with -EBADMSG. Accept the older epoch for subtype-1 disk data that the
checkpoint already covers. The loader can skip those records during
replay and still validate newer records.

Add the ARM KUnit regression and record the 64 GB P105 comparison.
All 954 ranges read by the iPad matched an independent reconstruction
from raw flash captured during the same boot.

Assisted-by: LLM
Signed-off-by: Shayne Legault <8741557+shaynelegault@users.noreply.github.com>
@henrikklee
henrikklee merged commit 273aa84 into main Nov 23, 2026
11 checks passed
@henrikklee
henrikklee deleted the p105-nand-fusion branch November 23, 2026 09:34
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.

2 participants