Skip to content

kboot: T6050: populate and enable single-die MCC from the ADT - #493

Merged
DjDeveloperr merged 1 commit into
mainfrom
j716c/t6050-mcc-handoff
Nov 24, 2026
Merged

DjDeveloperr merged 1 commit into
mainfrom
j716c/t6050-mcc-handoff

Conversation

@erikwb

@erikwb erikwb commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Single-die T6050 Linux device trees (t6050-max.dtsi in aurora-silicon/linux#2540) describe the die-0 memory cache controller (apple,t6050-mcc) with status = "disabled" because M5 Pro (4 AMCCs / 16 planes) and both 460 GB/s (binned) and 614 GB/s (8 AMCCs / 32 planes) M5 Max SKUs share the same board trees, and Linux's apple-mcc driver probes every listed plane aperture before rejecting it. Without the bootloader populating reg from the live machine's ADT and enabling the node, system-level cache allocation stays off on single-die T6050 machines.

Change

Add dt_set_t6050_mcc() in src/kboot.c (called from kboot_prepare_dt()):

  • Locate apple,t6050-mcc in the Linux FDT. Leave already-enabled nodes untouched (preserving two-die M5 Ultra t6050-ultra.dtsi and any opted-in board trees), and leave trees with multiple apple,t6050-mcc nodes alone.
  • For a single disabled node, read the enabled AMCC mask and register windows from /arm-io/mcc (compatible = "mcc,t6050") and the plane geometry and aperture list from /chosen/lock-regs/amcc.
  • Require explicit single-die confirmation (die-count or die-enable-mask equal to 1), amcc-reg-idx, amcc-count, amcc-enable-mask, plane-count, 16 KiB-aligned plane-stride and enabled AMCC bases, non-overlapping plane apertures (total <= 64), and cross-checks against lock-regs aperture-phys-addr (plus optional aperture-count, aperture-size, dcs-channel-enable-mask, and amcc-plane-enable-mask when present).
  • Translate every 16 KiB plane aperture through the parent bus ranges using explicit #address-cells / #size-cells and verify that Linux's forward child-first ranges lookup resolves back to the same physical address before writing reg and setting status = "okay".
  • Fail closed on any missing required property, check failure, or FDT write error, leaving status = "disabled" and the original reg intact without aborting boot.

Add tests/python/test_t6050_mcc_handoff.py compiling the production src/kboot.c block unchanged against Aura's libfdt across 25 cases (full 8-AMCC J716c, 4-AMCC M5 Pro, contiguous/non-contiguous binned masks, non-identity and two-level nested ranges, overlapping child ranges, already-enabled nodes, and multi-die/missing/malformed/out-of-space fail-closed cases).

Testing

  • Formatting: clang-format --dry-run -Werror src/kboot.c — pass.
  • Host tests: pytest tests/python/test_t6050_mcc_handoff.py with GCC, Clang, and clang -fsanitize=address,undefined — pass.
  • Cross-builds & size gates:
    • NM=aarch64-linux-gnu-nm sh tools/stage1_size.sh gcc ARCH=aarch64-linux-gnu- BUILTIN_LOGO=aurora EXTRA_CFLAGS='-Wstack-usage=2048 -Os' — pass with zero size warnings (stage1 15856 B headroom, stage1-secure-audit/enforce 81568 B, stage1-dev-audit 8216 B; dt_set_t6050_mcc stack 384 B, dt_ranges_step 96 B).
    • Plain Clang Stage 2 (RELEASE=1 CHAINLOADING=1 USE_CLANG=1 BUILTIN_LOGO=aurora EXTRA_CFLAGS=-Oz) — pass.
    • ESP Stage 2 (ESP_STAGE2=1 SPTM_VIRT=1 SPTM_VIRT_GUARDED=1 SPTM_VIRT_ESP=1 AURACTL=1) — pass (esp_vital_size.py: 811080 B / 1179648 B, 368568 B free).
  • Hardware (J716c (614 GB/s M5 Max), default kernel command line, watchdog-guarded one-shot aura-try, kernel arm64: dts: apple: t6050: describe the single-die system cache controller linux#2540 (08fa25353657)):
    • Standalone PR (fc5dd4d0 on main f13056d9, 1.0.0b15-gfc5dd4d0): aura_stage2.log reports FDT: T6050 MCC: enabled (8 AMCCs, 32 planes); live /proc/device-tree/soc@2220000000/memory-controller@2220000000 has status = "okay" and 512-byte reg matching all 32 planes (0x2220000000..0x222e0c0000); apple-mcc safely defers (waiting for /soc@200000000/dcp@48ae00000 to retire boot scanout) while simpledrm owns scanout (since kboot: T6050: hand off a prewired internal panel and the combo PHY ports the tree takes #282 is not on main yet). 0 SErrors/faults/oops, 0 AVC denials, 0 new failed units (same 1 baseline aurora-peripherals.service).
    • Composed with J716c daily display handoff (f16db1b1 + fc5dd4d0, 1.0.0b13-g2b2ad2ab): aura_stage2.log reports FDT: T6050 MCC: enabled (8 AMCCs, 32 planes); live DT matches all 32 planes with status = "okay"; dmesg logs apple-dcp 48ae00000.dcp: boot scanout retired by displayed swap 6 (1.158032 s) followed by apple-mcc 2220000000.memory-controller: system level cache allocation enabled on 32 planes (1.158447 s). 0 SErrors/faults/oops, 0 AVC denials, 0 new failed units.

Still to run

  • Hardware boots on M5 Pro (amcc-enable-mask = 0xf, 4 AMCCs / 16 planes) and the binned 460 GB/s M5 Max (no hardware in lab; covered by host unit tests).

Single-die T6050 Linux device trees (t6050-max.dtsi) describe the die-0
memory cache controller (apple,t6050-mcc) with status = "disabled"
because M5 Pro and both 460 GB/s and 614 GB/s M5 Max SKUs share the same
board trees and fused-off AMCC apertures cannot be probed safely from
Linux.

When the Linux tree has a single disabled apple,t6050-mcc node, read the
enabled AMCC mask and register windows from /arm-io/mcc and the plane
geometry and aperture list from /chosen/lock-regs/amcc. Require explicit
single-die confirmation (die-count or die-enable-mask equal to 1),
amcc-enable-mask, plane-count, 16 KiB-aligned plane-stride and register
bases, non-overlapping plane apertures, and cross-checks against
lock-regs aperture addresses (plus optional aperture-count,
aperture-size, dcs-channel-enable-mask, and amcc-plane-enable-mask when
present). Translate each 16 KiB plane aperture through the parent bus
ranges using explicit #address-cells/#size-cells and verify that Linux's
forward child-first ranges lookup resolves back to the same physical
address before writing reg and setting status = "okay".

Already-enabled nodes (such as two-die M5 Ultra) are left untouched. If
any required property is missing or any required or optional check fails,
the node stays disabled with its original reg intact.

Signed-off-by: Erik Bourget <erik@ebourget.net>

@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.

Full §1–§6 pre-PR checklist audit at exact head fc5dd4d0ce1b5622cbe4c0bc382df320e8d844e0:

  • §1 No model gating — PASS: No chip, board, SKU, or firmware-version gates. Behavior is driven purely from the Linux FDT (apple,t6050-mcc, status = "disabled", explicit #address-cells/#size-cells and ranges) and the live ADT (/arm-io/mcc compatible = "mcc,t6050", explicit single-die confirmation via die-count / die-enable-mask == 1, amcc-*, optional dcs-channel-enable-mask / amcc-plane-enable-mask, and /chosen/lock-regs/amcc). Non-T6050 trees return immediately on fdt_node_offset_by_compatible < 0; already-enabled trees (including two-die M5 Ultra t6050-ultra.dtsi) are left untouched; multiple apple,t6050-mcc nodes and dual-die ADTs fail closed. Non-lab SKUs (M5 Pro, binned 460 GB/s M5 Max) are transparently called out under Still to run and covered by host tests.
  • §2 Production-ready, no hacks — PASS: Works on the default kernel command line with no new parameters, delays, retries, or lab-only paths.
  • §3 Safety — PASS (Stage-1 owner sign-off still required before merge):
    • Bounds, width, alignment, overflow, and fail-closed checks are thorough: strict 4/8-byte ADT decoding (memcpy-safe under -mstrict-align), non-zero and in-bounds bitmask checks (handling the 64-bit shift edge cleanly), 16 KiB alignment on plane-stride and enabled AMCC bases, overflow-guarded reach / base + size / plane overlap (seen[]) checks, cross-checking every enabled AMCC against /chosen/lock-regs/amcc aperture-phys-addr (and aperture-size when present), never querying or emitting disabled/fused-off AMCCs, and roundtrip-verifying reverse parent-ranges translation against Linux's child-first forward lookup before mutating the FDT. Zero MMIO touches, bounded stack/heap (<= 1536 B freed on both paths), and FDT write failures leave status = "disabled" and original reg intact without aborting boot.
    • Stage-1 note: src/kboot.c is linked into Stage-1 images (aura-raw.elf), even though dt_set_t6050_mcc() runs during Stage-2 kboot_prepare_dt(). All shipping Stage-1 flavours (stage1, stage1-secure-audit, stage1-secure-enforce) pass stage1-size across all 5 CI toolchains with 12–81 KiB headroom (the non-required lab build gcc stage1-dev-audit did not link on CI Ubuntu GCC). Keep for Stage-1 / repo owner sign-off (@RyanTheTide) before merging.
  • §4 Clean-room & attribution — PASS: Clean-room implementation using public ADT/DT interfaces; commit fc5dd4d0ce1b has human author/committer (Erik Bourget), human Signed-off-by: only, and zero AI commit trailers.
  • §5 Evidence — PASS: All 16 CI checks on fc5dd4d0ce1b are green (build, format-check, esp-stage2-size, aurora-agent-policy, all 5 test jobs compiling the production src/kboot.c slice against libfdt, and all 5 stage1-size jobs). Exact-head watchdog-guarded aura-try hardware evidence on J716c (both standalone fc5dd4d0 and composed with display handoff against aurora-silicon/linux#2540) confirms FDT: T6050 MCC: enabled (8 AMCCs, 32 planes), matching 512-byte live DT reg + status = "okay", apple-mcc enabling allocation on 32 planes after DCP scanout handoff, and 0 SErrors/AVC denials/new failed units. M5 Pro and binned 460 GB/s M5 Max hardware verification remains pending on non-lab hardware.
  • §6 Naming — PASS: Aura/Aurora naming throughout.

Minor non-blocking note: why = "ranges"; is set before the per-AMCC loop in dt_set_t6050_mcc(), so an adt_get_reg(), aperture-phys-addr/aperture-size, or plane-overlap rejection inside that loop logs "FDT: T6050 MCC: ranges; leaving disabled" rather than "ADT"/"lock-regs". Purely cosmetic in the fail-closed diagnostic string; no functional impact.

Assisted-by: LLM (Gemini 4 Neon)

@github-actions github-actions Bot added needs-template PR body lacks required sections (bot) ready-to-merge Meets the merge policy: merge it (bot) labels Nov 24, 2026
@DjDeveloperr
DjDeveloperr merged commit a7a616a into main Nov 24, 2026
17 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>
DjDeveloperr added a commit that referenced this pull request Nov 24, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Reverted in #511 (merge c0aaf3162ede) alongside #470 because Stage 1 overflowed into the DCP log buffer and gcc Stage 1 headroom fell below the 4,096 B floor; it can come back once it fits by shrinking it or making room elsewhere. Thanks, Erik.

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>
@RyanTheTide
RyanTheTide deleted the j716c/t6050-mcc-handoff branch November 27, 2026 13:21
techmore pushed a commit to techmore/aura that referenced this pull request Nov 30, 2026
The T6050 MCC handoff (aurora-silicon#493) was reverted in aurora-silicon#511 because Stage 1 ran
out of room under the DCP log buffer. Build it into the ESP Stage 2 only,
which is the stage that boots Linux in the normal Stage 1 -> ESP Stage 2
chain. A direct Stage 1 boot leaves the node disabled, so the system level
cache stays off there, as on main today.

Signed-off-by: DjDeveloperr <hey@djdev.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-template PR body lacks required sections (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants