Repository navigation
display: hand a lit external AFKv2 DCP on running (J274 27.2 HDMI) - #564
Conversation
On M1 Mac mini (J274, T8103) running macOS 27.2.1 firmware, /arm-io/dcp
drives HDMI directly (display_is_external = true, display_is_dptx = false)
over an AFKv2 disp0-service iBoot interface. Once the display has been
powered on and modeset, rtkit_sleep() times out waiting for the AP power
transition ("rtkit(dcp): AP power transition timed out"), leaving
dcp_running = true so subsequent handoff fails ("Display handoff failed;
returning to proxy") — the same 27.2 firmware behaviour handled for
AFKv2 dptx-port controllers in #451.
Without a connected display (headless, connected:0), display_configure()
returns before powering on the display and rtkit_sleep() still succeeds
in <1 ms, so the headless path keeps sleeping the DCP.
Add dcp_ib_is_afkv2() and generalize display_dptx_hands_on() into
display_dcp_hands_on() so a lit external AFKv2 display is handed on
running via dcp_hand_on() and published to Linux through
apple,rtkit-handoff ("dcp-live-v1"). Evaluate display_dcp_hands_on()
before dcp_ib_shutdown() frees iboot.
Tested:
- J274 (M1 Mac mini, T8103, macOS 27.2.1 main OS):
- Cold boot with HDMI (1920x1200@60) plugged in via enrolled Stage 1:
modeset succeeded, "display: handing the DCP on running (external
AFKv2 display)", published live RTKit session v12 (3 buffers,
epmap 0000051f 00821fff), Linux 7.3.0 apple-dcp adopted dcp-live-v1
seamlessly (fb0 appledrmfb, 1920x1200@60, 0 DART faults, 0 failed
units).
- Headless boot (HDMI unplugged) on patched Stage 2: connected:0,
slept DCP cleanly in 0.4 ms ("pmgr: resetting device 0.DISP0_CPU0").
- Host: clang-format clean, Stage 1 builds cleanly (12,296 B headroom,
no __TEXT_BOOT_EXEC), Stage 2 ESP build links cleanly, full pytest
tests/python: 1251 passed, 26 skipped.
Risk: low — only applies to external displays on an AFKv2 iBoot
interface after power-on; headless external boots, AFKv1 (13.5) external
displays, internal panels, and existing AFKv2 dptx-port displays keep
their previous behaviour.
Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 66355a0f
Blockers: none in the code. Before merge: CI at head (all queued now), plus one regression row on a second Mac. This is Stage 1/2 display code every Mac runs. We'll run that row on our J473 (M2 Mac mini, AFKv2 dptx-port, the path #451 added) once CI is green, and post it here.
Checked:
display_dcp_hands_on()keeps the dptx branch exactly as before. The new branch needsdisplay_is_external && display_external_lit && dcp_ib_is_afkv2(iboot).display_external_litis set only afterdcp_ib_set_power(true)succeeds, and it is cleared indisplay_start_dcp()anddisplay_shutdown().hands_onis evaluated beforedcp_ib_shutdown()freesiboot, which matters.dcp_ib_is_afkv2()is NULL-safe.- Headless external, AFKv1 and internal panels keep their paths, and your tests cover all four cases.
Questions (not blocking):
- Scope. The new branch is not limited to the J274: every Mac whose
disp0(ordispext4on J180d/J475d) isexternaland speaks AFKv2 on 27.2, such as the M1 Max/Ultra Studios, now hands its DCP on running when a display is lit. Have you or anyone seen a Studio on 27.2 fail to sleep the same way? If not, a fail-safe alternative is to try the sleep first and hand on only whenrtkit_sleep()times out. That changes nothing on Macs that sleep fine today. Your call; if you keep the current rule, please add a line under Not yet: naming the Studios. - pr-text wants the door in the Risk line, e.g.
**Risk:** two-way · AFKv2 external-display Macs on 27.2 (J274; also M1/M2 Studios, Mac mini with HDMI on disp0). - Merge order with the companion linux PR. Today a lit J274 boot fails the hand-off and returns to the proxy, so landing this first can only help, even before the kernel adopts the session. Please link the linux PR here.
|
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. |
|
Regression row, J473 (M2 Mac mini, T8112, AFKv2 dptx-port DCP, 27.2 stub), aura-try Stage 2 one-shot of exact head
That covers the dptx branch of |
|
CI at Editing the description re-runs the check. Once it passes I'll approve and merge. |
RyanTheTide
left a comment
There was a problem hiding this comment.
Approved at 66355a0f.
- Rows at head: your J274 cold boot with HDMI and headless boot, and our J473 regression row on the dptx branch (PASS, matching production).
- CI: every build, format and Pytest job passes. The gcc/fedora/nix Stage 1 room jobs show main's own headroom.
- pr-text: its only error was the Risk door, which the edited line now has. The re-run is queued behind the Actions backlog, so I checked the text by hand: Tested/Risk present, Signed-off-by present, no attribution.
Thanks for the Studio scope note in the Risk line.
…buffers In dcp_rtkit_live_parse(), every apple,rtkit-buffers entry was checked with PAGE_ALIGNED(iova) && PAGE_ALIGNED(size). On 16 KiB arm64 kernels, this rejects firmware-placed (is_mapped == 1) buffers whose RTKit addresses use 4 KiB granularity inside a pre-mapped firmware carveout — for example T8103 (M1 Mac mini J274, fw 27.2.1) places the crashlog buffer (ep 1) at iova 0x276000 (size 0x10000) inside dcp_data (0xbe6510000+0x300000), causing dcp_rtkit_live_parse() to return -EINVAL and aborting apple-drm probe when adopting a live HDMI session from aura. Both dcp_check_iova_contiguous() and dcp_vmap_wc() already handle sub-page offsets cleanly (offset_in_page(phys) + multi-page vmap). Split the validation into dcp_rtkit_live_buf_valid(): - Firmware-placed buffers (is_mapped == 1): require 4 KiB alignment (IS_ALIGNED(..., SZ_4K)), matching the RTKit buffer request protocol. - Loader-allocated buffers (is_mapped == 0): keep host PAGE_ALIGNED() so their no-map reserved-memory carveouts never alias neighbouring pages. Add a KUnit test case (dcp_handoff_live_rtkit_buf_valid) in dcp_handoff_test.c covering firmware-placed 4 KiB buffers, loader-allocated page alignment, endpoint IDs, flags, size limits, and address wraparound. Tested: - J274 (M1 Mac mini, T8103, macOS 27.2.1 main OS, 16 KiB kernel) booted with HDMI (1920x1200@60) via aurora-silicon/aura#564 live handoff (dcp-live-v1, ep1 iova=0x276000 size=0x10000 is_mapped=1, ep2/ep4 loader-allocated): 231c00000.dcp adopted the live RTKit session cleanly ("DCP booted", "set_digital_out_mode finished:8242", "boot scanout retired by displayed swap 3", fb0 appledrmfb, 0 DART faults, 0 failed units), 271c00000.dcp and USB-C Type-C muxes bound cleanly. - KUnit (arm64): apple-dcp-handoff 3/3 passed (dcp_handoff_external_idle, dcp_handoff_boot_notch, dcp_handoff_live_rtkit_buf_valid). - scripts/checkpatch.pl: 0 errors, 0 warnings. Risk: low — only relaxes alignment from PAGE_SIZE to SZ_4K for firmware-placed (is_mapped == 1) live RTKit buffers, which are still verified to be contiguously DART-mapped inside a no-map DCP carveout and mapped via dcp_vmap_wc(). Loader-allocated buffers keep full PAGE_ALIGNED() enforcement. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
What: Hand lit external AFKv2 DCP displays on running via
dcp_hand_on()instead of timing out inrtkit_sleep()on macOS 27.2 (fixing J274 HDMI handoff, generalizing#451'sdptx-portrule intodisplay_dcp_hands_on()). Companion kernel PR: aurora-silicon/linux#3552.Tested: J274 (M1 Mac mini, T8103, macOS 27.2.1) at
66355a0fd255: cold boot with HDMI1920x1200@60hands DCP on running and Linux adoptsdcp-live-v1cleanly (0DART faults,0failed units); headless boot sleeps DCP cleanly in0.4 ms— PASS. J473 (M2 Mac mini, T8112, 27.2 stub) regression row at66355a0fd255(thanks@RyanTheTide): PASS. Hostclang-format, Stage 1/2 builds,pytest tests/python: 1251 passed, 26 skipped.Risk: two-way · AFKv2 external-display Macs on 27.2 (J274; also M1/M2 Studios, Mac mini with HDMI on
disp0). Headless external boots, 13.5/AFKv1 external displays, internal panels, and existing AFKv2dptx-portcontrollers keep their previous paths.Not yet: M1/M2 Mac Studio (
disp0/dispext4) hardware verification on macOS 27.2.Details
Problem
On M1 Mac mini (J274 / T8103) with macOS 27.2.1 firmware,
/arm-io/dcpdrives HDMI directly (display_is_external = true,display_is_dptx = false) over an AFKv2disp0-serviceiBoot interface. Once HDMI is powered on and modeset,display_shutdown(DCP_SLEEP_IF_EXTERNAL)callsrtkit_sleep()which times out (rtkit(dcp): AP power transition timed out), leavingdcp_running = trueso subsequent chainload/Linux handoff fails withDisplay handoff failed; returning to proxy.This is the same 27.2 firmware behaviour addressed for AFKv2
dptx-portcontrollers (M2 Mac mini J473) in #451, exceptdisplay_dptx_hands_on()only matcheddisplay_is_dptx. Headless J274 boots (connected:0, never powered on) still sleep cleanly in ~0.4 ms.Change
dcp_ib_is_afkv2()insrc/dcp_iboot.{h,c}exposingafk_epic_is_v2(iboot->epic).display_external_litinsrc/display.cwhen an external display is powered on indisplay_configure()(cleared indisplay_start_dcp()anddisplay_shutdown()).display_dptx_hands_on()intodisplay_dcp_hands_on()to match both AFKv2dptx-portcontrollers and lit external AFKv2 displays, evaluated beforedcp_ib_shutdown()freesiboot.tests/python/test_display_dptx_hand_on.pyto cover lit external AFKv2 (hands on running), headless external AFKv2 (keeps sleep), AFKv1 external (keeps sleep), and internal AFKv2 (keeps quiesce); updatetests/python/test_t8103_iboot_power_status.pyharness.Note: Linux adoption of the live T8103
dcp-live-v1session also needs the companion 4 KiB alignment fix indcp_rtkit_live_parse()for T8103's firmware-placed crashlog buffer (ep=1,iova=0x276000,is_mapped=1), submitted in aurora-silicon/linux#3552.Evidence
66355a0fd255:1920x1200@60) plugged in via enrolled Stage 1: modeset succeeded (570 ms),display: handing the DCP on running (external AFKv2 display), publisheddcp-live-v1(v12, 3 system buffers,epmap 0000051f 00821fff), and Linuxapple-dcpadopted the live RTKit session cleanly (card1-HDMI-A-1: connected, enabled,boot scanout retired by displayed swap 3,0DART faults,0failed units).connected:0, slept DCP cleanly in0.4 ms(pmgr: resetting device 0.DISP0_CPU0).clang-formatclean, Stage 1 builds cleanly (_file_vital_end 0x11cff8of0x120000, headroom12296 B,no __TEXT_BOOT_EXEC), Stage 2 (ESP_STAGE2=1) builds cleanly, fullpytest tests/python:1251 passed, 26 skipped.