Repository navigation
kboot: T6041: hand headless internal DCP over when DT marks a sleep host - #546
Conversation
On a headless T6041 Mac (J575c), iBoot starts the internal DCP without an internal panel and without a /vram segment in iop-dcp-nub; /vram is a dummy boot framebuffer outside the firmware segments that dart-disp0 SID 0 may map. When a headless T6041 device tree marks the internal dcp node with apple,sleep-host-stop, allow the internal DCP handoff without a /vram firmware segment, skip dummy /vram pages during the disp0 SID 0 page-table walk, and add the boot framebuffer memory-region to the display subsystem while keeping the display subsystem and its DART disabled for the kernel display gate. External processors share the handed-off dcp-text@ region. Headless T6041 device trees without apple,sleep-host-stop keep the existing external-only path unchanged so existing kernels continue to boot without modification. Panel T6041 boards continue to require /vram inside the DCP segments. Add ASan/UBSan host tests covering external-only compatibility, headless sleep-host handoff (with and without disp0 heap segments), repeat idempotency, invalid disp0 mappings, zero-sized /vram, and panel refusal. Signed-off-by: Roberto Dantas <7robertodantas@gmail.com>
|
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. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
The stock-DT J575c boot covers the external-only fallback. The seven host cases exercise the new internal handoff, including retaining the display heap alongside the dummy framebuffer and refusing an out-of-range display mapping. The remaining hardware question is whether the kernel can claim that framebuffer and resume the displays with the sleep-host property present. The paired kernel DT and this Stage 2 head would cover that path.
Hosted CI also has a concrete size failure. Fedora, GCC and Nix report 4,008, 3,696 and 3,152 bytes of Stage 1 headroom against the 4,096-byte minimum. The Stage 2 vital-size job and the Python jobs passed. Since the changed handoff is Stage 2 code, comparing the same CI base before changing the handoff would distinguish a base size regression.
RyanTheTide
left a comment
There was a problem hiding this comment.
Approved at bb76c89.
The new internal hand-off is gated on t6041_headless_sleep_host(), which needs the apple,j575c T6041 Max plus apple,sleep-host-stop on dcp. No shipped DT has that property yet, so on today's DTs only the external-only path changes. Your J575c stock-DT row at head covers that path: both outputs active, 0 failures. I traced these points:
no_panelis set beforedcp6_dry_run(), which is what callsdcp6_derive_segs(). Every other board still bails when no segment is/vram. The new/vramsize read is the same lookup asdcp6_adt_reg(), now with a size.- The dummy-framebuffer exemption in
dcp6_run_add()needs all three ofseg_vram < 0, the display SID and an address inside/vram. Any other unmapped address still bails. - The shared TEXT now prefers the internal DCP's segment when one was derived. A headless board with no derived segments still uses the first external processor's TEXT, because
nsegsstays 0.t6041_headless_textis reset on every call. - Switching
memory-regionfrom setprop to appendprop keeps the display heap. The framebuffer is added only once, thanks to thememory-region-namescheck.
On the merge with main 0779664: 454 display/DCP/T6041/hand-off host tests pass, 1 skipped. The one collection error is a missing construct module on my host and happens on main too.
On Dj's open hardware question: the gated path is reached only by the kernel DT that adds apple,sleep-host-stop. That PR needs a J575c row with this Stage 2, covering framebuffer claim and display resume across s2idle/deep. Please link it here when you open it. The failing gcc/fedora/nix "Stage 1 room" jobs are main's own (fedora 4008 B on main too), and this change adds 0 bytes to Stage 1.
What: Allow
aurato hand off the headless T6041 internal DCP (no panel, no/vramsegment iniop-dcp-nub) when the device tree marks thedcpnode withapple,sleep-host-stop, while keeping the existing external-only path unchanged for older headless T6041 DTs without that property.Tested: J575c (Mac Studio M4 Max, T6041) at
bb76c893: live one-shot ESP Stage 2 boot (1.0.0b17-gbb76c893) on stock Arch Linux kernel7.3.0-1-40-ARCHwith unmodified stock DTB and default cmdline (HDMI-A-1andDP-2active at2560x1440,0failed units,0new kernel warnings/errors), plus ASan/UBSan host tests (235 passed, 1 skipped; control run6 failed, 1 passed),make format-check(rc=0),make rustfmt-check(rc=0), ESP vital size (368488 Bfree), and Stage 1 sizefedora(rc=0).Risk: two-way door · T6041 (J575c). Code changes are Stage 2 only (
0bytes added to Stage 1); panel T6041 boards (J614c/J616c) remain gated out ofno_panelbyt6041_headless()and continue requiring/vraminside the DCP segments; existing headless T6041 DTs withoutapple,sleep-host-stoptake the unmodified external-only path.Not yet: a panel T6041 (J614c/J616c) peer run; live boot with a kernel DT carrying
apple,sleep-host-stopat this exact commit (the sleep-host DT consumer is a separate follow-up kernel PR; the same handoff logic was exercised across 6/6 J575c deep-sleep cycles in a combined development tree).Details
/vramsegment iniop-dcp-nub;/vramis a dummy boot framebuffer outside the firmware segments thatdart-disp0SID 0 may map.t6041_headless_sleep_host(dt)seesapple,sleep-host-stopondcp(already used ont6041-j614c-j616c.dtsi),dcp6.no_panelis set:dcp6_derive_segs()anddcp6_get_segs()allow the internal DCP handoff without a/vramfirmware segment while keeping/vrammandatory on panel T6041 boards.dcp6_run_add()skipsdart-disp0SID 0 pages that fall within ADT/vraminstead of aborting the walk, and logs the skipped page count.t6041_ext_handoffs()andt6041_headless_display_fb()share the handed-off internaldcp-text@region with external processors and append the bootframebuffermemory-region todisp0(idempotently) while leavingdisp0and its DARTdisabledfor the kernel display gate to enable alongsidedcp.apple,sleep-host-stopkeepdcp6.no_panel = falseand execute the exact existing external-only path so stock kernels never regress.tests/t6041_headless_display_host.candtests/python/test_t6041_headless_display_handoff.pyadd 7 ASan/UBSan scenarios (j575c-external-only,j575c-sleep-host,j575c-sleep-host-heap,j575c-sleep-host-repeat,j575c-sleep-host-bad-disp-pa,j575c-sleep-host-zero-vram,j616c-no-vram).Evidence
make format-check(clang-format==20.1.8)bb76c893rc=0)make rustfmt-checkbb76c893rc=0)pmp-boot-data,fdt-disable,aop-os-ram,rtkit-placed-buffer,t8122-gpu26-identity)bb76c893(GCC)bb76c893235 passed, 1 skipped)src/kboot_display_handoff.creverted to26c1a85b, new tests kept)26c1a85b6 failed, 1 passed; onlyj575c-external-onlypasses)tests/python+ T8122 GPU pytest (GCC)bb76c8931234 passed, 52 skipped(test_chosen_manifest_parse_validationfails in Fedora container due to missing clanglibclang_rt.asan.a, unrelated)CHAINLOADING=1)bb76c893rc=0;aura.bin1638400 B, ESP Stage 24063232 B)esp_vital_size.py)bb76c893811160 B / 1179648 B,368488 Bfree)stage1_size.sh fedora)bb76c893rc=0, headroom4168 B;kboot_display_handoff.ois Stage 2 only)1.0.0b17-gbb76c893) with unmodified stock7.3.0-1-40-ARCHDTB and default cmdlinebb76c893HDMI-A-1+DP-2active at2560x1440,0failed units,0new kernel warnings/errors