Skip to content

kboot: T6050: hand off a prewired internal panel and the combo PHY ports the tree takes - #282

Open
erikwb wants to merge 12 commits into
mainfrom
j716c/t6050-display-handoff
Open

erikwb wants to merge 12 commits into
mainfrom
j716c/t6050-display-handoff

Conversation

@erikwb

@erikwb erikwb commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What: Extend t6050_handoff() and kboot_setup_atc() to support prewired T6050 device trees (matching the internal display by coprocessor address with prewired clocks and apple,bw-scratch, and copying combo PHY tunables by apple,t6050-combo-phy + apple,guest-port-reserved), and validate, reject, and version-stamp input-DT-enabled apple,t6050-dcpext external engines (t6050_ext_reject(), t6050_ext_version()). Also place the T6050 display and ATC handoff helpers in .rodata.xtext via AURA_XTEXT so Stage 1 links below the DCP log buffer.

Tested: J716c (16-inch M5 Max, T6050, 27.2 stub) one-shot aura-try Stage 2 boot at e6a3bcb13fca (1.0.0b17-ge6a3bcb1): eDP-1 up at 3456x2234@120, all 4 apple,t6050-dcpext engines at apple,firmware-version/apple,firmware-compat (27, 2, 0), 4 apple,t6050-combo-phy nodes with tunables, 0 new kernel errors and 0 new failed units; the main (26c1a85bb788) control boot on the same Mac fell back to a 60 Hz simplefb with (27, 0, 0) engines. Host unit, shell, format, Stage 1 size (clang, GCC 16.2, Ubuntu 24.04 GCC 13.3), and ESP Stage 2 size checks also pass at e6a3bcb13fca.

Risk: one-way door (Stage 1 code in src/kboot_display_handoff.c and src/kboot_atc.c; Stage 2 on ESP is reversible) · T6050 Macs (J716c, J714s, J775D, K114s) and Stage 1 image size.

Not yet:

  • Full GitHub CI on e6a3bcb13fca (including BUILDSTD=1 esp-stage2-size, stage1-size fedora/alarm/nix/clang-macos, and macOS Pytest).
  • Stage 1 and T6050 board owners' sign-off.
  • Undocked s2idle resume (pending hardware alarm IRQ support) and a live external-monitor check on J716c at e6a3bcb13fca (the boot above checks the handed-over DT nodes, not a monitor on a Type-C port). The GPU stays disabled because #282 carries no GPU handoff.
  • Post-merge rows (agreed with maintainers): J714s (internal panel) and J775D (headless scanout) with a Type-C device on port 1–5, and J716c on the 27.0 stub.
Details

Branch progression over main (26c1a85bb788, merged as 15191b3c2b06):

  • 39b5db2b / 0113c4ee: initial prewired T6050 internal-panel and combo PHY handoff plus external-engine firmware version stamping.
  • 4101923fe382: scoped the external-engine pass via t6050.ext_aura to input-DT-enabled engines.
  • be98aca94ec8 / f6e5eaceec09: required unique coprocessor register matches in t6050_node_at() and t6050_ext_index(), recorded ambiguous ADT indices up front in t6050_ext_reject(), and preserved the ADT index for scanout DART cleanup.
  • 15191b3c2b06: merged main (26c1a85bb788), updating t6041_headless_fb() -> t6041_headless_display(dt) in tests/python/test_t6050_handoff_bounds.py.
  • 9b661123e3d0: failed closed on external-engine version/allocation errors in t6050_ext_version().
  • 1458e4eb7cba: placed the T6050 display and ATC handoff helpers in .rodata.xtext via AURA_XTEXT.
  • d3184b1778fc: kept fdt_addresses.c out of fdt_harness.LIBFDT_SOURCES so tests/python/test_wdt_arm.py does not link it twice.
  • 1ddba986798f: extracted t6050_check_ext_live() so t6050_check_ext_adt() verifies live power, CPU run, and DART lock/TTBR state against the ADT roots before retaining scanout or version-stamping.
  • e6a3bcb13fca: if t6050_check_ext_adt() fails during t6050_ext_version() after passing t6050_ext_reject(), disabled the engine and stripped its scanout entry via t6050_ext_disable() instead of skipping it with original firmware properties intact, and deferred done |= 1u << n until a clean version update so rescans after enclosing display-subsystem deletion cannot skip an engine.

Design & integration notes:
Under the inherited chip_id != T6050 dispatch check in dt_set_display_handoff() (and directly from apple,t6050-combo-phy in kboot_setup_atc()), the new node matching tests no board compatible or chip sub-variant; each keys on the device tree or the ADT:

  • Prewired internal display (t6050_prewired(), t6050_handoff(), t6050_check_prewired(), t6050_disp_node()): Finds apple,t6050-dcp by its unique ADT coprocessor address (t6050_node_at()) and the single apple,display-subsystem node by compatible (refusing a second display subsystem). Verifies apple,clock-ids against disp0 clock IDs in order, checks that each clock is a distinct available fixed-clock with #clock-cells = <0>, and validates apple,bw-scratch against disp0 bandwidth agent metadata. Register windows for dcp, external engines (t6050_ext_index()), DARTs, and the PMC node must reach the CPU 1:1 with 2/2 address/size cells and identity ranges (t6050_identity_reg()).
  • External scanout DARTs, placement, and live DART root check (t6050_check_ext_scanout(), t6050_check_ext_adt(), t6050_check_ext_live(), t6050_check_placement(), t6050_publish_prewired()): External display DARTs listed in apple,display-subsystem iommus are matched to ADT dart-dispextN by CPU address, checked for page-aligned pt-region outside OS RAM holding the l1-tt root, and validated for iop-dcpextN-nub running == 1, valid/pinned UUID, non-__OS_LOG segment-ranges, pt-region-23 (dart-dcpextN), and pt-region-16 (dart-dispextN) outside OS RAM. t6050_check_ext_adt() then invokes t6050_check_ext_live() (shared with t6050_ext_one()) to check PMGR power domains, ASC_CPU_CONTROL_RUN, and both DART streams (DART_T8110_PROTECT_TTBR_TCR, four-level translate TCR, valid TTBR matching the ADT l1-tt root) under dcp6_guard_begin()/dcp6_guard_end() before t6050_publish_prewired() retains scanout or t6050_ext_version() stamps firmware properties. Failed external engines are dropped from apple,display-subsystem iommus while keeping the internal panel handoff intact.
  • Combo PHY tunables (kboot_setup_atc(), t6050_setup_atc()): Keyed on apple,t6050-combo-phy, copying tunables whole and in ADT order (including RX clock groups) for each port carrying apple,guest-port-reserved, including port 0 where the tree claims it.
  • External-engine rejection & fail-closed firmware version (t6050_ext_disable(), t6050_ext_reject(), t6050_drop_ext_scanout(), t6050_ext_walk(), t6050_available(), t6050_ext_version_one(), t6050_ext_version()): Before checking os_firmware, t6050_ext_reject() runs on a scratch copy (falling back to in-place edits if scratch allocation fails), skips engines Aura just enabled itself (t6050.ext_aura, recorded when t6050_ext_one() commits in t6050_headless_handoff() / t6050_ext_handoff()), uses first-string status matching (t6050_available()), and calls t6050_ext_disable() to strip any failing or unmatched input-DT-enabled apple,t6050-dcpext engine from apple,display-subsystem iommus in place via fdt_getprop_w() + fdt_setprop_placeholder() without a 128-byte cap and disable (or delete via fdt_del_node() on packed trees) the rejected node. For known os_firmware, t6050_ext_version() re-checks t6050_check_ext_adt(n) and updates apple,firmware-compat and existing apple,firmware-version per surviving engine via t6050_ext_version_one() in its own scratch transaction; if the live/ADT check fails or if scratch allocation, any property write, or commit fails, it calls t6050_ext_disable() so no input-enabled engine remains active advertising stale apple,firmware-compat.
  • Stage 1 .rodata.xtext placement (1458e4eb7cba): T6050_INIT / T6050_TEXT in src/kboot_display_handoff.c and T6050_ATC / T6050_ATC_INIT in src/kboot_atc.c expand to AURA_XTEXT (.rodata.xtext, noinline, mapped executable in src/memory.c) with __attribute__((minsize)) guarded by #ifdef __clang__, freeing .init + .text headroom before the DCP log buffer in aura-raw.ld.
  • Host test harness compatibility (d3184b1778fc): Keeps fdt_addresses.c out of fdt_harness.LIBFDT_SOURCES and appends it only inside fdt_harness.run(), because tests/python/test_wdt_arm.py::test_dt_set_wdt_reconfig (merged from main) appends fdt_addresses.c to LIBFDT_SOURCES itself and failed Pytest with duplicate-symbol linker errors when LIBFDT_SOURCES already contained it.
  • Merge-order & coordination notes: Combining main + #281 + #282 at 1458e4eb7cba failed Stage 1 link with ld.lld: error: Code and data reach the DCP log buffer after stage 1! under clang, clang -Oz, and gcc (each PR links alone), so #281 + #282 require Stage 1 size reconciliation if merged together; t6050_check_placement() should also be reconciled with #471 if #471 lands first.
  • Test coverage notes: Duplicate-node, malformed external-engine, live-vs-ADT DART mismatch, post-rejection live failure, and fail-closed version-write paths are covered by the host pytest suites; unattended s2idle RTC wake on J716c is currently blocked because apple,t6050-pmu-rtc in t6050-j716c-sleep.dtsi has no interrupts and rtc-apple-pmu.c has no generation-4 SPMI alarm IRQ yet (confirmed by rtcwake -m no -s 5 leaving wakealarm set with alrm_pending: no).
Evidence

Local & container verification at e6a3bcb13fca:

  • pytest -q tests/python/test_wdt_arm.py tests/python/test_rtbuddyseg_logs.py tests/python/test_t6050_tree_shape.py tests/python/test_t6050_handoff_bounds.py: 167 passed (cc), 167 passed (CC=clang).
  • pytest -q tests/python/test_dcp6_max_brightness.py tests/python/test_t6041_display_handoff.py tests/python/test_t6041_27_display_handoff.py tests/python/test_oslog_reservation.py tests/python/test_dcp_fw27_clocks.py tests/python/test_dcp_typec_routes_adt.py tests/python/test_display_dart_view.py tests/python/test_m4_dcp_handoff.py tests/python/test_ave_handoff.py tests/python/test_t6031_runner_failures.py tests/python/test_stage1_room.py tests/python/test_rela_layout.py: 182 passed, 1 skipped (cc; CC=clang passes 153, skips 1, and fails setup on test_display_dart_view.py's pre-existing unused dart_gen3_tlbi_broadcast).
  • sh tests/run-t8122-display-handoff.sh, sh tests/run-fdt-disable.sh, sh tests/run-aop-os-ram.sh, sh tests/run-pmp-boot-data.sh, sh tests/run-t8122-gpu26-identity.sh, sh tests/run-rtkit-placed-buffer.sh (cc and CC=clang): all 6 pass under both compilers.
  • clang-format --dry-run -Werror src/kboot_display_handoff.c src/kboot_atc.c: pass.
  • make rustfmt-check: pass.
  • NM=llvm-nm sh tools/stage1_size.sh clang USE_CLANG=1 BUILTIN_LOGO=aurora: clang stage1 7752 B headroom (_file_vital_end 0x11d010), stage1-secure-audit and stage1-secure-enforce 77928 B, optional stage1-dev-audit 2520 B.
  • NM=aarch64-linux-gnu-nm sh tools/stage1_size.sh gcc ARCH=aarch64-linux- BUILTIN_LOGO=aurora EXTRA_CFLAGS='-Wstack-usage=2048 -Os': gcc stage1 6584 B headroom (_file_vital_end 0x11d228), stage1-secure-audit and stage1-secure-enforce 77448 B, optional stage1-dev-audit 1504 B.
  • Ubuntu 24.04 container (aarch64-linux-gnu-gcc 13.3.0): gcc13 stage1 6152 B headroom (_file_vital_end 0x11d1d8), stage1-secure-audit and stage1-secure-enforce 77528 B (optional stage1-dev-audit does not link).
  • esp-stage2-size (CARGO_PROFILE_RELEASE_OPT_LEVEL=z make -j$(nproc) USE_CLANG=1 BUILTIN_LOGO=aurora RELEASE=1 CHAINLOADING=1 EXTRA_CFLAGS=-Oz ESP_STAGE2=1 SPTM_VIRT=1 SPTM_VIRT_ESP=1 AURACTL=1 without BUILDSTD=1, plus tools/esp-macos/esp_vital_size.py build/aura-raw.elf --nm llvm-nm): ESP vital region: 811160 B (0xc6098), 368488 B free.
  • make -j$(nproc) ARCH=aarch64-linux-gnu- CHAINLOADING=1 EXTRA_CFLAGS='-Wstack-usage=2048 -Os', make -j$(nproc) ARCH=aarch64-linux-gnu- CHAINLOADING=1 ESP_STAGE2=1 EXTRA_CFLAGS='-Wstack-usage=2048 -Os', and make -j$(nproc) RELEASE=1 CHAINLOADING=1 USE_CLANG=1 ESP_STAGE2=1 (aura.bin sha256 prefix 24c2d8fde8eb620d, BUILD_TAG "1.0.0b17-ge6a3bcb1"): pass.

Hardware run at e6a3bcb13fca (J716c M5 Max, T6050, 27.2 stub, Linux 7.3.0, default kernel command line, one-shot aura-try Stage 2 with the default payload tail appended; the default stage2.bin was never touched, sha256 21edee972e1ff171… before and after):

  • Build: make -j$(nproc) RELEASE=1 CHAINLOADING=1 USE_CLANG=1 ESP_STAGE2=1; PR aura.bin (3,997,696 B) sha256 24c2d8fde8eb620d… (the prefix in the build line above), control main 26c1a85bb788 aura.bin (3,997,696 B) sha256 ce40f9c41946f13b….
  • Trial boot 1.0.0b17-ge6a3bcb1:
    • Display: apple-drm card with eDP-1 at 3456x2234@120; dcp@48ae00000 status = "okay" with apple,bw-scratch present.
    • External engines: all 4 apple,t6050-dcpext nodes (dcp@2b2e00000, dcp@302e00000, dcp@306e00000, dcp@392e00000) status = "okay" with apple,firmware-version and apple,firmware-compat both (27, 2, 0).
    • Combo PHYs: 4 apple,t6050-combo-phy nodes (phy@2a3000000, phy@2ab000000, phy@383000000, phy@38b000000; the 3 active ones carry full apple,tunable-* sets) and 6 Type-C port nodes.
    • GPU disabled, as expected.
    • dmesg -l err,crit,alert,emerg: 40 lines vs 43 on the default Stage 2; 0 new display, DCP, ATC or DART errors. The only trial-specific line, apple-pmp-report-entry 284240000.pmp-report:report@f: probe failed -110, also appears in the main control (no GPU handoff). 0 new failed units.
  • Control boot of main (26c1a85bb788, 1.0.0b17-g26c1a85b) on the same Mac: simple-framebuffer card with Unknown-1 at 3456x2234@60; dcp@48ae00000 status = "disabled"; all 4 apple,t6050-dcpext engines left at (27, 0, 0); 2b2e00000.dcp and 302e00000.dcp probe failed with -110; apple-t6050-dp-phy 2a3000000.phy failed with -ENOENT (missing or invalid apple,tunable-axi2af).
  • Return to default: rebooted cleanly to the default Stage 2 (1.0.0b17-g00976384, eDP-1 at 3456x2234@120), trial binaries deleted, aura-try marker restored, default stage2.bin sha256 verified unchanged.

Earlier hardware verification at superseded head 1458e4eb7cba (J716c M5 Max, 27.2 stub, one-shot aura-try Stage 2):

  • Built with make RELEASE=1 CHAINLOADING=1 USE_CLANG=1 ESP_STAGE2=1 (aura.bin sha256 prefix 34bfcaf4184d84ee, chosen/asahi,m1n1-stage2-version 1.0.0b17-g1458e4eb), staged with the default payload tail via aura-try into the default kernel (default stage2.bin untouched).
  • Control boot of main (26c1a85bb788, 1.0.0b17-g26c1a85b) without #282: no panel driver (simple framebuffer Unknown-1 at 60 Hz), GPU disabled, 6 kernel err lines.
  • #282 boot (1.0.0b17-g1458e4eb): eDP-1 up at 3456x2234@120; all 4 apple,t6050-dcpext engines handed over with apple,firmware-version and apple,firmware-compat = <0x1b 0x02 0x00> and apple,tunable present; 4 combo-PHY nodes and Type-C port0–port3 present; 39 unique kernel err lines vs 40 on the default Stage 2 (0 new, differing only by PID-numbered generator lines and one md-manager AFK message); 0 new failed units (aurora-peripherals.service pre-existing on default); GPU stays disabled because #282 alone has no GPU handoff.

Earlier hardware run (superseded, head 71708f74 on #427 2e2d7e71 + #281, Linux 7.3.0 with #2185 and #2187, default cmdline):

  • J716c (M5 Max, 27.2 stub): internal panel (3456x2234) and two 4K Thunderbolt dock monitors up; four apple,t6050-dcpext nodes carried apple,firmware-compat and apple,firmware-version <27 2 0>.

@erikwb erikwb closed this Nov 17, 2026
@erikwb erikwb reopened this Nov 17, 2026
@erikwb
erikwb force-pushed the j716c/t6050-display-handoff branch from 9efa489 to 3cb4003 Compare November 17, 2026 21:04
erikwb added a commit that referenced this pull request Nov 17, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the J716c display and Type-C handoff; that's a big piece of work.

Several branches are selected by the board compatible rather than by a hardware property: src/kboot.c:770, :8150, :8186, src/kboot_atc.c:939, :1286 and src/kboot_display_handoff.c:4451 all test chip_id == T6050 plus apple,j716c. That also makes the J716c a second T6050 display path (dt_set_display_j716c()) next to t6050_handoff(), and a second ATC path next to t6050_setup_atc().

We select behaviour by a hardware property and extend one path. The comment at :8185 names the property: the tree "describes its inherited display by address, with clocks and scratch prewired". Could the T6050 handoff branch on that tree shape, and could the ATC copy key on the apple,t6050-combo-phy node alone? Naming RTBuddySeg firmware logs no-map (dt_reserve_j716c_oslogs()) holds on every chip whose ADT has RTBuddySeg.

We can't run a T6050 ourselves, but are glad to help line up owner rows.

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

Thanks for the J716c display and Type-C handoff. The 27.2 row with all three displays and a deep-sleep resume is great, and rewriting apple,firmware-compat on each apple,t6050-dcpext node from the stub's version is a good catch.

I agree with Ryan's comment, and it is what holds the merge. Six branches are chosen by chip_id == T6050 plus apple,j716c:

  • src/kboot.c:770, :8150, :8186
  • src/kboot_atc.c:939, :1286
  • src/kboot_display_handoff.c:4451

That gate also creates a second T6050 display path (dt_set_display_j716c()) next to t6050_handoff(), and a second ATC path next to t6050_setup_atc().

What would make it mergeable:

  • Key the T6050 handoff on the tree shape that the comment at :8185 already names: the inherited display is described by address, with clocks and scratch prewired.
  • Key the combo-PHY tunable copy on the apple,t6050-combo-phy node alone.
  • Reserve RTBuddySeg logs as no-map on every chip whose ADT has them (dt_reserve_j716c_oslogs()). The overlap rules you wrote (inside the retained heap or image reservation, refused otherwise) are the right ones to keep.
  • The dcpext firmware-version rewrite already keys on the node, so it needs no board check either.

New: the red format-check is base drift, not this PR. Every violation is in src/sptm_virt_s2r.c, which main has since fixed, and the four files you touch pass clang-format 20.1.8 at this head.

Once reworked and green, it merges. These rows come after the merge, with a revert ready:

  • your J716c display and deep-sleep rows on 27.0 and 27.2;
  • a J714s and J775D display no-regression row for the shared T6050 path.

@erikwb erikwb changed the title kboot: T6050: hand off the J716c internal panel and Type-C display PHYs kboot: T6050: hand off a prewired internal panel and the combo PHY ports the tree takes Nov 21, 2026
@erikwb
erikwb force-pushed the j716c/t6050-display-handoff branch from dba81b8 to dcb82ac Compare November 21, 2026 03:42
@erikwb
erikwb changed the base branch from main to j716c/rtbuddyseg-logs-no-map November 21, 2026 03:42
@erikwb

erikwb commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of erikwb

Thanks @RyanTheTide and @DjDeveloperr. Reworked along those lines; no branch tests chip_id plus apple,j716c any more:

  • Display: dt_set_display_j716c() is gone. t6050_handoff() now also takes the prewired tree shape (dcp found by its coprocessor address, clocks/apple,clock-ids/apple,bw-scratch already present). It checks those properties against the ADT instead of refusing them, and otherwise shares the aliased tree's checks and publication.
  • ATC: the second path is gone. The combo PHY tunable copy is selected by the apple,t6050-combo-phy node and runs for each port the tree hands to the OS (apple,guest-port-reserved).
  • RTBuddySeg logs: moved to their own PR, kboot: name the RTBuddySeg firmware logs no-map #427, which applies on every chip whose ADT has RTBuddySeg, with the same overlap rules. This PR is now stacked on it.
  • dcpext version: unchanged in spirit; it keys on the available apple,t6050-dcpext nodes only.

The J716c rows on the 27.2 stub are in the description. 27.0 and the J714s/J775D no-regression rows will follow after the merge, as you suggested.

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

No blockers. Re-checked dcb82ac (on top of #427) against our 11-19 comment.

Earlier points, all resolved:

  • No branch tests chip_id == T6050 plus apple,j716c any more. dt_set_display_j716c() and the second ATC path are gone, and the only j716c left in src/ outside comments is the existing ISP table.
  • The handoff picks the prewired shape from the tree (t6050_prewired(): a dcp node at the ADT coprocessor address carrying clocks, apple,clock-ids and apple,bw-scratch). It is tried after the aliased and headless shapes, and the headless match needs exactly one iommus entry, so a prewired tree can't fall into the headless path.
  • kboot_setup_atc() (src/kboot_atc.c:1316) now keys on the apple,t6050-combo-phy node, and the RTBuddySeg logs moved to #427.

The new checks fail safe: a missing or mismatched clocks/apple,clock-ids, bad scratch cells, a non-identity ranges, a DART mismatch or a pt-region in OS RAM all bail before the scratch copy is committed, so the panel stays on the boot framebuffer.

Three smaller points:

  1. src/kboot_atc.c:1209-1210: the RX clock groups are now cut to 4 records. That table is shared with every T6050 board (J714s, J775D), so ports 1-5 there change too, not only the J716c. The fixed 4 also silently drops records if a later ADT lays the group out differently. Please derive the count from the group itself: for example, require the group to be exactly two halves of equal size and copy the first half, and keep the whole group (with a log line) otherwise. Please also move the J714s/J775D Type-C no-regression row ahead of the merge, since that path changes for them.
  2. src/kboot_display_handoff.c:3731: the prewired path takes the first apple,display-subsystem node, while the comment at t6050_check_dt() says there is one display subsystem. Refuse the prewired shape when a second one exists, so a multi-die tree can't hand off the wrong one.
  3. src/kboot_display_handoff.c:4311: when the stub's version is not three cells, the external engines the tree enables keep the tree's version, and the driver uses that version's method IDs. That is the mismatch this commit fixes. The edit is made on a dcp6_scratch() copy, and t6050_publish() already uses firmware_set_fdt() on such a copy for the internal dcp. Using it here too would handle a four-cell version, and a failed write would still change nothing. Otherwise, at least say in the log that those engines will use the wrong method IDs.

We can't run a T6050. The J716c rows in the description cover the new shape. The J714s and J775D rows (internal panel or headless scanout, plus a Type-C port 1-5 device) cover the shared path and point 1.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 2.

The tree-shape selection and the combo-phy keying look right to me. The three points in the 11-21 03:54Z review (the fixed 4 RX clock records at src/kboot_atc.c:1209-1210, a second display subsystem at src/kboot_display_handoff.c:3731, the non-three-cell version at :4311) are still open at dcb82ac. Two more:

  1. CI is red at this head. Pytest on macos-15 fails tests/python/test_rtbuddyseg_logs.py::test_rtbuddyseg_logs_named_from_the_adt with -Werror,-Wformat (%lx given a u64, which is unsigned long long on macOS). The other Pytest jobs were then cancelled and never ran. The test comes from kboot: name the RTBuddySeg firmware logs no-map #427, the base of this stack. Fix it there (the fdt_harness.py u64 typedef noted on kboot: name the RTBuddySeg firmware logs no-map #427), then rebase this PR and get a full green run.

  2. Both commit messages carry "Developed with Claude Code." and the PR description ends with the Claude Code emoji line. Please take the line out of the commits (keep the Signed-off-by) and end the description with Assisted-by: LLM (<Vendor>:<Model>).

Checked: apple,guest-port-reserved now gates ports 1-5 too (src/kboot_atc.c:1285-1287), where before they were always exported. The integration/aurora binding makes the property required on every apple,t6050-combo-phy node with a port index, and die0, dieX, ultra and j716c-left-usb4 carry it, so the current in-tree J714s/J775D trees keep their tunables. An older tree without it now gets no tunables on those ports, and the driver refuses such a port anyway (atc-t6050-dp.c:934). t6050_ext_version() (src/kboot_display_handoff.c:4302-4345) is transactional and only touches available apple,t6050-dcpext nodes. On J714s/J775D trees those nodes are disabled, so they are unchanged.

HW row: J714s (internal panel) and J775D (headless scanout), each with a Type-C device on a port 1-5, on this head: display up, the port enumerates, the same tunable set as main apart from the RX-clock change, 0 new kernel errors, 0 failed units. Run these before the merge, because the ATC table and the port filter change for them too. Plus the promised J716c row on 27.0.

Assisted-by: LLM (Claude:Opus 5.5)

@erikwb
erikwb force-pushed the j716c/rtbuddyseg-logs-no-map branch from 0ee24fc to 2e2d7e7 Compare November 21, 2026 21:01
@erikwb
erikwb force-pushed the j716c/t6050-display-handoff branch from dcb82ac to 71708f7 Compare November 21, 2026 21:01
@erikwb

erikwb commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of erikwb

@RyanTheTide, thanks. The stack is now 2e2d7e7 (#427) ← 6b8cc4a ← 71708f7, rebased onto main 58e712b. Both commits of this PR were amended in place.

  1. RX clock groups (src/kboot_atc.c): no group is cut any more, by a fixed count or by its layout. Every T6050 tunable group, the RX clock ones included, is copied whole and in the ADT's order, as main does.
    • An earlier revision cut "a setting and then its reverse", recognized by two halves that write the same registers, widths and masks. Matching fields don't prove an undo. A later record can just as well install the final value of a field written earlier, and the driver applies the records in order (atc_step() → apple_tunable_apply() in atc-t6050-dp.c), so cutting could drop exactly those writes.
    • On the J716c the group is four records on four different registers of the lane's RX clock bank, on every port and both lanes. The halves check never matched there, so the same records are copied as before, and the per-port log line it printed is gone.
    • test_t6050_rx_clock_groups_pass_whole (replacing test_t6050_rx_clock_setting_half) uses synthetic records with the same shape. It checks that a four-record group reaches the tree unchanged and in order, which is what the driver reads from apple,tunable-lane{0,1}-rx-clock. It also checks that an eight-record group revisiting the same registers and fields passes whole and in order (in both orders, and the group repeated whole), that an odd group passes whole, and that a record outside its bank fails the port.
    • The J714s and J775D rows stay listed as needed before merge, with your criteria: display up, the Type-C port 1-5 device enumerates, the same tunable set as main, 0 new kernel errors, 0 failed units. The J716c 27.0 row is listed as still to run. On those boards this path now copies the groups exactly as main does. Their ports 1-5 all carry apple,guest-port-reserved in the current integration/aurora trees, so they are selected as before.
  2. Second display subsystem: the prewired path refuses a tree with a second apple,display-subsystem node, and the aliased path still uses disp0. test_t6050_prewired_display_subsystem_is_the_only_one covers it.
  3. dcpext version: the edit now works as you suggested. It is made on a dcp6_scratch() copy and published with firmware_set_fdt(), like the internal dcp's, so the stub's version is serialized with all its cells (a four-cell version included), and a failed write leaves the whole tree as it was.
    • For a known stub version, every available apple,t6050-dcpext node gets apple,firmware-compat, added where the node has none, and apple,firmware-version where the node has one. The fixture covers the three-cell, four-cell, missing-compat, no-room and unknown-version cases and a disabled engine.
    • Whether the kernel can drive that firmware is a separate question: Linux's selector in iomfb_v27.c accepts only exactly registered versions, so an old kernel without the matching method table still can't drive it.

From your 06:15 comment:

  • CI: the u64 fix is in kboot: name the RTBuddySeg firmware logs no-map #427's fdt_harness.py (typedef unsigned long u64; with the _Static_assert, plus a u64 * shim for fdt_get_mem_rsv), and this PR is rebased onto it. The generated fixtures compile clean for arm64-apple-macos with -Werror in a local cross-compile on Linux. All four pytest jobs, the macos-* ones included, still have to run to completion on this head.
  • Disclosure: the description now ends with Assisted-by: LLM (Claude:Opus 5.5). The Developed with Claude Code. line is gone from the commit messages; the description's last line is the only disclosure.

Other checks:

  • The full tests/python run: 815 passed, 25 skipped; the only failures are the two test_loadobjs.py cases that main 58e712b also fails on this host (806 passed there), where the host's nm prints symbols in another order.
  • Release builds with and without ESP_STAGE2=1 give the same 12 warnings as main 58e712b. make format-check with clang-format 20.1.8 is clean.

J716c row (this head, on #427 and with #281, 27.2 stub): panel and two 4K monitors over a Thunderbolt dock are up. The four apple,t6050-dcpext nodes carry <27 2 0>. Against the earlier revision on the same setup, every combo PHY, apple,t6050-dcpext and display subsystem property is byte-identical, the RX clock tunables included, apart from memory-region's phandle number (same framebuffer@ node). Docked deep sleep was refused by the dock's PCIe tunnel before sleep, the same way on the base Stage 2, so the resume row is still to run, undocked, along with the J716c 27.0 row.

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

No blockers in the code. Re-checked 6b8cc4a and 71708f7 (on #427 at 2e2d7e7) against our 03:54Z and 16:57Z comments.

Resolved:

  • RX clock groups (src/kboot_atc.c): every T6050 tunable group is copied whole and in the ADT's order, as on main. The J714s and J775D tunables are therefore unchanged by this PR.
  • A second display subsystem: t6050_disp_node() (src/kboot_display_handoff.c:3736) refuses the prewired shape when a second apple,display-subsystem node exists. The aliased path keeps disp0.
  • dcpext version: t6050_ext_version() (:4329) writes through firmware_set_fdt() on a dcp6_scratch() copy, so a four-cell version is serialized whole and a failed write changes nothing. It touches only available apple,t6050-dcpext nodes, and those are disabled in the J714s/J775D trees.
  • The disclosure lines are out of both commits, and the description ends with the Assisted-by line.

Still open: CI. Because this PR's base is #427's branch, only the policy and size jobs ran on this head, not Pytest. test_t6050_tree_shape.py and test_rtbuddyseg_logs.py pass for us on a Linux host at 71708f7, but the macOS jobs haven't built these fixtures. After #427 merges, please retarget this PR to main and get a full green run before it merges.

HW rows still needed before merge, as you listed: J714s (internal panel) and J775D (headless scanout), each with a Type-C device on a port 1-5. Pass: display up, the port enumerates, the same tunable set as main, 0 new kernel errors, 0 failed units. Then the undocked J716c s2idle resume row and the J716c row on 27.0.

Assisted-by: LLM (Claude:Opus 5.5)

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

Re-review at 71708f74110f (stacked on #427 2e2d7e71): 0 code, policy, or attribution blockers remain.

Our earlier CHANGES_REQUESTED blockers from dba81b8 and @RyanTheTide's follow-up items are all resolved:

  • No chip/board gates (§1): dt_set_display_j716c() and the second ATC path are gone. t6050_handoff(dt, true) keys on the prewired tree shape (t6050_prewired()), kboot_setup_atc() keys on apple,t6050-combo-phy, t6050_setup_atc() copies every port with apple,guest-port-reserved (0..5) whole and in ADT order (no RX-clock truncation), and RTBuddySeg log reservation moved to #427 for all chips.
  • Validation & fail-soft transactions (§2/§3): t6050_identity_reg(), t6050_check_prewired(), t6050_disp_node() (refusing a second apple,display-subsystem), t6050_check_ext_scanout() / t6050_ext_display_dart(), and the ADT pt-region alignment/bounds/OS-RAM checks all bail before committing the scratch copy. t6050_ext_version() updates available apple,t6050-dcpext nodes transactionally via firmware_set_fdt() (handling 3- and 4-cell versions and leaving disabled nodes untouched).
  • Attribution (§4): Both commits (6b8cc4a6, 71708f74) carry human author/committer and Signed-off-by: only.

Still owed before approval/merge:

  1. Stacked base & full CI: Merge #427 (2e2d7e71), retarget #282 onto main, and get a full green CI run on this head (only policy and ESP stage 2 vital size ran against #427's branch; build, format-check, stage1-size, and all Linux/macOS Pytest jobs still need to run on 71708f74).
  2. Hardware rows (§5): J714s (internal panel) and J775D (headless scanout) each with a Type-C device on port 1-5 (display up, port enumerates, same tunable set as main, 0 new kernel errors, 0 failed units), plus undocked J716c s2idle resume and the J716c 27.0 stub row.

@erikwb

erikwb commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Gemini 4 Neon responding on behalf of erikwb

Thanks @RyanTheTide and @DjDeveloperr for confirming zero code, policy, or attribution blockers on 71708f74110f.

@erikwb
erikwb force-pushed the j716c/rtbuddyseg-logs-no-map branch from e6e66a9 to 78337e0 Compare November 22, 2026 16:54
@erikwb
erikwb force-pushed the j716c/t6050-display-handoff branch from 8907fa6 to 545f0ef Compare November 22, 2026 16:54
@erikwb

erikwb commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Gemini 4 Neon responding on behalf of erikwb

Restacked cleanly onto the rebased #427 head (78337e0085b4, on main 56299352) as da106863ed60 → 545f0ef504f8, dropping the overnight gfya (0d0707a3, github-actions[bot]) and policy-restore (8907fa62) commits. Both commits remain human-signed with no code changes from 6b8cc4a6 / 71708f74.

  • Local checks on 545f0ef504f8: clang-format --dry-run -Werror src/kboot_atc.c src/kboot_display_handoff.c clean; pytest -q tests/python/test_t6050_tree_shape.py tests/python/test_rtbuddyseg_logs.py 9 passed; make RELEASE=1 CHAINLOADING=1 USE_CLANG=1 and ESP_STAGE2=1 build cleanly.
  • Still open: Retargeting onto main for a full CI run once kboot: name the RTBuddySeg firmware logs no-map #427 merges, plus the remaining §5 hardware rows (J716c undocked s2idle resume and 27.0 stub row on our side; J714s internal panel and J775D headless scanout with Type-C port 1–5 devices from lab/owners).

@RyanTheTide

Copy link
Copy Markdown
Contributor

Could the external engines this PR enables from the tree get the same placement checks as the internal display before they are handed over? On the internal side, t6050_check_adt() keeps every iop-dcp-nub segment except __OS_LOG out of [phys_base, +mem_size), and for a prewired tree t6050_check_darts() requires pt-region-23/0/16 to hold the l1-tt root and stay out of that range.

For an engine the tree enables itself, t6050_ext_one() returns early, t6050_ext_version() then rewrites apple,firmware-compat/-version on every available apple,t6050-dcpext node, and t6050_check_ext_scanout() accepts their display DARTs in disp0's iommus. None of these checks where that engine's firmware segments (iop-dcpextN-nub segment-ranges) or page tables (pt-region-23 of dart-dcpextN, pt-region-16 of dart-dispextN) lie.

Suggestion: run a per-engine placement check (segment-ranges and pt-regions against RAM, parameterised by the nub and DART paths) for each tree-enabled engine, and have t6050_ext_version() skip an engine that fails it, or that fails the uuid/running check t6050_ext_one() makes, with a log line. I'm adding that helper on main for the t6050_ext_one() path and the headless /vram check in a separate PR, so this PR could call it once that lands.

Assisted-by: LLM (Claude:Opus 5.5)

@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 545f0ef504f8 (base j716c/rtbuddyseg-logs-no-map / #427, only 3 CI checks ran).

Stage 1 Impact

  • Touches Stage 1: Yes. Modifies src/kboot_atc.c and src/kboot_display_handoff.c (both in unconditional OBJECTS). Requires Stage 1 owner sign-off under §3 before merge — and stage1-size has not yet run on 545f0ef504f8.

Audit Summary

  • §1 No model gating: Pass. No chip/board gates (t6050_handoff(dt, true) keys on t6050_prewired(), kboot_setup_atc() keys on apple,t6050-combo-phy, RX clock tunable groups are copied whole in ADT order).
  • §4 Attribution: Pass. Both commits (da106863ed60, 545f0ef504f8) carry human author/committer Erik Bourget <erik@ebourget.net> and human Signed-off-by: only, with zero AI commit trailers; PR body ends with Assisted-by:.
  • §2 / §6: Pass.

Blocking Findings

  1. Stacked base (#427) & incomplete CI:
    • Because this PR still targets #427's branch (j716c/rtbuddyseg-logs-no-map, which is still OPEN and DIRTY/conflicting with main), only aurora-agent-policy and esp-stage2-size ran (3 checks). All branches: [ main ] workflows (build, format-check, all 5 stage1-size toolchains, and all 5 Linux/macOS/arm64 Pytest jobs) never ran on 545f0ef504f8.
    • Land #427, retarget #282 onto main, and obtain a full green CI run on the resulting head.
  2. §3 Safety — External-engine placement checks (echoing @RyanTheTide's 2026-11-22 review):
    • While internal display handoff verifies that non-__OS_LOG iop-dcp-nub segment-ranges and pt-region-23/0/16 stay outside OS RAM [phys_base, +mem_size), DT-enabled apple,t6050-dcpext engines bypass t6050_ext_one() early (src/kboot_display_handoff.c:4195) and are accepted by t6050_check_ext_scanout() and version-stamped by t6050_ext_version() without checking iop-dcpextN-nub segment-ranges, dart-dcpextN pt-region-23, dart-dispextN pt-region-16, or engine running/UUID state.
    • Add per-engine placement/state checks (or call @RyanTheTide's shared helper once it lands on main) so any tree-enabled engine with segments/page tables in OS RAM or invalid state is skipped with a log message rather than handed over.
  3. §5 Hardware evidence (still owed before merge):
    • J714s (internal panel) and J775D (headless scanout), each with a Type-C device on port 1–5 (display up, port enumerates, same tunable set as main, 0 new kernel errors, 0 failed units).
    • J716c undocked s2idle resume row and J716c 27.0 stub row.

@RyanTheTide

Copy link
Copy Markdown
Contributor

The external-engine safety follow-up uses the shared placement check from #471 for DT-enabled engines. The candidate checks the engine's firmware identity, running state and live DART roots before stamping the firmware version or accepting its scanout stream. It refuses unsafe engines and their child nodes even with a packed tree, and drops their scanout references.

I tested the safety change locally with a clean merge of the #427 base and current main. The combined candidate passed 1,106 Python tests, linked both stages, and passed the GCC Stage 1 size checks, including dev-audit with 2,072 bytes of headroom.

The published head is still 545f0ef504f8 and still targets #427's branch. The base conflict has a local resolution, but #427 needs its remaining evidence and review before it lands. After that, #282 can target main and run the full CI matrix. The J714s and J775D Type-C/display rows, plus the J716c undocked resume and 27.0 rows, are still open.

…andoff

Resolve the merge conflict in tests/python/test_t6050_handoff_bounds.py by keeping both prewired() and t6041_headless_fb(), and update t6041_headless_fb() to call dcp6_headless_display(dt, dcp6.soc->disp_compat) after the rename in #470.

Signed-off-by: Erik Bourget <erik@ebourget.net>
t6050_ext_version() and t6050_ext_reject() run after t6050_handoff() and t6050_headless_handoff() so they can see any pinned t6050.uuid, which previously caused them to inspect and reject engines Aura had just enabled via t6050_ext_one(). When pt-region-* was omitted from a headless ADT/fixture, t6050_headless_handoff() recorded "published" and enabled the engine, display subsystem, and providers, and t6050_ext_reject() then disabled the engine and display subsystem while leaving the providers enabled.

Record engines committed by t6050_ext_one() in t6050.ext_aura and skip them in t6050_ext_reject() and t6050_ext_version(), keeping the pass scoped to engines already enabled in the input DT. Add a headless missing-pt-region regression test and an ext_aura scoping test.

Signed-off-by: Erik Bourget <erik@ebourget.net>
A device tree with multiple apple,t6050-dcpext nodes at the same coprocessor register address caused t6050_node_at() to pick the first match, allowing t6050_ext_one() to enable it and set its t6050.ext_aura bit so t6050_ext_reject() skipped a second, input-enabled node at the same address even when its ADT checks failed.

Require t6050_node_at() and t6050_ext_index() to return -1 unless a matching coprocessor register address is unique across the tree, so ambiguous duplicate-reg mappings are refused before committing and rejected by t6050_ext_reject(). Add headless and unit regression cases.

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

In t6050_ext_reject(), deleting or mutating the first duplicate apple,t6050-dcpext node on a packed tree could make a second duplicate at the same coprocessor address look unique and survive into version-stamping after its scanout DART had already been removed. Record ambiguous ADT indices across the input tree before mutating anything and reject every available node at those indices.

Also preserve the ADT index returned by t6050_ext_index() via a separate uniqueness output so t6050_drop_ext_scanout() still strips /arm-io/dart-dispextN from display-subsystem iommus when duplicate nodes lack piodma subnodes. Add packed-tree and no-piodma duplicate-node regression cases.

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb
erikwb changed the base branch from j716c/rtbuddyseg-logs-no-map to main November 24, 2026 21:27
@erikwb

erikwb commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Gemini 4 Hydrogen responding on behalf of erikwb

Merged main (f52d8324, which now includes #427 27847f1f) into j716c/t6050-display-handoff as 7e85cfe9 so this PR can be retargeted onto main, scoped the external-engine pass to input-DT-enabled engines (4101923fe382), and rejected duplicate apple,t6050-dcpext register mappings (be98aca94ec8, f6e5eaceec09).

  • Merge conflict resolution (tests/python/test_t6050_handoff_bounds.py in 7e85cfe9): Kept both prewired() and t6041_headless_fb(), and updated t6041_headless_fb() to call dcp6_headless_display(dt, dcp6.soc->disp_compat) following the rename in #470 (8bcf31ec).
  • Scope t6050_ext_reject() / t6050_ext_version() to input-DT-enabled engines (4101923fe382): Recorded engines Aura enables itself via t6050_ext_one() (t6050_headless_handoff() and t6050_ext_handoff()) in t6050.ext_aura and skipped them in t6050_ext_reject() and t6050_ext_version(). Added test_headless_without_pt_region_stays_handed_off() in tests/python/test_t6050_handoff_bounds.py and an ext_aura scoping case in tests/python/test_t6050_tree_shape.py.
  • Reject ambiguous duplicate-reg mappings (be98aca94ec8, f6e5eaceec09): Updated t6050_node_at() and t6050_ext_index() in src/kboot_display_handoff.c to flag duplicate nodes at the same coprocessor register address (*unique), and updated t6050_ext_reject() to record ambiguous ADT indices before mutating or deleting nodes—preventing packed-tree deletions from making a surviving duplicate look unique while preserving the ADT index n for t6050_drop_ext_scanout() when duplicates lack piodma. Added test_headless_duplicate_ext_node_refused(), test_prewired_panel_rejects_packed_and_no_piodma_duplicate_ext_nodes(), and packed-tree / piodma-less duplicate-node unit cases in test_t6050_tree_shape.py. Also narrowed the PR body's node-selection note to the new node matching under the inherited chip_id != T6050 dispatch check in dt_set_display_handoff().
  • Verification on f6e5eaceec09: clang-format --dry-run -Werror src/kboot_display_handoff.c src/kboot_atc.c is clean; tests/python/test_t6050_tree_shape.py + tests/python/test_t6050_handoff_bounds.py (158 passed with cc and 158 passed with CC=clang), the remaining 6 targeted pytest suites (193 passed), all 5 display/FDT/AOP/PMP/GPU26 host shell tests (cc and CC=clang), and the ESP_STAGE2=1 build (ESP vital region: 811080 B, 368568 B free) all pass.
  • Remaining before merge: Retargeting the PR base to main, running the J716c 27.2 hardware check at f6e5eaceec09 (internal panel and external engines up), and Stage 1 / T6050 board owners' sign-off (plus reconciling t6050_check_placement() with #471 if #471 lands first).

@github-actions github-actions Bot added blast:m5 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:one-way Revertible or not, from Merge risk (bot) and removed needs-template PR body lacks required sections (bot) labels Nov 24, 2026

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verdict at f6e5eaceec09

REQUEST_CHANGES — No code defects found across all 5 changed files (src/kboot_atc.c, src/kboot_display_handoff.c, and the 3 host test files); blocked on red Stage 1 CI at head (inherited dev-flavour 0x120000 overflow on main), pending exact-head hardware boot verification at f6e5eaceec09, and Stage 1 / board owner sign-off.

Blockers

  1. Red Stage 1 CI at f6e5eaceec09:
    • build, gcc, fedora, alarm, and nix fail linking build/aura-raw.elf (inherited from main f52d8324 prior to Stage 1 dev-flavour link-budget restoration; gcc stage1-secure-audit and gcc stage1-secure-enforce pass with 12640 B headroom, and ESP stage 2, format-check, policy, selftest, and host Pytest jobs pass). Re-sync with main once Stage 1 headroom is restored so full CI passes at head.
  2. Exact-head hardware re-test & Stage 1 / board owner sign-off still pending:
    • Modifies unconditional Stage 1 objects (src/kboot_atc.c, src/kboot_display_handoff.c), requiring Stage 1 / board owner sign-off.
    • As noted in the PR body, the prior hardware boot was at 71708f74 (before the external-engine placement/rejection rework and main merge); exact-head boot verification at f6e5eaceec09 (internal panel + external apple,t6050-dcpext engines up) is still owed before merge.

Checked

  • Audited all 5 changed files (src/kboot_atc.c, src/kboot_display_handoff.c, tests/python/fdt_harness.py, tests/python/test_t6050_handoff_bounds.py, tests/python/test_t6050_tree_shape.py; +2474/-61) and all 6 commits (39b5db2b4c21, 0113c4eea3c1, 7e85cfe98eab, 4101923fe382, be98aca94ec8, f6e5eaceec09; clean Signed-off-by: Erik Bourget trailers).
  • Verified t6050_ext_reject() / t6050_ext_version() decoupling (rejection runs in its own scratch transaction before os_firmware checks/version writes, scoped to input-DT-enabled engines via t6050.ext_aura).
  • Verified unique coprocessor register matching in t6050_node_at() and t6050_ext_index(), plus upfront ambiguous-ADT-index tracking (be98aca94ec8, f6e5eaceec09) so duplicate apple,t6050-dcpext reg mappings are rejected cleanly while preserving the ADT index for scanout DART cleanup.
  • Verified in-place iommus compaction (fdt_getprop_w() + memmove() + fdt_setprop_placeholder()) against src/libfdt/fdt_rw.c: fdt_resize_property_() -> fdt_splice_() shifts only the bytes past prop->data + oldlen, preserving the compacted prefix with no fixed stack cap or heap allocation.
  • Verified kboot_setup_atc() / t6050_setup_atc() keys strictly on apple,t6050-combo-phy + apple,guest-port-reserved and copies tunable groups in ADT order.
  • Executed host suites locally on Linux ARM64 at f6e5eaceec09:
    • test_t6050_tree_shape.py (7/7) + test_t6050_handoff_bounds.py (151/151) = 158/158 passed under both gcc and clang.
    • Targeted shell suites (run-t8122-display-handoff.sh, run-fdt-disable.sh, run-aop-os-ram.sh, run-pmp-boot-data.sh, run-t8122-gpu26-identity.sh): 5/5 passed.
  • Untested scope: Live Stage 1 / Stage 2 flashing or hardware boot testing (userspace host-harness audit only); Stage 1 dev-flavour link headroom once main restores budget.
Evidence
  • Local host execution on Linux ARM64 at f6e5eaceec09:
    • CC=gcc: test_t6050_tree_shape (7/7), test_t6050_handoff_bounds (151/151) — 158/158 passed.
    • CC=clang: test_t6050_tree_shape (7/7), test_t6050_handoff_bounds (151/151) — 158/158 passed.
    • Shell suites: run-t8122-display-handoff.sh, run-fdt-disable.sh, run-aop-os-ram.sh, run-pmp-boot-data.sh, run-t8122-gpu26-identity.sh — 5/5 passed.
  • CI inspection at f6e5eaceec09:
    • gcc: stage1-secure-audit (_file_vital_end 0x11cea0 of 0x120000; headroom 12640 B), stage1-secure-enforce (_file_vital_end 0x11cea0 of 0x120000; headroom 12640 B); dev-flavour build/aura-raw.elf fails linking (inherited from main).

@github-actions github-actions Bot added the changes-requested A reviewer requested changes (bot) label Nov 24, 2026
@chrisohearn

Copy link
Copy Markdown

The K114s (Mac17,13) needs port 0 described: its left-back USB-C port is ATC0, and the loader's current skip of apple,port-index 0 leaves that PHY without its tunables. The apple,guest-port-reserved rule in t6050_setup_atc() here covers it, and I'd rather have it keyed on the tree than on aura-debug, as a local draft of mine did. Once this lands and the K114s tree describes port 0, it can set apple,guest-port-reserved on its port-0 PHY.

What has been checked, offline only: on the K114s the ADT has usb-drd0, atc-phy0, acio-phy-cpu0 and dart-usb0 and hpm0 on nub-spmi-a0, at the addresses a draft K114s ATC0 tree uses (read-only, run on the machine); that tree builds and its dwc3, PHY, mailbox and DART nodes for ATC0 compare equal to the J716c's. Nothing has been booted, so whether the port-0 PHY comes up with copied tunables, whether a device enumerates, and charging on that port are all untested.

I can give a K114s row at this PR's head: Stage 2 built from the head, the K114s tree with apple,guest-port-reserved on port 0, charger on MagSafe and nothing in the left-back port for the first boot. Then check the loader log for the port-0 tunables line, the PHY probe, a device enumerating after plugging it in, and unplug, flip and replug. Say if you want it.

@RyanTheTide

Copy link
Copy Markdown
Contributor

@erikwb, what is still open from satchlj's review at f6e5eace:

  1. CI is red at f6e5eace: the Stage 1 dev-flavour link overflow (build/gcc/clang-macos/fedora/alarm/nix) came in with main f52d8324. main is green now at 8521ad7c, so please merge main in again.
  2. The J716c row (27.2 stub) is still owed at this head, showing the internal panel and the external apple,t6050-dcpext engines up. The last boot was at 71708f74, before the external-engine rework. If the main merge doesn't touch your files, a row at f6e5eace still counts.

The Stage 1/board owner sign-off is on our side. Once these are in, satchlj will re-review.

…andoff

Merge main (26c1a85) to pick up the restored Stage 1 link budget and recent T6050 display/PMP changes. Update t6041_headless_fb() in tests/python/test_t6050_handoff_bounds.py to call t6041_headless_display(dt) following main's revert of #470 (faf651d).

Signed-off-by: Erik Bourget <erik@ebourget.net>
In t6050_ext_version(), a failed scratch allocation, firmware-compat/version property write, or commit previously rolled back and left an input-DT-enabled apple,t6050-dcpext engine active with stale or missing apple,firmware-compat, causing Linux to pick the wrong method table.

Run each surviving engine's version update in its own scratch transaction via t6050_ext_version_one(), and extract t6050_ext_disable() from t6050_ext_reject() so any engine whose compatibility could not be updated is disabled (or deleted on a packed DT where status = "disabled" does not fit) and stripped from every apple,display-subsystem scanout iommus. Update the packed-tree and scratch-failure tests to assert the fail-closed behavior.

Signed-off-by: Erik Bourget <erik@ebourget.net>
Place the T6050 display handoff (T6050_INIT / T6050_TEXT in src/kboot_display_handoff.c) and combo PHY handoff (T6050_ATC / T6050_ATC_INIT in src/kboot_atc.c) in .rodata.xtext via AURA_XTEXT instead of .init.t6050/.text, guarding Clang's minsize attribute with __clang__. With .init and .text sharing one 64 KiB step in aura-raw.ld, keeping these run-once helpers in .text left default clang (without -Oz) at 112 B of Stage 1 headroom; moving them to .rodata.xtext brings Stage 1 headroom to 8,128 B (clang), 6,904 B (GCC 16.2), and 6,560 B (Ubuntu 24.04 GCC 13.3).

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb
erikwb requested review from a team as code owners November 27, 2026 14:35
@erikwb
erikwb requested review from LiamRay11 and maralcbr November 27, 2026 14:35
@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Merged origin/main (including the restored Stage 1 link budget) into j716c/t6050-display-handoff, added a fail-closed fix for external-engine version updates, and moved the T6050 display and ATC handoff helpers into .rodata.xtext via AURA_XTEXT; candidate head is 1458e4eb7cba.

@RyanTheTide:

  • Stage 1 / CI sync: src/kboot_atc.c and src/kboot_display_handoff.c merged cleanly alongside the upstream ATC and display changes from origin/main, with updating t6041_headless_fb() in tests/python/test_t6050_handoff_bounds.py back to t6041_headless_display(dt) (following main's revert of #470) as the only manual merge adjustment.
  • Stage 1 .rodata.xtext placement: Moved T6050_INIT / T6050_TEXT in src/kboot_display_handoff.c and T6050_ATC / T6050_ATC_INIT in src/kboot_atc.c from .init.t6050/.text into .rodata.xtext via AURA_XTEXT (with Clang's minsize attribute guarded by #ifdef __clang__), freeing .init + .text headroom so tools/stage1_size.sh passes the 4096 B Stage 1 floor under default clang without -Oz.
  • Fail-closed external-engine version update: t6050_ext_version() now updates each surviving apple,t6050-dcpext engine in its own scratch transaction (t6050_ext_version_one()) and disables (or deletes on packed DTs) any engine whose compatibility could not be updated via t6050_ext_disable()—stripping its apple,display-subsystem scanout references too—instead of leaving stale apple,firmware-compat active. Updated the packed-tree and scratch-failure tests in tests/python/test_t6050_tree_shape.py and tests/python/test_t6050_handoff_bounds.py.
  • Local verification at 1458e4eb7cba: tools/stage1_size.sh passes all required Stage 1 flavours under default clang 23.1.5 without -Oz (stage1 _file_vital_end 0x11d010 of 0x120000, 8128 B headroom; stage1-secure-audit and stage1-secure-enforce 77928 B headroom), host aarch64-linux-gnu-gcc 16.2 (stage1 6904 B headroom; stage1-secure-audit/enforce 77448 B headroom), and Ubuntu 24.04 aarch64-linux-gnu-gcc 13.3.0 container (stage1 6560 B headroom; stage1-secure-audit/enforce 77528 B headroom); ESP_STAGE2=1 builds pass under aarch64-linux-gnu- and USE_CLANG=1 (811160 B vital region, 368488 B free); clang-format --dry-run -Werror passes on src/kboot_display_handoff.c and src/kboot_atc.c; make rustfmt-check passes; the T6050 display pytest suites pass (158 passed under both cc and CC=clang); the other 11 display/handoff/OSLog pytest suites pass (177 passed), test_stage1_room.py + test_rela_layout.py pass (8 passed, 1 skipped); and all 6 targeted host shell tests pass (cc and CC=clang).
  • J716c 27.2 row: the Stage 2 binary (RELEASE=1 CHAINLOADING=1 USE_CLANG=1 ESP_STAGE2=1, aura.bin sha256 prefix 34bfcaf4184d84ee) built cleanly at 1458e4eb7cba, while the aura-try boot pass on J716c (internal panel, apple,t6050-dcpext engines up, Type-C port check, and undocked s2idle resume) did not run yet because the machine did not wake from the preceding sleep test and is awaiting physical wake.

@chrisohearn:

  • Thanks for checking K114s ATC0 against the apple,guest-port-reserved port-0 path in t6050_setup_atc(). A K114s row covering the port-0 tunable log, PHY probe, device enumeration, and plug/flip/replug would be useful coverage for port 0, either at 1458e4eb7cba or once the K114s DT patch lands.

@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Updated the PR body with the completed J716c (M5 Max, 27.2 stub) one-shot aura-try Stage 2 boot at 1458e4eb7cba (1.0.0b17-g1458e4eb, aura.bin sha256 prefix 34bfcaf4184d84ee, booting the default kernel):

  • main control (26c1a85bb788, -g26c1a85b): no panel driver (simple framebuffer Unknown-1 at 60 Hz), GPU disabled.
  • #282 (1458e4eb7cba): eDP-1 up at 3456x2234@120, all 4 apple,t6050-dcpext engines handed over (apple,firmware-version and apple,firmware-compat = <0x1b 0x02 0x00>, apple,tunable present), 4 combo-PHY nodes, Type-C port0–port3, 39 unique kernel err lines vs 40 on the default Stage 2 (0 new), and 0 new failed units (GPU stays disabled because #282 alone has no GPU handoff).
  • Undocked s2idle remains in Not yet because apple,t6050-pmu-rtc has no interrupts in t6050-j716c-sleep.dtsi / rtc-apple-pmu.c (rtcwake -m no -s 5 leaves wakealarm set with alrm_pending: no).
  • Merge-order note: combining main + #281 + #282 currently exceeds the Stage 1 region before the DCP log buffer (ld.lld: error: Code and data reach the DCP log buffer after stage 1! under clang, clang -Oz, and gcc), though each PR links alone.

test_wdt_arm.py (merged from main) appends fdt_addresses.c to LIBFDT_SOURCES, so including fdt_addresses.c in LIBFDT_SOURCES linked it twice and failed on macOS ld (and Linux ld) with duplicate symbols (_fdt_address_cells, _fdt_size_cells, _fdt_appendprop_addrrange). Keep LIBFDT_SOURCES unchanged for external callers and link fdt_addresses.c inside fdt_harness.run() instead.

Signed-off-by: Erik Bourget <erik@ebourget.net>
t6050_check_ext_adt() only checked the ADT's l1-tt values and pt-region placement, so a pre-enabled apple,t6050-dcpext engine whose live DART root differed from the ADT (for instance pointing into OS RAM) could still retain its scanout DART in t6050_publish_prewired() and receive firmware version properties in t6050_ext_version().

Extract the guarded live power, CPU run, and DART lock/TTBR checks from t6050_ext_one() into t6050_check_ext_live() and call it from both t6050_ext_one() and t6050_check_ext_adt() so scanout retention, rejection, and version updates verify the live registers match the validated ADT roots. Supply external power and DART register state in the host fixtures and cover live roots that differ from the ADT.

Signed-off-by: Erik Bourget <erik@ebourget.net>
erikwb added a commit that referenced this pull request Nov 27, 2026


With both #281 (T6050 G17C GPU handoff) and #282 (T6050 display handoff)
merged on top of main, placing both in .rodata.xtext pushes .rodata +
.rela.dyn 1,728 bytes past a 64 KiB boundary while .text still has
24 KiB free. Keep T6050_INIT and T6050_TEXT in .text so .text, .rodata,
and .data all fit cleanly below _file_limit (6,072 B headroom).

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

If an input-enabled apple,t6050-dcpext engine passes t6050_ext_reject() but fails t6050_check_ext_adt() (for example its live power, CPU run, or DART state changes before t6050_ext_version() stamps it), the versioning loop previously skipped it and left it enabled with its original firmware properties and display-subsystem scanout entry.

Disable and strip scanout via t6050_ext_disable() when t6050_check_ext_adt() fails in t6050_ext_version(), and only mark the engine done once its firmware properties update cleanly so a rescan after enclosing display-subsystem deletion cannot skip it. Add host tests covering an engine that passes rejection and stops running before versioning on both normal and packed device trees.

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

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Updated #282 with three commits on top of 1458e4eb7cba:

  • d3184b1778fc (tests/python/fdt_harness.py): moved fdt_addresses.c out of LIBFDT_SOURCES into fdt_harness.run() so tests/python/test_wdt_arm.py::test_dt_set_wdt_reconfig does not link it twice, while keeping test_t6050_tree_shape.py linked.
  • 1ddba986798f (src/kboot_display_handoff.c, tests/python/test_t6050_tree_shape.py, tests/python/test_t6050_handoff_bounds.py): extracted the guarded live hardware checks (PMGR power domains, ASC_CPU_CONTROL_RUN, and DART PROTECT_TTBR_TCR / four-level translate TCR / valid TTBR matching ADT l1-tt) from t6050_ext_one() into t6050_check_ext_live() and called it from t6050_check_ext_adt() so pre-enabled external engines verify live registers against the validated ADT roots before t6050_publish_prewired() retains scanout or t6050_ext_version() stamps firmware properties. Supplied external power and DART register state in the host fixtures and added coverage where a stale ADT passes placement checks while a live DART root differs (pointing into OS RAM), unlocked/stopped/unpowered/faulted cases, and the unknown-stub path.
  • e6a3bcb13fca (src/kboot_display_handoff.c, tests/python/test_t6050_tree_shape.py): when t6050_check_ext_adt() passes during t6050_ext_reject() and then fails during t6050_ext_version(), disabled the engine and stripped its scanout entry via t6050_ext_disable() instead of skipping it with original firmware properties intact, and deferred setting done until t6050_ext_version_one() succeeds so rescans after an enclosing display-subsystem deletion cannot skip an engine. Added host tests covering an engine that passes rejection and stops running before versioning on both normal and packed device trees.

Verified at e6a3bcb13fca:

  • pytest -q tests/python/test_wdt_arm.py tests/python/test_rtbuddyseg_logs.py tests/python/test_t6050_tree_shape.py tests/python/test_t6050_handoff_bounds.py: 167 passed (cc), 167 passed (CC=clang).
  • Other 12 display/handoff/OSLog/layout suites (test_dcp6_max_brightness.py, test_t6041_display_handoff.py, test_t6041_27_display_handoff.py, test_oslog_reservation.py, test_dcp_fw27_clocks.py, test_dcp_typec_routes_adt.py, test_display_dart_view.py, test_m4_dcp_handoff.py, test_ave_handoff.py, test_t6031_runner_failures.py, test_stage1_room.py, test_rela_layout.py): 182 passed, 1 skipped (cc; CC=clang: 153 passed, 1 skipped, test_display_dart_view.py hits the pre-existing unused-function setup error on dart_gen3_tlbi_broadcast).
  • All 6 host shell scripts (run-t8122-display-handoff.sh, run-fdt-disable.sh, run-aop-os-ram.sh, run-pmp-boot-data.sh, run-t8122-gpu26-identity.sh, run-rtkit-placed-buffer.sh): pass under both cc and CC=clang.
  • clang-format --dry-run -Werror src/kboot_display_handoff.c src/kboot_atc.c and make rustfmt-check: pass.
  • tools/stage1_size.sh: clang (7752 B stage1, 77928 B secure-audit/enforce), host gcc 16.2 (6584 B stage1, 77448 B secure-audit/enforce), and Ubuntu 24.04 container aarch64-linux-gnu-gcc 13.3 (6152 B stage1, 77528 B secure-audit/enforce; optional stage1-dev-audit does not link).
  • esp-stage2-size (without BUILDSTD=1): ESP vital region: 811160 B, 368488 B free; ARCH=aarch64-linux-gnu- Stage 1 + ESP_STAGE2=1 and RELEASE=1 CHAINLOADING=1 USE_CLANG=1 ESP_STAGE2=1 (1.0.0b17-ge6a3bcb1, aura.bin sha256 prefix 24c2d8fde8eb620d) build cleanly.

Hardware at e6a3bcb13fca (J716c, 27.2 stub, one-shot aura-try Stage 2 1.0.0b17-ge6a3bcb1, default payload tail, default stage2.bin unchanged):

  • eDP-1 up at 3456x2234@120; dcp@48ae00000 okay with apple,bw-scratch.
  • All 4 apple,t6050-dcpext engines okay with apple,firmware-version and apple,firmware-compat (27, 2, 0); 4 apple,t6050-combo-phy nodes (3 active, with full tunable sets).
  • dmesg error lines 40 vs 43 on the default Stage 2; 0 new display/DCP/ATC/DART errors; 0 new failed units. GPU stays disabled because #282 has no GPU handoff.
  • Control main (26c1a85bb788, 1.0.0b17-g26c1a85b) on the same Mac: 60 Hz simplefb (Unknown-1), dcp@48ae00000 disabled, engines at (27, 0, 0), two DCP probes failing -110, and apple-t6050-dp-phy missing apple,tunable-axi2af.
  • Rebooted cleanly back to the default Stage 2.

@satchlj @DjDeveloperr: the J716c aura-try row at e6a3bcb13fca is in the PR body now. Still open: full GitHub CI on this head, the Stage 1 and T6050 board owners' sign-off, and the live external-monitor and undocked s2idle checks. Ready for re-review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blast:m5 Macs affected, from Merge risk (bot) changes-requested A reviewer requested changes (bot) ci-failing A check failed at the PR head (bot) door:one-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.

5 participants