Skip to content

kboot: J804: hand the running internal-panel DCP to Linux (opt-in, j804.dcp=1) - #289

Open
LiamRay11 wants to merge 1 commit into
aurora-silicon:mainfrom
LiamRay11:j804/dcp-handoff
Open

LiamRay11 wants to merge 1 commit into
aurora-silicon:mainfrom
LiamRay11:j804/dcp-handoff

Conversation

@LiamRay11

Copy link
Copy Markdown
Contributor

Summary

On the 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, kboot describes that state to Linux's DCP driver instead of leaving the panel on simple-framebuffer.

What changed (src/kboot.c)

  • dt_set_j804_dcp_handoff(), called fail-soft from the minimal-boot branch of dt_prepare_t8152(), only for board 0x22 and a dcp node compatible with apple,t8152-dcp:
    • it checks 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 named in the ADT iop-dcp-nub segment-ranges, at the right offset, and that SID 0 and SID 16 map whole segments;
    • it reserves the firmware segments for dcp (dt_reserve_asc_firmware()) and gives disp0 and disp0_piodma the segments their tables map, with iommu-addresses;
    • it publishes apple,firmware-uuid from the ADT nub and enables dcp, disp0, disp0_piodma and their DARTs.
  • T8152 joins T6030 and T8132 in marking the DCP __OS_LOG segment (flags 0xa) apple,dcp-os-log instead of mapping it.
  • Helpers: dt_bootargs_have() (whole-token match in /chosen/bootargs), dt_set_status_okay_iommu(), and j804_dcp_page(), the SID 23 page walk.

Without j804.dcp=1, on any other board, or when a check fails, nothing is published, the display nodes stay disabled, and the boot goes on. The publishing steps run inside dt_display_transaction(), as the ISP and AOP hand-offs do, so a failure after the checks (firmware UUID, reserved memory, phandles, status writes) also leaves no partial hand-off in the tree.

Testing

On hardware: MacBook Pro 14-inch (M6, J804), system firmware 27.2, 2026-11-16, tested by LiamRay11.

  • What ran: a retest build of main 52af355 with all seven J804 aura PRs merged (exception-silent-latch, t8152-top-carveout, board-support, sep-handoff, t8152-adt-values, isp-acio-ave-handoff, dcp-handoff). That build also carried pieces that are not part of this PR set: the J804 GPU board admission together with a local build hook that adds J804's G18G firmware builds[] entry (the J804 tree's GPU node needs it; it will follow separately), and a guard that keeps T8152 from taking an aura-try trial. It was chainloaded in place over the installed aura Stage 1 and booted the installed Linux kernel and device tree.
  • Boots: T1 = the PRs with j804.dcp=1; T2 = T1 plus an AOP hand-off draft that is not part of this set; T3 = T1 without j804.dcp=1. All three reached multi-user and ran normally, and each was left with systemctl reboot.

Results for this PR:

  • T1 and T2 (j804.dcp=1): "J804 DCP handoff published (9 segments, ...)"; the dcp node is okay, and Linux's DCP driver drives the internal panel (eDP-1 connected, 3024x1964), the same as on the installed boot.
  • T3 (no j804.dcp=1): "J804 DCP handoff not requested (j804.dcp=1)"; the dcp node stays disabled and the panel runs on the simple framebuffer. Everything else booted as in T1.
  • The board_id == 0x22 guard and the dt_display_transaction() are new in this port and ran in these boots.

main has since moved to e0a116b; this branch still merges into it without conflicts. The seven J804 aura PRs touch dt_prepare_t8152() / src/kboot.c at the same spots, so whichever of sep-handoff, t8152-adt-values, isp-acio-ave-handoff and dcp-handoff merges later needs a trivial rebase.

Checks run locally

Run on this branch's tree (head ea9b0be5, before the Signed-off-by trailer was added; the current head 26de0ac2 has the identical tree), on top of main at 52af355, with the commands the CI workflows use:

  • make format-check CLANG_FORMAT=clang-format (clang-format 20.1.8): pass
  • make rustfmt-check: pass
  • pytest tests/python tests/test_t8122_gpu_reader.py tests/test_t8122_gpu_resources.py in a Debian trixie container (Python 3.13, pytest 9.1.1): 767 passed, 26 skipped; the one failure, test_package_j700.py::test_package_includes_fatfs_license, fails the same way on main in that container. On a macOS host: no failures beyond the ones main has there.
  • sh tests/run-pmp-boot-data.sh, tests/run-t8122-gpu26-identity.sh (gcc) and sh tests/run-kboot-audio.sh (gcc and clang): pass
  • build: gcc Stage 1 (ARCH=aarch64-linux-gnu- CHAINLOADING=1 EXTRA_CFLAGS='-Wstack-usage=2048 -Os') and ESP Stage 2 (ESP_STAGE2=1), and clang RELEASE=1 CHAINLOADING=1 BUILTIN_LOGO=aurora Stage 1 and ESP Stage 2: pass, no new compiler warnings
  • stage1-size (tools/stage1_size.sh, gcc and clang): every flavour fits; gcc Stage 1 headroom 18152 B (main: 18152 B), clang 18424 B
  • esp-stage2-size: plain and SPTM_VIRT_ESP builds link: pass; ESP vital-region margin 435272 B (main: 435272 B)

Limitations and review notes

  • The DCP coprocessor, dart-dcp and dart-disp0 base addresses and the DCP stream number (23) are hard-coded for J804, as J713's display handoff hard-codes its DART. They describe hardware and match J804's ADT. Reviewers may prefer reading them from the ADT.
  • The kernel side (a J804 device tree with DCP nodes) is not upstream yet; until it is, this code does nothing.
  • An opt-in kernel argument may not be the preferred switch; a chosen. config line would also work.

🤖 Generated with Claude Code

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LiamRay11 <228416644+LiamRay11@users.noreply.github.com>

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

Test report, 2026-11-17: Apple Mac mini M6 (J873g/T8152, board 0x24). PR revision tested: 26de0ac2558c00957fc56b76149ad7dbe0ebd8e1.

Tested in combined #283–289 integration 639f4210 on e0a116b1. Adjacent cherry-pick conflicts retained the helpers/calls; a final integration-only reorder of independent helpers fixed source-extraction test boundaries without changing function bodies or tests.

The internal-panel handoff is explicitly gated to J804 / board 0x22. The test machine is a J873g mini / board 0x24, so it cannot qualify the internal-panel feature or j804.dcp=1. Only host/build and unaffected-mini boot coverage is available.

The separate mini display timeout during the RAM-chainload experiment is not a test of this J804 feature. The same timeout occurs with the base+#283 control, and the harness used a private DCP_HANDOFF mode absent from upstream Aura.

Clang 22 Stage1 and ESP Stage2 builds passed. The full suite passed 775 tests plus 10 subtests, with 25 skips; audio/PMP/GPU host harnesses passed. GCC16 Stage1 link failure (__popcountdi2) reproduced on clean base. Candidate ESP Stage2 RAM chainload booted the original Linux kernel with 12 CPUs, NVMe root, USB, wired/Wi-Fi ping checks and four exact GPU readbacks. Stage1 disk boot was not installed or hardware-tested.

Display handoff remains unqualified: both the candidate and base+#283 control reproduced malformed earlycon and DCP -110 errors. The harness used a private DCP_HANDOFF mode absent from upstream Aura; these symptoms were not introduced by #284–289. They do not qualify J804 internal-panel behavior. Original boot was restored, all five ESP payload checksums matched, and final network/GPU/display health checks passed.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the J804 internal-panel DCP handoff.

Two parts don't fit how we usually ship things. The handoff is opt-in through a kernel command-line token (src/kboot.c:11286 dt_bootargs_have("j804.dcp=1")); we avoid boot arguments as the switch that makes a machine work. It is also gated on board_id != 0x22 (:11284) and extends a chip list for the OS-log segment (:4319 chip_id == T6030 || chip_id == T8132 || chip_id == T8152).

The hardware already identifies itself: a dcp alias that is apple,t8152-dcp, and the segment's own flag (seg->unk == 0xa). Could the OS-log rule key on that flag for every DCP, and the handoff run on every T8152 tree with that DCP node, fail-closed on any failed check? If it is not ready to be the default, the kernel driver's readiness (e.g. a DT property it sets) is a better switch than a boot argument.

We can't run an M6 ourselves, but are glad to help line up a J873g owner row.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Adding to the earlier note on the boot argument and board check: a few values could come from the hardware description rather than constants. The coprocessor and DART bases (src/kboot.c:11139-11141) are in the ADT reg of /arm-io/dcp, dart-dcp and dart-disp0; the run check at :11209-11210 can use the existing ASC_CPU_CONTROL / ASC_CPU_CONTROL_RUN names; and the remap >> 36 != 0x10 test (:11153) and SID 23 would read better as named fields. More broadly, src/kboot_display_handoff.c already has the table-driven struct dcp_soc handoff for the other chips; could T8152 become an entry there (extending it for the t8110 DART walk) instead of a separate path? That would also give it the shared fail-closed transaction. #301 touches the same DCP's hand-off state, so it may be worth aligning the two. Happy to help.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants