Skip to content

kboot: T8152: hand the running internal-panel DCP to Linux (successor of #289) - #601

Merged
RyanTheTide merged 4 commits into
mainfrom
closeout/289-t8152-dcp-handoff
Nov 30, 2026
Merged

RyanTheTide merged 4 commits into
mainfrom
closeout/289-t8152-dcp-handoff

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #289. LiamRay11 wrote the J804 internal-panel DCP handoff and ran it on his J804. This branch carries his commit (adbb8d2d, authorship and Signed-off-by kept, only the AI co-author trailer dropped) rebased on current main, plus commits that fix every point in DjDeveloperr's 11-24 review (43862f0c) and the review App's findings (c8124aa6), and a test-only commit (cf325baf). The original branch could not be updated without a force push, so this PR replaces it. Thanks, LiamRay11.

What it does

On a T8152 whose tree has a dcp alias naming an apple,t8152-dcp node (the J804), iBoot leaves the internal panel's DCP running with its firmware mapped through locked DART tables. Before anything is published, kboot checks that every page dart-dcp (the DCP stream, SID 23) and dart-disp0 (SID 0 and 16) map belongs to a segment in the ADT iop-dcp-nub segment-ranges. It then reserves those segments, publishes the firmware UUID and enables dcp, disp0, disp0_piodma and their DARTs, all inside dt_display_transaction(). If any check fails, nothing is published and the panel stays on simple-framebuffer.

Dj's points (review of 26de0ac2)

  1. No boot argument and no board check. j804.dcp=1, dt_bootargs_have() and board_id == 0x22 are gone. The handoff runs on every T8152 tree whose dcp alias is apple,t8152-dcp, and it fails closed. J873g trees (apple,t8152-dcp-iboot) aren't a target. The names change from J804 to T8152.
  2. The OS-log rule keys on the segment itself. The rule is now !strncmp(fdt_path, "dcp", 3) && seg->unk == 0xa && seg->remap == seg->phys, with no chip list. A flags-0xa DCP segment whose descriptor says it runs at its physical address gets a RAM-only reservation marked apple,dcp-os-log. A flags-0xa segment with a real remap keeps its DART mapping as before. A T8142 __OS_LOG can have a live DART alias that differs from its descriptor (dt_reserve_m5_display_segments()), so a remapped log must not lose its mapping.
    • Evidence: every real-ADT fixture has remap == phys for that segment: T6030 (tests/python/test_m4_dcp_handoff.py), T8132 26.x and 27.2 (tests/t8132_dcpext_host.c), T8122 (tests/t8122_display_host.c) and T6041 (tests/t6041_display_host.c). The J804 ADT does the same. The synthetic J713 fixture in test_j713_dcpext_ready.py used a remapped log (0x20000000); it now repeats phys, as the real J713 ADTs do.
    • Still wider than T8152: a DCP not on the old list (the external DCPs of T8112, T6020/T6021/T6022 and T8122, reserved through dt_reserve_dcpext_firmware()) whose flags-0xa segment has remap == phys now gets the RAM-only form. Before, it was mapped at an IOVA equal to its physical address. Remapped logs are unchanged everywhere. The T8122 external-DCP host test already expected the RAM-only form.
    • J804 walker: t8152_dcp_page() matches DART pages only against non-0xa segments, so a dart-dcp page that maps the __OS_LOG segment (or any 0xa one) fails the walk and the whole handoff is refused, fail-closed: the panel stays on simple-framebuffer. J804's ADT lists that log at its physical address, unmapped, which LiamRay11's J804 run (9 segments published) is consistent with; the post-merge J804 row confirms it on the locked maps.
  3. Bases come from the ADT. The run check uses asc_init("/arm-io/dcp") + asc_cpu_running() (ASC_CPU_CONTROL). dart-dcp and dart-disp0 are walked at their ADT reg, with the reg size as the register window. The nit is fixed too: T8152_DCP_SID (23) and T8152_DCP_DVA_SHIFT/T8152_DCP_DVA_WINDOW (remap >> 36 == 0x10) are now named.
    Also from the App review (c8124aa6): the DRAM bounds come from dt_t8152_dram() (exact u64 dram-base/dram-size, non-zero, no wrap). Each segment is checked by t8152_dcp_bad_segment() without unchecked ends, and phys + size and remap + size must not wrap.
  4. Trailer and conflict. The AI co-author trailer is dropped and the branch is rebased on main a4e4603e. The call now runs in the minimal-boot branch after dt_set_gpu() and before dt_set_dcpext_t8152(). The helpers sit next to the J713 display walk they share.

Overlap with #301: this DCP stays as iBoot started it, so /chosen/apple,dcp-rtkit-running stays absent. dt_set_dcp_state_t8152() publishes it only for a DCP aura itself started.

Not done, and the review marked it a suggestion: moving T8152 into struct dcp_soc in kboot_display_handoff.c.

Testing

LiamRay11, J804 (MacBook Pro 14-inch, M6), firmware 27.2, 2026-11-16, on the original code with j804.dcp=1: "J804 DCP handoff published (9 segments, ...)", dcp okay, and the Linux DCP driver drove eDP-1 at 3024x1964. Without the argument the panel stayed on simple-framebuffer. sithglan's J873g run (11-17) covered only the no-op path. That run also showed malformed earlycon and DCP -110 errors, both on the base and on the candidate.

Tested: at c8124aa6 on the buildbox: host pytest tests/python 1501 passed, 28 skipped (main a4e4603e: 1493 passed, 28 skipped).

  • New tests:
    • test_t8152_dcp_handoff_selector.py: selector, call site, ADT bases, the remap == phys rule, exact DRAM bounds, and a compiled t8152_dcp_bad_segment() run against segments past the end, below the start, larger than DRAM, wrapping, unaligned and empty.
    • test_dcp_os_log_flag.py: compiled for chips 8103/8112/6020/8122/6030/8132/8152. A flags-0xa log with remap == phys is RAM-only and a remapped one is mapped. Other segments and non-DCP coprocessors are mapped.
  • Builds: clang USE_CLANG=1 RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1 BUILDSTD=1 BUILTIN_LOGO=aurora and the default Stage 1 (USE_CLANG=1 BUILDSTD=1) both build.
  • fedora:44 tools/stage1_size.sh fedora USE_CLANG=1 BUILTIN_LOGO=aurora BUILDSTD=1: every flavour fits. Stage 1 headroom 61616 B (main 61616 B), ESP Stage 2 headroom 28576 B (main 28576 B).
  • clang-format is clean on src/kboot.c.
  • No hardware row yet at this head.

A test-only commit on top (cf325baf, Ryan Murray) stubs this series' new dt_prepare_t8152() calls in tests/python/test_t8152_audio_dt.py without recording them in its exact call list, so the four T8152 successors (#286-#289 reworks) merge in any order; the call site is checked by this series' own test. The four branches merge cleanly together on main and pass the same checks combined (merge f5f2e948 of the four heads before c8124aa6, on main a4e4603: pytest 1506 passed, 28 skipped; both clang builds; fedora:44 size run fits every flavour, Stage 1 headroom 45168 B, ESP Stage 2 code room 1848 B (main 7216 B), the tightest margin).

Risk: two-way · J804/J873g, plus the external DCPs of M2 (T8112), M2 Pro/Max/Ultra (T6020/T6021/T6022) and M3 (T8122) whose flags-0xa log has remap == phys (now RAM-only instead of an IOVA at its physical address); remapped logs are unchanged

After the merge, with a revert ready (as in the review), tracked in the known-gap issue:

  • J804, default command line, published kernel DT: T8152 DCP handoff published, eDP-1 driven by the DCP driver, 0 DART faults, 0 failed units, 0 AVCs.
  • J873g no-regression: no new display errors relative to main.
  • An external-display smoke on one M2-family Mac and one T8122 Mac for the OS-log rule.

Revert: git revert -m 1 <merge sha>.

@DjDeveloperr

LiamRay11 and others added 3 commits November 30, 2026 12:58
On J804 (MacBook Pro 14-inch, M6) iBoot leaves the internal panel's
DCP running with its firmware mapped through locked DART tables. With
j804.dcp=1 on the kernel command line, describe that state to Linux's
DCP driver instead of leaving the panel on the simple-framebuffer:

- check that the coprocessor runs, and that every page dart-dcp SID 23
  and dart-disp0 SID 0 and SID 16 map belongs to a segment the ADT
  iop-dcp-nub segment-ranges name, at the right offset;
- reserve the firmware segments for dcp, give disp0 and disp0_piodma
  the segments their tables map, with iommu-addresses;
- publish apple,firmware-uuid from the ADT nub and enable dcp, disp0,
  disp0_piodma and their DARTs.

T8152's OS log segment (flags 0xa), like T6030's and T8132's, runs at
its physical address and is marked apple,dcp-os-log rather than mapped.
The host tests that compile dt_reserve_asc_segments_at() define T8152
for that.

Without j804.dcp=1, on any other board, or when a check fails, nothing
is published and the display nodes stay disabled; the boot goes on.
The tree is edited inside dt_display_transaction(), so a failure after
the checks (firmware UUID, reserved memory, phandles, status writes)
also leaves no partial handoff behind.

An earlier version of this change, on an older base, was tested on a
J804 with j804.dcp=1: Linux's DCP driver takes the panel over from
simpledrm (eDP-1 3024x1890 at 120 Hz).

Signed-off-by: LiamRay11 <228416644+LiamRay11@users.noreply.github.com>
… the ADT

Rework of the J804 internal-panel DCP handoff (aura#289, LiamRay11) for
DjDeveloperr's review of 26de0ac:

- No boot argument and no board check. The handoff runs on every T8152
  tree whose "dcp" alias names an apple,t8152-dcp node, inside
  dt_display_transaction(): a failed check or step publishes nothing and
  the display nodes stay disabled (the panel keeps simple-framebuffer).
  A J873g tree (apple,t8152-dcp-iboot) is not a target. The j804.dcp=1
  switch and dt_bootargs_have() are gone, and the J804 names become
  T8152 ones.

- The OS-log rule is keyed on the segment's own flag. A flags-0xa
  segment of any dcp* coprocessor is reserved as RAM, marked
  apple,dcp-os-log, without an IOMMU mapping; the T6030/T8132 chip list
  is gone. This also applies to every other DCP that reaches
  dt_reserve_asc_segments_at() with a flags-0xa segment: the
  external DCPs of T8112, T6020/T6021/T6022 and T8122 reserved through
  dt_reserve_dcpext_firmware(), and the M4/T6030 paths that already had
  it. Those segments were mapped at their remap address before.

- The coprocessor and DART bases come from the ADT: the run check is
  asc_init("/arm-io/dcp") + asc_cpu_running() (ASC_CPU_CONTROL), and
  dart-dcp and dart-disp0 are walked at their ADT reg, with the reg size
  as the register window. The DCP stream (SID 23) and the 1 TiB DVA
  window test (remap >> 36 == 0x10) are named.

The DCP stays as iBoot started it, so /chosen apple,dcp-rtkit-running
stays absent here: dt_set_dcp_state_t8152() publishes it only for a DCP
that aura itself started (aura#301).

The call moves before dt_set_dcpext_t8152() in the minimal-boot branch,
and the helpers sit next to the J713 display walk they share. Host tests:
test_t8152_dcp_handoff_selector.py (selector, call site, ADT bases, rule)
and test_dcp_os_log_flag.py (the flag rule on chips the list never named);
test_t8152_audio_dt.py stubs the new call in the T8152 call order.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
tests/python/test_t8152_audio_dt.py asserts the exact dt_prepare_t8152()
call sequence, and each of the four T8152 successor series (aura#286-#289
reworks) adds a call to it, so every pair of them would conflict on that
one expected string. Stub this series' new calls without recording them,
so the four merge in any order. Where each call sits is checked by the
series' own call-site test instead.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

@DjDeveloperr, this is the successor of #289 with your 11-24 list fixed: no boot argument or board check, the OS-log rule keyed on seg->unk == 0xa for every DCP (wider than T8152, see Risk), and the ASC/DART bases from the ADT. LiamRay11's commits are kept with his authorship and Signed-off-by; only the AI co-author trailers are gone. Host pytest, both clang builds and the fedora:44 size run pass at the head; the four T8152 successors (#598-#601) also merge cleanly together. The J804/J873g rows you named come after the merge, with a revert ready. Could you re-review?

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: FINISH at cf325baf.

The shared OS-log change assumes segment flag 0xa has the same non-IOMMU meaning on every existing DCP handoff. Preserve existing mappings where that contract is unverified, or supply evidence for the newly affected families. The new DRAM check also accepts short property reads and forms unchecked extent ends. Require exact widths, reject overflow, and add malformed-range coverage before walking inherited mappings.

@github-actions github-actions Bot added blast:m2 Macs affected, from Merge risk (bot) blast:m3 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Merge readiness at c8124aa6: not ready yet

Check Detail
CI at head running running: build, ESP stage 2 vital size, format-check, gcc, Pytest (ubuntu-latest + gcc), Pytest (ubuntu-latest + llvm)
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at c8124aa6
Conflicts ok none
PR text ok Risk: two-way · J804/J873g, plus the external DCPs of M2 (T8112), M2 Pro/Max/Ultra (T6020/T6021/T6022) and M3 (T8122) whose flags-0xa log has remap == phys (now RAM-only instead of an IOVA at its physical address); remapped logs are unchanged After the merge, with a revert ready (as in the review), tracked in the known-gap issue: - J804, default command line, published kernel DT: T8152 DCP handoff published, eDP-1 driven by the DCP driver, 0 DART faults, 0 failed units, 0 AVCs. - J873g no-regression: no new display errors relative to main. - An external-display smoke on one M2-family Mac and one T8122 Mac for the OS-log rule. Revert: git revert -m 1 <merge sha>. @DjDeveloperr

Areas: none matched in CODEOWNERS

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

Two review follow-ups on the T8152 internal DCP handoff.

The DCP OS-log rule (no chip list, keyed on the segment) now also needs
the descriptor to say the log runs at its physical address: a flags-0xa
segment of a dcp* coprocessor is reserved RAM-only and marked
apple,dcp-os-log only when its remap equals its phys. A flags-0xa
segment with a real remap keeps its DART mapping as before, so DCPs
whose log is reached through the DART are not changed. The real-ADT
fixtures all have remap == phys for that segment: T6030
(tests/python/test_m4_dcp_handoff.py), T8132 26.x and 27.2
(tests/t8132_dcpext_host.c), T8122 (tests/t8122_display_host.c) and
T6041 (tests/t6041_display_host.c), and the J804 ADT does the same. A
T8142 __OS_LOG can have a live DART alias that differs from its
descriptor (dt_reserve_m5_display_segments()), which is why a remapped
one must keep its mapping. The synthetic J713 dcpext fixture had a
remapped log (0x20000000); it now repeats phys, as the real J713 ADTs
do.

dt_set_t8152_dcp_handoff_one() takes DRAM from dt_t8152_dram(): exact
u64 dram-base and dram-size, a non-zero size and no wrap. Each segment's
extent is checked by t8152_dcp_bad_segment() without forming unchecked
ends (phys < start, size > dram size, phys - start > dram size - size),
and phys + size and remap + size must not wrap.

Host tests: test_dcp_os_log_flag.py covers remap == phys (RAM-only, on
every chip) and a remapped flags-0xa segment (mapped);
test_t8152_dcp_handoff_selector.py compiles t8152_dcp_bad_segment()
against segments past the end, below the start, larger than DRAM,
wrapping, unaligned and empty.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: HOLD at c8124aa6 for display integration and hosted checks.

Checked: The new DRAM helper enforces exact widths and bounded extent, and the segment test exercises overrun and address wrap. The shared reservation helper now retains mapped log segments when their remap differs from phys. The new T8152 walker still rejects a DART page backed by any flag-0xa segment, so keep the J804 locked-map qualification and document that refusal. Keep physical external-display coverage on M2-family and T8122 or explicit boot-owner disposition for the expanded identity-log rule. Refresh the PR summary to describe the narrowed predicate.

@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Nov 30, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Boot-owner disposition for the review App's HOLD at c8124aa6: merge on CI + App + Dj's window; the display rows are post-merge rows, tracked in a known-gap issue, with a revert ready.

  • OS-log rule. The predicate is now the segment's own descriptor: flags 0xa and remap == phys. Such a log runs at its physical address, and the old code gave it an IOVA equal to that address. Every real-ADT fixture we have shows this shape: T6030, T8132 (26.x and 27.2), T8122, T6041 and J804. A remapped 0xa segment (T8142's live alias) keeps its DART mapping exactly as on main. The newly covered external DCPs (T8112, T6020/1/2, T8122) are a display-only case, so a regression there is not boot-breaking and the revert is one command. Owed after the merge: an external-display smoke on one M2-family Mac and one T8122 Mac.
  • J804 walker. A dart-dcp page backed by a 0xa segment refuses the whole handoff, fail-closed (simple-framebuffer stays). The PR body now says so. The J804 locked-map row stays owed after the merge, as Dj's review set out.

@DjDeveloperr, this is the call unless you object within your window.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at c8124aa6 after hosted checks and Dj’s review window, under the boot owner’s recorded disposition.

Checked: The updated description records the identity-remap predicate, preserves the live-remap case, and documents refusal of the T8152 handoff when the locked mapping violates the contract. The owner explicitly retained J804 locked-map and external display coverage as tracked follow-up with revert ready. This clears my earlier hold on the disposition. Keep the hosted size and test results.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merging at c8124aa6 (merge) under the 6-point rule. (1) The review App's verdict at this head: APPROVED. (2) CI is green at this head (readiness excluded). (3/4) Rows: real-ADT fixtures + malformed-range tests; combined main(+#609 #611)+#601+#604 size fits on GNU ld 2.42 (ESP S2 10424 B) and fedora:44 (92864 B), pytest 1632; J804 locked-map row and the M2-family/M3 external-display smoke after the merge (known-gap, disposition accepted by the App). (5) No blocking review is open. (6) Dj was pinged with no objection. The remaining rows are tracked in the known-gap issue linked below. Revert: git revert -m 1 <commit>.

@RyanTheTide
RyanTheTide merged commit a64a5c5 into main Nov 30, 2026
32 of 35 checks passed
@RyanTheTide
RyanTheTide deleted the closeout/289-t8152-dcp-handoff branch November 30, 2026 12:31
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Known-gap issue: #615

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Thanks @LiamRay11, merged: this carries your #289 work. The board rows are tracked in the known-gap issue linked above; post them there when you can.

rolotrealanis98 pushed a commit to rolotrealanis98/aura that referenced this pull request Nov 30, 2026
The state a core reads with its MMU off or uncached (reset stacks, spin
table, S2R mailbox, kernel park slots) had a 16 KiB page of its own in
.data. Every byte of it but three initial values is zero, yet the page
sat in the file part of every image, before _file_vital_end, where the
ESP Stage 2 has to end below the panel DCP's log buffer.

Put it on its own pages at the start of .bss (.bss.smp_shared) in both
linker scripts. memory.c still maps exactly those pages uncached and
smp.c still cleans them to PoC; S2R cleans [_data_start, _bss_end) as
before. _start_c clears .bss and then calls smp_shared_init(), which
sets the three values that do not start as zero: boot_cpu_idx -1,
spin_table at spin_table_image, and an MPIDR of ~0 in every
smp_reset_stacks entry. Nothing reads them earlier: no secondary runs
and no reset can come back to this image before smp_init().

This frees 16 KiB of the file on every toolchain. Packed relocations
(aura#609) free more, but only with lld or GNU ld 2.43 and later; the
release workflow and the installer's UEFI-only build link with Ubuntu
24.04's GNU ld 2.42, which ignores -z pack-relative-relocs on AArch64.
gcc + GNU ld 2.42, ESP Stage 2 headroom: main 4160 B, this 27392 B;
main + this + aurora-silicon#601 + aurora-silicon#604 (with or without aurora-silicon#609) 10424 B.

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

Labels

blast:m2 Macs affected, from Merge risk (bot) blast:m3 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-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.

2 participants