Skip to content

kboot: reserve an AOP's firmware pages in Linux's RAM when its DART is locked, so Linux cannot reuse pages the AOP still uses - #474

Merged
DjDeveloperr merged 3 commits into
aurora-silicon:mainfrom
funkzy:pr/t6050-aop-handoff
Nov 24, 2026

Conversation

@funkzy

@funkzy funkzy commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

The AOP follow-up raised on #427 (#427 (comment)), which its
review kept out of that PR's scope: on the Mac Studio (J775D) the AOP's firmware log lies outside the firmware segment
extent #427's pass reads, so that pass leaves it unreserved. This reserves it on the AOP's own path, AOP-only and only
on a locked AOP DART. linux#2890 (the J775D tree change that enables the AOP) should land after it.

Problem

On a locked AOP DART Linux keeps the firmware's own mappings, so since e41005d (after #377's J700 testing) the AOP
firmware-segment path adds nothing there. That also leaves the RAM under any AOP firmware segment inside the OS's
memory unreserved: on the J775D the AOP's log lies there, at an address that changes from boot to boot, and the AOP
uses it once Linux starts the AOP. Linux can hand those pages out meanwhile.

Why this shape

  • Before: one locked-DART branch in dt_set_aop_firmware(), taken by every AOP whose DART is locked at handoff (the
    J700, and the T6050 boards that enable their AOP), reserved nothing. Calling dt_get_or_add_reserved_mem() directly
    would also call bail() on out-of-space errors (preventing any halted-AOP fallback) and silently overwrite any
    same-name /reserved-memory node.
  • The reservation goes into that one branch through a non-bailing helper (dt_try_reserve_ram_mem()), so every locked
    AOP DART gets it, and the board's tree keeps deciding whether the AOP runs (status = "okay", as the J714s, K114c
    and K116s files do and linux#2890 does for the J775D). No second enable path and no board or SoC selector.
  • dt_try_reserve_ram_mem() is a narrow variant for this one caller: it neither calls bail() nor overwrites an
    existing node, while dt_get_or_add_reserved_mem() keeps its get-or-add contract for its 21 existing callers.
    Folding both onto one non-bailing core, with dt_get_or_add_reserved_mem() as a wrapper keeping its current
    behaviour, is a follow-up PR after this one so those callers are not changed here.
  • What is reserved is what the machine reports: the AOP's ADT firmware segments that intersect the OS's memory, rounded
    out to 16 KiB pages (as the T8152 display path does) with u64 wrap and ADT DRAM bounds checks, RAM only (no-map,
    no device address, so e41005d's EBUSY cannot come back). On the J775D the locked tables do not map the log at
    handoff (a read-only walk of every stream the ADT describes finds 11 mapped pages, all in two other AOP segments
    outside the OS's memory), so there is no live translation to reserve and the ADT's phys field is the log's only
    description. Existing no-map reservations that already cover the range stay untouched; conflicting or non-no-map
    overlaps fail closed rather than clobbering.
  • A failed reservation keeps a halted AOP off without needing tree space (fdt_disable_node()), so its firmware never
    starts and never uses the pages, and the boot goes on. For "ok" or status-less nodes with no free space,
    fdt_disable_node() turns the whole node (including status, phandle and children) into NOPs with fdt_nop_node(),
    the same zero-space fallback kboot_gpu_m4.c already uses. A running AOP uses those pages whatever the tree says, so
    then the boot stops.
  • If kboot: name the RTBuddySeg firmware logs no-map #427's pass later covers logs in the OS's memory outside its extent, this folds into it and the AOP path goes back
    to adding nothing on a locked DART: one pass for every coprocessor's log.
  • Scope left out: on the J775D, kboot: name the RTBuddySeg firmware logs no-map #427's pass also skips the logs of two other coprocessors that lie outside its extent.
    This PR does not touch them; the same one-pass extension of kboot: name the RTBuddySeg firmware logs no-map #427 would cover them too. Unifying kboot_gpu_m4.c's
    fdt_setprop_string(..., "disabled") && fdt_nop_node(...) onto fdt_disable_node() is left as a follow-up.

Change

  • kboot: keep an FDT node off without needing space, so a boot loader step can refuse a coprocessor even in a full tree:
    fdt_disable_node() sets status to "disabled"; if that cannot grow the tree, it re-reads status and overwrites
    "okay" in place with "fail" (the same length); otherwise it turns the whole node (including status, phandle
    and child nodes) into NOPs via fdt_nop_node(), so nothing probes it and no phandle consumer sees it as available.
    tests/run-fdt-disable.sh checks every branch on the host and runs in CI.
  • kboot: keep an AOP's firmware pages in the OS's memory reserved when its DART is locked, so the OS cannot reuse the log the firmware writes:
    • dt_try_reserve_ram_mem() adds a no-map /reserved-memory node without calling bail(): an existing no-map
      node covering the range is kept untouched, conflicting or non-no-map overlaps fail closed, and mid-creation
      out-of-space failures roll back any partial subnode with fdt_nop_node().
    • dt_reserve_aop_os_ram() checks segment count (<= 64), u64 wrap before and during 16 KiB rounding, and ADT DRAM
      bounds, reserving every OS-RAM segment RAM only.
    • dt_aop_locked_dart_handoff() disables a halted AOP with fdt_disable_node() on failure (the J775D's AOP waits
      halted at handoff) and stops the boot for a running AOP (or when asc_init() fails).
    • tests/run-aop-os-ram.sh extracts and tests the production src/kboot.c functions with src/fdt_disable.c and
      libfdt under ASan and UBSan and runs in CI.

Testing

J775D (Mac Studio, M5 Ultra), kernel linux integration/aurora f5f023bc9b62 + linux#2556 + linux#2890 (kit j7aop-p3),
read-only root, default command line:

  • Default 27.0 stub, unattended from installed Stage 2 (b21dcdad on main 59b8b977, window j7aura15):
    • Installed /efi/aurora/stage2/aura.macho booted unattended in 45 s through the default 27.0 Stage 1 with no host
      claim (original Stage 2 restored and verified byte-for-byte afterwards).
    • Reserved-memory node: asc-firmware@1000eac8000 ([0x1000eac8000, +0x2c000), no-map).
    • /sys/kernel/debug/memblock/memory: 0x1000e988000..0x1000eaf3fff NOMAP (covers the log and adjacent display logs);
      /sys/kernel/debug/memblock/reserved: 0x10008e70000..0x10011ab3d7f.
    • Memory pressure: 72 GiB fill (80% of available RAM, every page written with a pattern) held 20 s compared byte for
      byte with 0 chunks changed. Five 1 s PCM captures through the AOP audio DAI (1 before, 3 during the fill, 1 after)
      all completed (rc 0, 192044 bytes each). apple_aop stayed bound, AppleJ775D stayed registered, 0 DART faults
      or errors.
    • Regression: 2 failed units (iwd lacks integration defconfig crypto options; systemd-networkd-persistent-storage
      on read-only root), 5 err-level kernel lines (same 3 DCP + 1 USB HID + macaudio speaker-safety line as below), 0
      WARNING/BUG/Oops. ALARM has no SELinux, so there is no AVC count.
  • Default 27.0 stub, Stage 2 chained one-shot (b21dcdad on main 59b8b977, image aura-aopres3c, window j7aura13):
    • Aura logged preserving firmware mappings in locked DART then firmware segment [0x100101f4000, +0x2c000) is in the OS's memory: reserved, RAM only.
    • /sys/kernel/debug/memblock/memory: 0x100100b4000..0x1001021ffff NOMAP; 72 GiB fill 0 chunks changed; 5/5 audio
      captures rc 0 (192044 bytes); 0 DART faults; same 2 failed units and 5 err-level kernel lines.
  • Forced-failure row (full FDT with zero free space) (b21dcdad plus test-only fdt_pack(dt) before
    dt_reserve_aop_os_ram() and fdt_open_into() after so later passes finish, image aura-aopres3-nospace2, window
    j7aura14):
    • Aura logged preserving firmware mappings in locked DART then its firmware RAM could not be reserved: AOP kept off
      without bailing.
    • Linux booted cleanly: /proc/device-tree/soc@200000000/aop@290c00000/status is "fail", no partial or OS-RAM
      asc-firmware node was added, apple_aop bound count is 0, AppleJ775D card count is 0, 0 DART faults, 2 failed
      units, 4 err-level kernel lines (macaudio does not probe).
  • Earlier 27.2 A/B baseline vs PR (windows j7aura8 on main 90f11310 vs j7aura9 at adaf5a5f on f1daef3e):
    identical functional and error counts (2 failed units, 5 err-level lines, 0 WARNING/BUG/Oops), with the PR adding the
    3rd AOP firmware reservation (0x2c000 bytes in OS RAM).
Host tests, builds and static checks
  • sh tests/run-fdt-disable.sh (ASan + UBSan): 10/10 pass (with room -> "disabled"; packed "okay" -> "fail" in
    place; packed "ok" and status-less -> whole node, child and phandles NOP'd with siblings untouched; fail_status
    injection; missing node error with tree unchanged).
  • sh tests/run-aop-os-ram.sh (ASan + UBSan, -Wall -Wextra -Werror, production functions extracted from src/kboot.c
    against src/fdt_disable.c and real libfdt): 14/14 pass (aligned segment; unaligned r.phys spanning a 16 KiB
    boundary rounded down/up to cover both pages; u64 wrap on r.phys + size and on 16 KiB rounding; > 64 segments;
    outside ADT DRAM; already-covered no-map untouched; partial overlap / smaller same-name refused without clobber;
    non-no-map overlap refused; packed FDT + halted AOP "okay" -> "fail" and "ok" -> node/child/phandle NOP'd;
    packed FDT + running AOP -> bail; asc_init() NULL -> bail; tight FDT mid-creation NOSPACE -> partial subnode
    rolled back and halted AOP disabled).
  • Chain build (RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1 USE_CLANG=1 BUILTIN_LOGO=aurora BUILDSTD=1) on main 59b8b977:
    clean, no new warnings. clang-format clean.

Still to run

  • Other locked-DART boards (a J700 row where the AOP runs at handoff, and a J714s, K114c or K116s row with AOP
    enabled): confirms the reservation line (when an OS-RAM segment is present) and clean AOP binding on other boards
    entering this branch.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Review at adaf5a5.

Thanks, the shape looks right to me: the selector is the DART's lock state, there's no board or SoC test, and a running AOP whose pages can't be reserved stops the boot instead of going on. A few points:

  1. src/kboot.c:9916-9938: the pages come from the ADT segment-ranges phys field, but the DART is locked and its tables are live, so the hardware can tell us which pages the AOP actually uses. In this same file, dt_reserve_m5_display_segments() (kboot.c:7828-7830) exists because on M5 the ADT phys field of __OS_LOG can differ from the active DART translation. If that also happens on the J775D AOP, this reserves the wrong pages and the real log stays free. Could you translate each segment's remap IOVA through the locked DART (dt_init_dart_by_node() + dart_translate()), reserve the translated pages, and refuse if a page is unmapped or outside RAM? If that's not possible, could you show from the J775D boot that phys == translate(remap) for all three segments?
  2. kboot.c:9928: a segment that only partly overlaps the OS's RAM is reserved in full, which is fine. But nothing checks that r.phys is 16K-aligned or caps the segment count (the M5 display path caps it at 64). A short bounds check like dt_reserve_asc_segments()'s DRAM check at kboot.c:4499-4505 would keep a malformed ADT from adding a reservation that's out of bounds or unaligned.
  3. kboot.c:9990-10002 + src/fdt_disable.c: which Mac reaches the "halted AOP behind a locked DART" branch? iBoot starts the AOP wherever we have seen its DART locked. If no Mac does, a plain bail is enough, and fdt_disable_node() plus its CI test could wait for a caller that needs them. If one does, please name it. Also, on a halted AOP with NOP'd compatible (ok/no-status case), the AOP's child service nodes stay as they are. Please check that nothing else probes them.
  4. Testing: the before and after columns are identical, so the table shows no regression, but it doesn't show the fix doing anything. Could you add, on the J775D: the new ranges in /sys/kernel/debug/memblock/reserved (or /proc/iomem) matching the AOP's live translation; a memory-pressure run (e.g. stress-ng --vm filling most of RAM) with the AOP still bound afterwards, no DART faults, and its services still answering; and the row on the default 27.0 stub from the installed Stage 2, not a one-shot.

Rows still owed at this head (all reach the new branch): J700 (T8140) boot, AOP bound, no new DART faults; J714s, K114c, K116s (T6050, AOP enabled) the same. One forced-failure row (a tree with no space left) would show the running-AOP bail message, which is the safe outcome. Macs with an unlocked AOP DART, and T8132, don't reach this code.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 pre-PR review at adaf5a5fe0f61ea195eb46f46a206f08e8ce2ed1 (base main, 15/15 CI checks SUCCESS).

Strengths

  • §1 Code shape: Keyed strictly on dart_t8110_is_locked() rather than any board, chip, or firmware-version check.
  • §2 Production-ready, no hacks: Pass. No cmdline parameters, sleeps, or lab-only workarounds.
  • §4 Clean-room & attribution: Pass. Both commits (4205248e1d89, adaf5a5fe0f6) carry human author/committer Jeff Queisser <funkzy@users.noreply.github.com>, human Signed-off-by: only, and zero AI commit trailers; PR body ends with Assisted-by:.
  • §6 Naming: Pass.

Blocking Findings

  1. §3 Safety — dt_reserve_aop_os_ram() trusts ADT r.phys instead of validating/translating through the live locked DART and lacks bounds/alignment guards (src/kboot.c:9916-9939):
    • On a locked DART, the live hardware translations are in the DART's page tables. In this same file, dt_reserve_m5_display_segments() (src/kboot.c:7834-7890) explicitly translates each segment's remap IOVA through the locked DART (dt_init_dart_by_node() + dart_translate()) because on M5 the ADT phys for __OS_LOG can diverge from the active DART translation. Either translate each segment's remap through the locked DART (failing closed if unmapped/out of DRAM) or verify from live J775D telemetry that r.phys == dart_translate(r.remap) across all segments.
    • Missing arithmetic/bounds hardening in dt_reserve_aop_os_ram():
      • r.phys + size <= lo (:9928) does not guard against u64 wrap (r.phys + size < r.phys), which would silently skip a wrapping segment.
      • r.phys is neither checked for SZ_16K alignment nor rounded down before calling dt_get_or_add_reserved_mem(), so an unaligned r.phys can leave the trailing page unreserved when r.size spans a 16 KiB boundary.
      • No segment-count cap (len / sizeof(*seg)), unlike dt_reserve_m5_display_segments() (cap 64).
      • dt_get_or_add_reserved_mem() (src/kboot.c:3942-3959) silently overwrites reg and compatible if a /reserved-memory/asc-firmware@<addr> node already exists from another pass; check for existing/overlapping reservations rather than clobbering.
  2. §3 Safety / Design — fdt_disable_node() no-space fallback (src/fdt_disable.c:46-56, src/kboot.c:9990-10002):
    • When the tree has no free space and status is "ok" or absent, fdt_disable_node() NOPs compatible while leaving status active, so any consumer referencing the AOP node by phandle (of_device_is_available()) still sees it as enabled.
    • Clarify whether any Mac actually reaches the "halted AOP behind a locked DART" branch (where iBoot locked the AOP DART without starting the AOP). If no Mac reaches it, a direct bail() is simpler and avoids dead fallback logic; if one does, name it and verify nothing else probes/consumes the AOP node or its children when compatible is NOP'd.
    • Minor in src/fdt_disable.c:49-54: reading status after fdt_setprop_string() fails (rather than caching the pointer before a mutating libfdt call) avoids relying on libfdt leaving offsets untouched on error.
  3. §5 Evidence (and §1 multi-Mac proof) — owed before merge:
    • The J775D table ran only as a read-only one-shot boot on the 27.2 stub (on an older base f1daef3e) and shows identical before/after functional columns without confirming the reservation in /sys/kernel/debug/memblock/reserved (or /proc/iomem) matches the live AOP DART translation or surviving memory pressure (stress-ng --vm) with 0 DART faults.
    • Still owed (per ## Still to run and §1/§5):
      • J775D on the default 27.0 stub from installed Stage 2 with /sys/kernel/debug/memblock/reserved (or /proc/iomem) + memory-pressure verification and 0 DART faults.
      • At least one additional Mac entering the locked-DART branch: J700 (T8140) and/or T6050 (J714s / K114c / K116s with AOP enabled).
      • Host unit test coverage exercising dt_reserve_aop_os_ram() (including wrap, unaligned r.phys, partial overlap, and locked-DART failure handling), since tests/run-fdt-disable.sh currently does not test the AOP path.

Checklist Summary

  • §1 No model gating: Pass in code; multi-Mac proof (J700 / T6050) still owed.
  • §2 Production-ready, no hacks: Pass.
  • §3 Safety: Request changes — locked-DART translation verification, wrap/alignment/cap/overlap guards in dt_reserve_aop_os_ram(), and clarify halted-AOP-on-locked-DART fallback.
  • §4 Clean-room & attribution: Pass.
  • §5 Evidence: Request changes — J775D reserved-memblock + memory-pressure + 27.0 installed Stage 2 row, J700/T6050 rows, and AOP path host test owed.
  • §6 Naming: Pass.

Assisted-by: LLM (Gemini 4 Neon)

…tep can refuse a coprocessor even in a full tree

Disabling a node rewrites its status from "okay" to "disabled", which
grows the tree. When a step must refuse a coprocessor because the tree
is out of space for what it would add, that edit fails for the same
reason, and the step can only stop the boot.

Add fdt_disable_node(): it sets the status to "disabled"; if that cannot
grow the tree, it re-reads status and overwrites an "okay" status in
place with "fail" (the same length; the devicetree specification's
not-operational status, which Linux neither probes nor treats as
available); otherwise it turns the whole node (including its status,
phandle and children) into NOPs with fdt_nop_node(), the same zero-space
fallback kboot_gpu_m4.c already uses, so no driver probes it and no
phandle consumer sees it as available. Neither fallback needs space.

tests/run-fdt-disable.sh checks it on the host and runs in CI: with
room, and with no free space at all on an "okay", an "ok" and a
status-less node with phandles and a child node.

Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
…its DART is locked, so the OS cannot reuse the log the firmware writes

Since e41005d the AOP firmware-segment path adds nothing for a locked
AOP DART: Linux keeps the firmware's own mappings there, and adding the
segments' device addresses would make its default domain fail with
EBUSY. That also leaves the RAM under any segment inside the OS's memory
unreserved. On the Mac Studio (J775D) the AOP's log segment lies there,
at an address that changes from boot to boot, and the firmware writes it
once the OS starts the AOP.

On a locked DART, reserve each segment that lies in the OS's memory as
RAM only (no-map, no device address, not in the AOP's memory-region),
under the node names the segment reservation uses. Each segment is
checked for u64 wrap before rounding out to 16 KiB pages (as the T8152
display path does) and checked against the ADT's DRAM bounds; a segment
list longer than 64 entries is refused. Reservations go through a
non-bailing helper, dt_try_reserve_ram_mem(), instead of
dt_get_or_add_reserved_mem() (which calls bail() on FDT errors and
overwrites same-name nodes): an existing no-map reservation that already
covers the range is kept untouched, any conflicting or non-no-map
overlap fails closed, and a mid-creation out-of-space error removes the
partial subnode with fdt_nop_node().

If reservation fails (including when the tree is out of space), a halted
AOP is kept off with fdt_disable_node(), which needs no space: the OS
then never starts it, and its firmware never writes those pages, so the
boot goes on. A running AOP writes them whatever the tree says, and a
disabled node would not stop it, so then the boot stops rather than hand
the OS pages the firmware is writing. The pages come from the ADT's phys
field: on the J775D the locked tables do not map the log at handoff, so
no translation describes it. On the J775D the AOP waits halted at
handoff, which is the case fdt_disable_node() covers.

tests/run-aop-os-ram.sh checks the production reservation and failure
paths from src/kboot.c against src/fdt_disable.c and libfdt on the host
and runs in CI (aligned and unaligned 16 KiB rounding, wrap guards,
count cap, DRAM bounds, existing no-map coverage vs overlap conflicts,
and packed/tight FDT handling for halted and running AOPs).

Nothing changes for an unlocked DART or for a segment outside the OS's
memory. The locked-DART path runs wherever the AOP's DART is locked at
handoff: the J700 (T8140), whose AOP DART probe failed with EBUSY before
e41005d, and the T6050 boards that boot their AOP.

Signed-off-by: Jeff Queisser <funkzy@users.noreply.github.com>
@funkzy
funkzy force-pushed the pr/t6050-aop-handoff branch from adaf5a5 to b21dcda Compare November 23, 2026 10:11
@funkzy

funkzy commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review. Rebased onto main 59b8b977 and updated to b21dcdad (commits 4e660ed3 and
b21dcdad):

  1. Locked-DART translation: On the J775D the locked dart-aop tables do not map the log at handoff. A read-only
    walk of every stream the ADT describes (three table levels, as their TCR states; dart_translate() reads two) finds
    11 mapped pages, all inside two other AOP segments outside the RAM handed to Linux, and none in the log's range. So
    there is no live translation to reserve for it, and the ADT phys field is its only description; the reservation
    stays on it, and the commit message and PR body explain why.
  2. Bounds, overflow, 16 KiB rounding, and overlap:
    • Checked u64 wrap on kboot_ram_base() + kboot_ram_size(), dram + dram_size, r.phys + r.size, and the 16 KiB
      ALIGN_UP before skipping or reserving, so wrapping segments fail closed rather than being skipped.
    • Rounded start = ALIGN_DOWN(r.phys, SZ_16K) and end = ALIGN_UP(raw_end, SZ_16K) (matching the T8152 display
      path) so an unaligned r.phys spanning a 16 KiB boundary reserves the trailing page too, then checked [start, end)
      against ADT DRAM bounds and capped the segment list at 64 entries.
    • Replaced dt_get_or_add_reserved_mem() (which also called bail() on FDT errors, preventing the halted-AOP
      fallback from ever running on a full tree, and silently overwrote same-name nodes) with a non-bailing
      dt_try_reserve_ram_mem(): existing no-map reservations that already cover the range stay untouched, any
      conflicting or non-no-map overlap fails closed without clobbering, and a mid-creation FDT_ERR_NOSPACE rolls
      back the partial subnode with fdt_nop_node().
  3. fdt_disable_node() no-space fallback:
    • Re-reads status after fdt_setprop_string() fails rather than caching the pointer beforehand.
    • For "ok" or absent status in a full tree, falls back to fdt_nop_node(fdt, node) (the same zero-space fallback
      kboot_gpu_m4.c already uses) instead of only NOP'ing compatible, removing status, phandle, and child nodes
      so no phandle consumer can see the AOP or its children as available.
    • The J775D reaches the halted-AOP-behind-locked-DART branch: at handoff dart-aop is locked and the AOP is halted,
      and Linux starts it.
  4. Host tests and J775D rows:
    • Added tests/run-aop-os-ram.sh (wired into CI alongside tests/run-fdt-disable.sh): extracts and tests
      dt_find_aop, dt_try_reserve_ram_mem, dt_reserve_aop_os_ram, and dt_aop_locked_dart_handoff from
      src/kboot.c against src/fdt_disable.c and real libfdt under ASan+UBSan (14/14 pass, covering wrap, unaligned
      16 KiB rounding, count cap, DRAM bounds, existing no-map vs conflicting overlap, packed/tight FDT rollback, and
      halted vs running AOP). tests/run-fdt-disable.sh also passes 10/10 with child and phandle checks.
    • Default 27.0 stub from installed Stage 2 (unattended boot through Stage 1 -> installed /efi/aurora/stage2/aura.macho
      -> Linux kernel test kit j7aop-p3, integration/aurora f5f023bc9b62 + linux#2556 + linux#2890): reserved asc-firmware@1000eac8000 (+0x2c000, no-map), covered by memblock/memory
      0x1000e988000..0x1000eaf3fff NOMAP and memblock/reserved 0x10008e70000..0x10011ab3d7f. A 72 GiB RAM fill
      held 20 s compared 0 chunks changed; 5/5 PCM captures (1 before, 3 during, 1 after) succeeded (rc 0, 192044
      bytes); apple_aop stayed bound, 0 DART faults, 2 failed units and 5 err-level lines (same as baseline).
    • Forced full-FDT failure row (test-only fdt_pack(dt) before AOP reservation): Aura logged its firmware RAM could not be reserved: AOP kept off without bailing, Linux booted cleanly with /proc/device-tree/.../aop@290c00000/status
      equal to "fail", no partial or OS-RAM asc-firmware node, 0 bound apple_aop, 0 sound cards, and 0 DART faults.

Rows on a J700 (running AOP at handoff) and a T6050 laptop with AOP enabled (J714s / K114c / K116s) at this head would
complete multi-Mac coverage for the locked-DART branch.

Assisted-by: LLM (Gemini:Neon)

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 pre-PR re-review at b21dcdadd937 (base main, 11/15 CI checks SUCCESS, 1 FAILURE, 3 CANCELLED).

Stage 1 Impact

  • Touches Stage 1: Yes. Adds fdt_disable.o to unconditional OBJECTS in Makefile and modifies src/kboot.c (gcc stage1-dev-audit headroom is 584 B, warning < 8192 B; all 5 stage1-size jobs pass). Requires Stage 1 owner sign-off under §3 before merge.

Resolved Since adaf5a5f

  • §3 Technical hardening & locked-DART audit: All prior code findings are well resolved:
    • Locked-DART 3-level walk on J775D confirmed the log is unmapped at handoff (only 11 pages in two non-OS-RAM segments are mapped), establishing ADT phys as its sole description.
    • dt_reserve_aop_os_ram() now guards u64 wrap before and during 16 KiB rounding, caps segment count at 64, enforces ADT DRAM bounds, and uses non-bailing dt_try_reserve_ram_mem() (keeping covering no-map reservations untouched, failing closed on conflicting/non-no-map overlaps without clobbering, and rolling back partial subnodes via fdt_nop_node()).
    • fdt_disable_node() re-reads status after fdt_setprop_string() fails, overwrites "okay" in place with "fail", and falls back to fdt_nop_node() for "ok" / status-less nodes so phandles and child nodes cannot be probed.
    • J775D testing now includes the default 27.0 stub from installed Stage 2 (memblock NOMAP + 72 GiB RAM fill + 5/5 PCM captures + 0 DART faults) and the forced full-FDT row (status = "fail", no bail, 0 bound apple_aop).
  • §4 Attribution: Pass. Both commits (4e660ed36755, b21dcdadd937) carry human author/committer Jeff Queisser <funkzy@users.noreply.github.com> and human Signed-off-by: only, with zero AI commit trailers; PR body ends with Assisted-by:.
  • §2 / §6: Pass.

Blocking Findings

  1. CI failure (Pytest (ubuntu-latest + llvm) + 3 cancelled matrix jobs):
    • tests/run-aop-os-ram.sh fails under Clang + UBSan with:
      src/libfdt/fdt_sw.c:333:2: runtime error: null pointer passed as argument 2, which is declared to never be null
    • Root cause: tests/aop_os_ram_host.c:436 calls fdt_property(buf, "ranges", NULL, 0), which reaches memcpy(ptr, val, 0) at src/libfdt/fdt_sw.c:333 with val == NULL. Pass "" (or use fdt_property_placeholder()) instead of NULL.
    • Because of matrix fail-fast, Pytest (ubuntu-latest + gcc), Pytest (macos-26 + llvm-brew), and Pytest (macos-15 + llvm-brew) were cancelled and never ran; a full 15/15 green CI run is required.
  2. §1 Multi-Mac / §5 Evidence: As noted in ## Still to run, at least one additional locked-DART Mac row (J700 where the AOP runs at handoff, and/or a T6050 laptop J714s / K114c / K116s with AOP enabled) is still owed before merge.

Assisted-by: LLM (Gemini 4 Neon)

The fixture writes an empty ranges property. libfdt still calls memcpy for a zero-length property, so use an empty string to satisfy the nonnull contract and keep the property length at zero.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor

The Clang UBSan failure that Dj reported is fixed at 0d66afc774ea. The AOP fixture now supplies a valid pointer for its zero-length ranges property. The same Clang run failed before the change in libfdt's copy and now passes.

  • Clang and GCC with ASan and UBSan each passed all 14 AOP reservation cases and all 10 FDT-disable cases.
  • The local Python suite passed 1,108 tests and skipped 25. The Stage 1 release and ESP Stage 2 linked. GCC's release Stage 1 had 15,856 bytes of headroom.

On J700 (T8140), the method-T chain boot ran both candidate stages on the production fleet85 kernel and command line. The boot log shows the locked-DART branch preserving firmware mappings and reserving a 208 KiB OS-RAM segment as RAM only. Linux bound apple_aop with 0 DART faults, 0 SELinux denials, 0 failed units and 0 kernel errors. The machine returned to its configured Stage 2 with the same checksum.

A T6050 laptop row with the AOP enabled is still outstanding (J714s, K114c or K116s). The same-head images are available in the CI build artifacts.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 pre-PR re-review at 0d66afc774eabb4455f9e3ca7b4f09a9fc013b4f (base main; 13/15 CI checks SUCCESS, 0 failures, Pytest (macos-26 + llvm-brew) in progress, clang-macos queued).

Stage 1 Impact

  • Touches Stage 1: Yes. Verified against Makefile on main: kboot.o is in unconditional OBJECTS and this PR adds fdt_disable.o to unconditional OBJECTS. Requires Stage 1 owner sign-off under §3 before merge.

Resolved Since b21dcdad

  1. Clang UBSan CI failure (tests/aop_os_ram_host.c:436): Fixed in 0d66afc774ea by passing "" instead of NULL for the zero-length ranges property so libfdt (src/libfdt/fdt_sw.c:333) satisfies memcpy's nonnull contract. Pytest (ubuntu-latest + llvm), Pytest (ubuntu-latest + gcc), Pytest (macos-15 + llvm-brew), Pytest (ubuntu-24.04-arm, native start.S), gcc, build, alarm, fedora, nix, policy, selftest, format-check, and ESP stage 2 vital size all pass.
  2. §1 / §5 Multi-Mac locked-DART verification: Both locked-DART AOP states are now proven on hardware:
    • J775D (Mac Studio M5 Ultra, T6050 — halted AOP at handoff): Verified on identical production code (b21dcdad; 0d66afc774ea touches only tests/aop_os_ram_host.c): default 27.0 stub installed Stage 2, asc-firmware@1000eac8000 no-map in /sys/kernel/debug/memblock/memory, 72 GiB RAM fill with 0 chunks changed, 5/5 1 s PCM captures rc 0, apple_aop bound, 0 DART faults, plus forced full-FDT row (status = "fail", no bail, 0 bound apple_aop).
    • J700 (T8140 — running AOP at handoff): Verified by @RyanTheTide at 0d66afc774ea via method-T chain boot on production fleet85 kernel and default cmdline: locked-DART branch preserved firmware mappings and reserved a 208 KiB OS-RAM segment as RAM only; apple_aop bound with 0 DART faults, 0 SELinux denials, 0 failed units, and 0 kernel errors.

§1–§6 Checklist

  • §1 No model gating: Pass (keyed strictly on dart_t8110_is_locked(); proven on both T6050 J775D and T8140 J700).
  • §2 Production-ready, no hacks: Pass.
  • §3 Safety: Pass in code (wrap/alignment/count/DRAM bounds + non-bailing overlap-safe reservation + zero-space fdt_disable_node() + fail-closed bail() on running AOP); Stage 1 owner sign-off applies before merge.
  • §4 Clean-room & attribution: Pass. All 3 commits (4e660ed36755, b21dcdadd937, 0d66afc774ea) carry human author/committer and human Signed-off-by: only, with zero AI commit trailers; PR body ends with Assisted-by:.
  • §5 Evidence: Pass across J775D and J700 (an additional T6050 laptop row with AOP enabled remains nice-to-have per @RyanTheTide, and please wait for the final 2 macOS CI checks to complete green before merging).
  • §6 Naming: Pass.

Assisted-by: LLM (Gemini 4 Neon)

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks required sections (bot) labels Nov 24, 2026
@DjDeveloperr
DjDeveloperr merged commit 5144909 into aurora-silicon:main Nov 24, 2026
23 of 25 checks passed
DjDeveloperr added a commit that referenced this pull request Nov 24, 2026
…andoff"

This reverts commit a7a616a, reversing changes made to b294045.

Reverting #470 alone restored linking on all toolchains and passed nix,
but gcc stage1 headroom landed at 3,640 B (456 B below the 4,096 B floor
in tools/stage1_size.sh). Also revert #493 (2,048 B on gcc) as the
minimum 2-PR revert set that clears the 4,096 B floor on gcc while
keeping #492, #474, #427, and #443.

Signed-off-by: Dj <43033058+DjDeveloperr@users.noreply.github.com>
kazuhidet pushed a commit to kazuhidet/aura that referenced this pull request Nov 24, 2026
…3tips/t8132-dcpext-adt-v2"

This reverts commit 7bc55fe, reversing changes made to 27847f1.

Bisecting Stage 1 size across merges since 59af506 showed that aurora-silicon#493
(a7a616a) still linked and passed gcc/fedora/alarm/nix stage1-size,
and aurora-silicon#427 (27847f1) still linked with 8,584 B text headroom on clang,
while aurora-silicon#470 (+1,626 lines in src/kboot_display_handoff.c) overflowed
Stage 1 into the DCP log buffer. Revert aurora-silicon#470 to restore a green main
tip while keeping aurora-silicon#492, aurora-silicon#493, aurora-silicon#474, aurora-silicon#427, and aurora-silicon#443.

Signed-off-by: Dj <43033058+DjDeveloperr@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks required sections (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants