Repository navigation
kboot: T8152: hand the running internal-panel DCP to Linux (successor of #289) - #601
Conversation
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>
|
@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 |
There was a problem hiding this comment.
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.
|
Merge readiness at
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>
There was a problem hiding this comment.
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.
|
Boot-owner disposition for the review App's HOLD at
@DjDeveloperr, this is the call unless you object within your window. |
There was a problem hiding this comment.
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.
|
Merging at |
|
Known-gap issue: #615 |
|
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. |
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>
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 currentmain, 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
dcpalias naming anapple,t8152-dcpnode (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 pagedart-dcp(the DCP stream, SID 23) anddart-disp0(SID 0 and 16) map belongs to a segment in the ADTiop-dcp-nubsegment-ranges. It then reserves those segments, publishes the firmware UUID and enablesdcp,disp0,disp0_piodmaand their DARTs, all insidedt_display_transaction(). If any check fails, nothing is published and the panel stays on simple-framebuffer.Dj's points (review of
26de0ac2)j804.dcp=1,dt_bootargs_have()andboard_id == 0x22are gone. The handoff runs on every T8152 tree whosedcpalias isapple,t8152-dcp, and it fails closed. J873g trees (apple,t8152-dcp-iboot) aren't a target. The names change from J804 to T8152.!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 markedapple,dcp-os-log. A flags-0xa segment with a real remap keeps its DART mapping as before. A T8142__OS_LOGcan have a live DART alias that differs from its descriptor (dt_reserve_m5_display_segments()), so a remapped log must not lose its mapping.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 intest_j713_dcpext_ready.pyused a remapped log (0x20000000); it now repeats phys, as the real J713 ADTs do.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.t8152_dcp_page()matches DART pages only against non-0xa segments, so adart-dcppage 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.asc_init("/arm-io/dcp")+asc_cpu_running()(ASC_CPU_CONTROL).dart-dcpanddart-disp0are walked at their ADTreg, with the reg size as the register window. The nit is fixed too:T8152_DCP_SID(23) andT8152_DCP_DVA_SHIFT/T8152_DCP_DVA_WINDOW(remap >> 36 == 0x10) are now named.Also from the App review (
c8124aa6): the DRAM bounds come fromdt_t8152_dram()(exact u64dram-base/dram-size, non-zero, no wrap). Each segment is checked byt8152_dcp_bad_segment()without unchecked ends, and phys + size and remap + size must not wrap.maina4e4603e. The call now runs in the minimal-boot branch afterdt_set_gpu()and beforedt_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-runningstays 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_socinkboot_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, ...)",dcpokay, 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
c8124aa6on the buildbox: host pytesttests/python1501 passed, 28 skipped (maina4e4603e: 1493 passed, 28 skipped).test_t8152_dcp_handoff_selector.py: selector, call site, ADT bases, the remap == phys rule, exact DRAM bounds, and a compiledt8152_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.USE_CLANG=1 RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1 BUILDSTD=1 BUILTIN_LOGO=auroraand the default Stage 1 (USE_CLANG=1 BUILDSTD=1) both build.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-formatis clean onsrc/kboot.c.A test-only commit on top (
cf325baf, Ryan Murray) stubs this series' newdt_prepare_t8152()calls intests/python/test_t8152_audio_dt.pywithout 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 (mergef5f2e948of the four heads beforec8124aa6, 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:
T8152 DCP handoff published, eDP-1 driven by the DCP driver, 0 DART faults, 0 failed units, 0 AVCs.Revert:
git revert -m 1 <merge sha>.@DjDeveloperr