Repository navigation
drm/apple: m4: power down idle external DCPs at runtime - #3321
Conversation
J713's external display coprocessors (dcpext0/1) are handed over running by the boot loader and adopted at probe. Previously they stayed powered on indefinitely whenever no external display was attached, keeping their CPU, front-end, system PMGR domains, and both CIO DARTs active until a deep sleep. Reuse the existing external DCP stop/start sequence (A500, RTKit idle, CPU stop, display and firmware CIO DART save/power-off via apple_dart_cio_prepare_runtime(), and consumer-switched PMGR power-off) to power down idle external DCPs 5 seconds after probe or route deactivation when no Type-C/Thunderbolt route, cable, or active scanout is present. Before stopping, close host AFK command admission and drain AFK endpoint workers across all external endpoints, recheck display-DART and session preconditions after A500 callback drain, and close AFK RX before idling RTKit so no queued reply, EDID RPC, or GETBUF runs against a stopped DCP or powered-off DART. Retry recoverable busy refusals with capped backoff, reopen AFK admission once retained wake completes, and propagate latched session errors on future wake attempts. Wake the external DCP synchronously on Type-C/Thunderbolt route activation before touching the port or crossbar, and keep an idle-stopped DCP powered off across system suspend and resume until a route needs it. On device remove, wake any idle-stopped external DCP so both CIO DART transactions finish before devres unbinds their owners. Signed-off-by: Erik Bourget <erik@ebourget.net>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
RyanTheTide
left a comment
There was a problem hiding this comment.
Merge-train status at 485ae602: not mergeable yet. The body shows builds, checkpatch and selftests, but no hardware run. This is 1.4k lines of external-DCP runtime power management on T8132.
Missing before merge: a T8132 row at this head: a J713 (MSI or dock external) and/or Dj's J773g. Cover an idle external DCP powering down and coming back on hotplug, DPMS and s2idle, with a 0 DCP crash/timeout count. I'll run the adversarial review against that head when the row lands.
Add the closed and rebind_allowed fields to the mock struct dptx_port and extract dptx_service_rebind() so the host test compiles against the updated dptx-service.h and dptxep.c helpers. Signed-off-by: Erik Bourget <erik@ebourget.net>
|
Updated to At On the requested hardware rows: our lab J713 currently runs |
|
Updated the PR body with the standalone J713 (M4 Air, 27.2 firmware) boot check at |
Signed-off-by: Erik Bourget <erik@ebourget.net> # Conflicts: # drivers/gpu/drm/apple/afk.c # drivers/gpu/drm/apple/dcp.h # tools/testing/selftests/drivers/gpu/apple-afkv2/extract-send.py
Keep dcp_send_message_ret() atomic on non-14.7/non-ext26 firmware so retained-session AFK doorbells can hold afk_tx_lock across the final failure check, ring write-pointer publication, and mailbox send, while leaving sleepable 14.7 and native-26 sends outside spinlocks. Signed-off-by: Erik Bourget <erik@ebourget.net>
Propagate doorbell transport errors from afk_send_epic_token() and record whether the TX ring write pointer was published. When a command send fails after publishing wptr, retain the command slot and DMA buffers until a late reply or session quarantine instead of freeing buffers that a subsequent doorbell could expose. Signed-off-by: Erik Bourget <erik@ebourget.net>
…oundary Extract afk_send_may_sleep(), afk_send_raw_locked(), afk_send_ret(), and afk_send_epic_token() in extract-send.py instead of stubbing afk_send_epic(), assert lock state at dcp_send_message_ret(), and add coverage for early-RX overflow between admission and send as well as failed doorbells after ring publication. Also update recovery.py's tx_lock struct injection to match the expanded endpoint struct. Signed-off-by: Erik Bourget <erik@ebourget.net>
|
Updated
At J713 (M4 MacBook Air, T8132, firmware 27.2) at The 26.6.2-firmware T8132 external-DCP runtime idle power-off / hotplug / DPMS / |
There was a problem hiding this comment.
Verdict: HOLD at e79507d7
Blockers:
- Targets open non-default base branch
feat/apple-dart-cio-runtime(#3320). Retarget tomainonce#3320merges. - Needs a live T8132 external-DCP idle power-off / wake hardware row at the rebased head (the prior standalone J713 boot hit
-ENODEV: no IOMMU domainon the older base) plus green CI (pr-text/readinesswere cancelled).
Checked:
485431e5(afk_tx_lockserialization for retained-session AFK doorbells),53c54d67(preserving published DMA on EPIC doorbell error), ande79507d7(apple-afkv2selftests across transport branches) look sound;MERGEABLEagainstfeat/apple-dart-cio-runtime.- Checked for Apple material, tool attribution, and private serials: clean.
Evidence
- Head:
e79507d7594a(base: feat/apple-dart-cio-runtime,mergeable: MERGEABLE,+1684/-200across 19 files).
|
Acknowledged the
|
|
Row:
|
|
I reproduced the two conflicts against main deedd80 and prepared a forward merge at tree aece6983521a3ccc90d9cfd0b0ab0bf978a4008d. Resolution
The native startup, compact-start, tunnel-prepare, AFKv2 and admission tests all passed. Please forward-merge main using this resolution. Arm64 Apple build and DCP KUnit The J773g firmware-27 regression run still needs a base that binds dcpext0. This candidate retains the locked firmware-root check that disables the HDMI chain on the reported J773g setup. The J313 shared AFK smoke remains open. |
Merge main at deedd80. The tree is the resolution posted on the PR at 13:32 UTC (tree aece698). Conflicts: - drivers/gpu/drm/apple/afk.c (afk_send_epic_token): keep the PR's afk_tx_lock section (crash and RX-overflow check, afk_tx_closed and tx_paused fences) and put main's three-state firmware 27 sleep gate inside it. The J516s panel OPEN/command exception (panel_resume) bypasses only the sleep gate, never the PR's fences. Replies pass as before. - tools/asahi/dcpext26-startup-tests.py: take main's apple_dcp stub (adds hw.afk_name_fallback) and keep the PR's dptx_port fields (closed, rebind_allowed). Not a text conflict, but needed by the merge: - tools/testing/selftests/drivers/gpu/apple-afkv2/extract-send.py: the PR's extracted-sender stub declared sleep_v27_closed as a bool and had no j516s_panel_service, so the merged sender did not compile. The stub now uses main's enum and field, and a new case checks that the panel exception leaves tx_paused, afk_tx_closed and the RX-overflow latch in force. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Forward-merged main Resolutions:
Local results (pc; the host-tests.yml image with clang 18, gcc 13, rust 1.96.0 and Python 3.14):
Hardware row: the 09:45 no-regression row still applies. No resolved line changes what runs on T8132. The panel exception needs |
satchlj
left a comment
There was a problem hiding this comment.
Reviewed the forward-merge resolution at 50fcde6abc87 against main (deedd808cefd) and the full 21-file diff (+1721/-211):
drivers/gpu/drm/apple/afk.c(afk_send_epic_token): preservesafk_tx_lockserialization,afk_tx_failed_under_tx_lock(ep),afk_tx_closed, andtx_pausedfencing while layering the 3-statesleep_v27_closedgate andpanel_resumeexception (DCP_V27_TX_PANEL_OPEN && ep->j516s_panel_service && ...) sopanel_resumebypasses only the v27 sleep gate and neverafk_tx_closed,tx_paused, orafk_rx_failed.tools/asahi/dcpext26-startup-tests.py: retains bothmain's expandedstruct apple_dcp(hw.afk_name_fallback) and thedptx_port(closed,rebind_allowed) rebind fields.tools/testing/selftests/drivers/gpu/apple-afkv2/extract-send.py: updates the stub tosleep_v27_closed/j516s_panel_serviceand adds regression coverage confirmingDCP_V27_TX_PANEL_OPEN+j516s_panel_servicepermitsAFKV2_OPENwhiletx_paused,afk_tx_closed, andafk_rx_failedstill reject (-EBUSY/-EBUSY/-ENOSPC) without advancingtx_wptr.- Local build and test receipt at
50fcde6abc87is clean (W=1drivers/gpu/drm/apple/44 objects 0 warnings/0 errors,CHECK_DTBSclean ont8132-j773g/t6030-j516s/t6050-j714s,run-host-tests.py950/952 withapple-afkv2,dcpext26-startup-tests,afk-compact-start-tests, anddcp-tunnel-prepare-testspassing and only the two pre-#3939mainfixture failures), andpr-textis green.
|
Thanks satchlj, the review gate is met at Merge still needs two hardware rows at this head. The earlier J773g row at
Both receipts will be posted here with the merge-tree SHA. A J313 smoke from erikwb would also count as the second generation. We merge once the rows pass, pinned to |
J700 second-generation row: PASS at head
|
| Check | Result |
|---|---|
| Panel DCP binds | 412e00000.dcp bound to apple-dcp, display-subsystem bound to apple-drm. eDP-1 connected, enabled, dpms On, 2408x1506, active on crtc-0 with a framebuffer on plane-0. |
| 2× DPMS off/on | Via kscreen-doctor --dpms off/on in the KWin session. Each off reached crtc active=0, dpms=Off within 1.3 s, and each on restored the panel state above within 1.5 s. |
| One s2idle | rtcwake -d rtc0 -m freeze -s 30 returned 0. success 0→1, fail unchanged, entry and exit lines present, 31.0 s wall time. The panel state held 0.1 s after the wake. |
| AFK/DCP/DART errors | 0. The check matched every dev_err/dev_warn format in the merged afk.c (send/ack timeouts included, plus compact TX doorbell failed), the PR's dcp.c stop/refusal warnings, -16 (tx_paused) refusals, co-processor crashes and apple-dart faults. |
| WARN/BUG/Oops/lockup | 0 |
| Failed units | 0 |
The only error-level kernel lines in the trial boot were apple_sep Touch ID sensor messages. The J700 has no Touch ID reader, and stock logs the same lines.
Stock restored: the return boot ran the configured Stage 2 and the stock 7.3.0-41 kernel. boot-ctxr.bin is byte-identical to before (71a44f37…), no marker is left, the trial files are removed, the stock and snapshot diffs are empty, and the PMU boot-error count is 00.
|
Local qualification at
The J700 PASS covers the shared AFK path. The train still lists the exact-head J773g HDMI/DP-3 result as open. |
|
Hardware re-run row (active
|
|
Local CI at exact head Refreshed on current main
The J773g active external DCP row and J700 shared-AFK row both passed at this head. The readiness workflow was rerun after the J773g receipt. |
What: Power down idle T8132 (
iomfb_m4.c) external display coprocessors (dcpext0/dcpext1) 5 seconds after probe or Type-C/Thunderbolt route deactivation when no route, cable, or active scanout is present, reusing the external DCP stop/start sequence (A500, RTKit idle, CPU stop, firmware/display CIO DART power-off viaapple_dart_cio_prepare_runtime(), and consumer-switched PMGR power-off) and waking synchronously on route activation or device removal.Tested: Host builds (
ARCH=arm64 LLVM=1 W=1drivers/gpu/drm/apple/), KUnit (display188 passed / 1 skipped,apple-dcp-fabric/tests/.kunitconfig117/117,topology216 passed / 1 skipped), host selftests (dcpext26-startup-tests.py --mutants,afk-compact-start-tests.py+ 10 mutations,dcp-tunnel-prepare-tests.py+ 17 mutations,backlight-coldboot-tests.py,dart-cio-owner-tests.py,apple-afkv22/2,apple-dcpm49/9 andedid4/4,run-host-tests.py --only apple-dcp87/101), andcheckpatch.pl --strict(0 errors) pass at88ddb89bee8c. Prior J713 (M4 MacBook Air, T8132, firmware 27.2) internal-DCP / DPTX /eDP-1standalone regression ran at prior merge head8854a58b1e2e(before88ddb89bee8cmergedorigin/main19ee1b5bc9d5and adoptedmain'safk_start_compact_service()):eDP-12560x1664@60enabled,0failed units,0AppArmor denials,0oops/WARN,3xDPMS off/on before +2xafter sleeps (dpmsStatusfalse/true,errunchanged),3xs2idle(suspend_statssuccess1 -> 2 -> 3,fail0, no newerrline; external display processors unprobed onmain, +2err), supplementing the earliere79507d7594arow in batched candidateb3dbf237542b.Risk: two-way door · T8132 (
iomfb_m4.c) external display processors on 26.6.2 firmware, plus shared AFK/DPTX compact endpoint pause/rebind helpers (afk.c,dptxep.c,dcp.c,dcp-fabric.c).Not yet: J713 (M4 MacBook Air, T8132, firmware 27.2) internal-DCP / DPTX /
eDP-1boot, DPMS, ands2idleregression row at88ddb89bee8c(8854a58b1e2ewas the prior merge head, whereas88ddb89bee8cadoptedmain'safk_start_compact_service()); second Mac family boot/smoke row on J313 (M1 MacBook Air, T8103, covering sharedafk.c/dcp.c/dptxep.c/dcp-fabric.cpaths) at88ddb89bee8c; live T813226.6.2-firmware external-DCP runtime idle power-off, hotplug wake, DPMS, ands2idlecycle with zero DCP crashes or timeouts (J713 external/dock or J773g on26.6.2; the lab J713 runs27.2firmware, wheredcp_t8132_ext_m4_node()is inactive).Details
origin/main(19ee1b5bc9d5) over pushedc458d87ef7e5at88ddb89bee8c(adoptingmain's pre-publishafk_start_compact_service()/ops->defer_startinafk.c/afk.h/dptxep.c, preservingep->tx_active/afk_tx_admit_locked()andep->compact_start_errwakeup, combiningfixed_deselectedrollback withiomfb_m4_ext_idle_release()indcp-fabric.c, and updatingdcpext26-startup-tests.py,afk-compact-start-tests.py, anddcp-tunnel-prepare-tests.pyfor the merged fields and wake/release hooks) after earlier forward merges oforigin/main(c458d87ef7e5) and#3320(7aace5080187, since merged intomain).git revert -m 1 <merge_commit>onmain(or reverte79507d7594a,53c54d67efee,485431e52252,6a87b4da7a47, ande2b3bb83b459in reverse order). Kernel driver and host-test changes only; no persistent on-disk, ESP, Stage 2, or DT state is modified.iomfb_m4.c,dcp-fabric.c,dcp.c):DCP_M4_EXT_IDLE_DELAY_MS) after external DCP adoption and route release (and retries recoverable busy refusals with capped backoff up toDCP_M4_EXT_IDLE_MAX_DELAY_MS).dcp_m4_receive_early->afk_receive_message_early) with bounded worker drain before idling RTKit, and cleanly unwinds on refusal or failure.iomfb_m4_ext_route_ready()) so Type-C/Thunderbolt route selection still sees an idle-stopped or restarting DCP as eligible while rejecting terminal port withdrawal or close, then wakes the DCP synchronously before touching DPTX/crossbar.iomfb_m4.c,afk.c,dptxep.c,dcp.c):might_sleep()indcp_send_message_ret()to sleepable 14.7 and native-26 mailboxes (!(native_14_7 || dcp_is_ext26(dcp))uses atomic RTKit sends), so retained-session AFK doorbells serialize AFK early-RX overflow, session failure, ringwptrpublication, and the mailbox doorbell underdcp->afk_tx_lock, while 14.7 and native-26 doorbells stay outside spinlocks underep->tx_lock.afk_send_epic_token()and records whetherwptrwas published; when a command doorbell fails afterwptrpublication,afk_send_command_common()keeps the slot and DMA buffers owned (free_on_ack/crashedon ext26) until late completion or session quarantine unless firmware already completed the command.afk_quiesce()on failure); gates compact DPTX rebinding onport->rebind_allowedarmed after confirmed CPU reset and waits for fresh-generation unit 0 startup before returning from wake.ext_lost_swap,ext_early,ext_hold_id,ext_orphan_start,ext_buf_lost,ext_front,ext_buf_stale,ext_win[].on_screen) and clears partial compact AFK RX assembly (afk_compact_rx_reset(), plus rejecting idle stop whilecompact_rx.receivedis nonzero) on confirmed CPU reset while preserving state on same-session rollback.tools/testing/selftests/drivers/gpu/apple-afkv2/extract-send.pyto extract productionafk_send_may_sleep(),afk_send_raw_locked(),afk_send_ret(), andafk_send_epic_token()with lock-state assertions atdcp_send_message_ret(), overflow-between-admission-and-send coverage, and post-publication doorbell-failure tests; updatestools/testing/selftests/drivers/gpu/apple-dcp/recovery.py(tx_lockfield injection andafk_send_epic_published()),compact.c,test-admission.py,afk-parser-test.c,av-lifetime-test.c, andtools/asahi/dcpext26-startup-tests.py.Evidence
make O=_build_w1 ARCH=arm64 LLVM=1 W=1 drivers/gpu/drm/apple/(defconfig+asahi.config,CONFIG_RUST=n,CONFIG_DRM_FBDEV_EMULATION=y) at88ddb89bee8c— 0 errors, 0 warnings../tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/apple/tests/display.kunitconfigat88ddb89bee8c— 188 passed, 1 skipped (apple_g17_rx_util_min_test, needsCONFIG_UCLAMP_TASK)../tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/apple/tests/.kunitconfigat88ddb89bee8c— 117 passed, 0 failed (apple-dcp-fabric+ scenario suites)../tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/apple/tests/topology.kunitconfigat88ddb89bee8c— 216 passed, 1 skipped (apple_g17_rx_util_min_test, needsCONFIG_UCLAMP_TASK).python3 tools/asahi/dcpext26-startup-tests.py --mutantsat88ddb89bee8c— PASS.python3 tools/asahi/afk-compact-start-tests.py(plus all 10--mutationcontrols) at88ddb89bee8c— PASS.python3 tools/asahi/dcp-tunnel-prepare-tests.py(plus all 17--mutationcontrols, with-Wno-unused-but-set-globalon Clang 23 forsplit_source_select_calls) at88ddb89bee8c— PASS.python3 -I tools/asahi/backlight-coldboot-tests.pyat88ddb89bee8c— PASS.make -C tools/testing/selftests/drivers/gpu/apple-afkv2 run_testsat88ddb89bee8c— 2/2 PASS (run-afkv2-tests.sh917 assertions +test-admission.py).python3 tools/testing/selftests/drivers/gpu/apple-dcp/run.py --group m4at88ddb89bee8c— 9/9 PASS.python3 tools/testing/selftests/drivers/gpu/apple-dcp/run.py --group edidat88ddb89bee8c— 4/4 PASS.HOSTCC="clang -Wno-unused-but-set-global" python3 -I tools/asahi/run-host-tests.py --only apple-dcpat88ddb89bee8c— 87/101 passed (14 pre-existing Clang 23-Wunused-but-set-globalfailures unrelated to#3321).python3 -I tools/asahi/dart-cio-owner-tests.pyat88ddb89bee8c— PASS (35 CIO DART ownership cases, 14 negative controls).scripts/checkpatch.pl --strictacross the 5 non-merge PR commits (e2b3bb83b459,6a87b4da7a47,485431e52252,53c54d67efee,e79507d7594a) — 0 errors, 0 code warnings (1 commit-body line-length warning each on485431e52252,53c54d67efee, ande79507d7594a);git diff --check origin/main...88ddb89bee8cclean.main+8854a58b1e2ebuild, default cmdline, one-shot Stage 2 witht8132-j713.dtb, external display processors unprobed onmain+2err;8854a58b1e2ewas the prior merge head before88ddb89bee8cmergedorigin/main19ee1b5bc9d5and adoptedmain'safk_start_compact_service()):eDP-1connected and enabled at2560x1664@60;0failed units,0AppArmor denials,0oops/WARN.dpmsStatusfalse, every on true,errcount unchanged.s2idlex3 (rtcwake -d /dev/rtc1 -m freeze -s 15):suspend_statssuccess1 -> 2 -> 3,fail0; no newerrline.e79507d7594ain batched candidateb3dbf237542b(main9e38a276dcb4, default cmdline): boot, 3x real DPMS off/on and 3xs2idlewith 0iomfb/afk/dptx/darterrors on the internal DCP, DPTX andeDP-1; externaldcpextruntime idle-off inactive on 27.2 as expected.27.2firmware) boot at6a87b4da7a47(earlier standalone J713 row): booted cleanly (0failed units,0AppArmor denials) and passeds2idle, while internal30ae00000.dcpfailed with-ENODEV: no IOMMU domain(falling back tosimpledrm) because its pre-merge base8c6992db4b9fpredatedmain's 27.2 internal-DCP work (resolved by mergingmainin7aace5080187and verified clean inb3dbf237542b).