Skip to content

drm/apple: m4: power down idle external DCPs at runtime - #3321

Merged
DjDeveloperr merged 11 commits into
mainfrom
feat/iomfb-m4-ext-idle-off
Dec 2, 2026
Merged

DjDeveloperr merged 11 commits into
mainfrom
feat/iomfb-m4-ext-idle-off

Conversation

@erikwb

@erikwb erikwb commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

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 via apple_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=1 drivers/gpu/drm/apple/), KUnit (display 188 passed / 1 skipped, apple-dcp-fabric / tests/.kunitconfig 117/117, topology 216 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-afkv2 2/2, apple-dcp m4 9/9 and edid 4/4, run-host-tests.py --only apple-dcp 87/101), and checkpatch.pl --strict (0 errors) pass at 88ddb89bee8c. Prior J713 (M4 MacBook Air, T8132, firmware 27.2) internal-DCP / DPTX / eDP-1 standalone regression ran at prior merge head 8854a58b1e2e (before 88ddb89bee8c merged origin/main 19ee1b5bc9d5 and adopted main's afk_start_compact_service()): eDP-1 2560x1664@60 enabled, 0 failed units, 0 AppArmor denials, 0 oops/WARN, 3x DPMS off/on before + 2x after sleeps (dpmsStatus false/true, err unchanged), 3x s2idle (suspend_stats success 1 -> 2 -> 3, fail 0, no new err line; external display processors unprobed on main, +2 err), supplementing the earlier e79507d7594a row in batched candidate b3dbf237542b.
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-1 boot, DPMS, and s2idle regression row at 88ddb89bee8c (8854a58b1e2e was the prior merge head, whereas 88ddb89bee8c adopted main's afk_start_compact_service()); second Mac family boot/smoke row on J313 (M1 MacBook Air, T8103, covering shared afk.c/dcp.c/dptxep.c/dcp-fabric.c paths) at 88ddb89bee8c; live T8132 26.6.2-firmware external-DCP runtime idle power-off, hotplug wake, DPMS, and s2idle cycle with zero DCP crashes or timeouts (J713 external/dock or J773g on 26.6.2; the lab J713 runs 27.2 firmware, where dcp_t8132_ext_m4_node() is inactive).

Details
  • Merge history:
    • Forward-merged origin/main (19ee1b5bc9d5) over pushed c458d87ef7e5 at 88ddb89bee8c (adopting main's pre-publish afk_start_compact_service() / ops->defer_start in afk.c/afk.h/dptxep.c, preserving ep->tx_active/afk_tx_admit_locked() and ep->compact_start_err wakeup, combining fixed_deselected rollback with iomfb_m4_ext_idle_release() in dcp-fabric.c, and updating dcpext26-startup-tests.py, afk-compact-start-tests.py, and dcp-tunnel-prepare-tests.py for the merged fields and wake/release hooks) after earlier forward merges of origin/main (c458d87ef7e5) and #3320 (7aace5080187, since merged into main).
    • Revert: git revert -m 1 <merge_commit> on main (or revert e79507d7594a, 53c54d67efee, 485431e52252, 6a87b4da7a47, and e2b3bb83b459 in reverse order). Kernel driver and host-test changes only; no persistent on-disk, ESP, Stage 2, or DT state is modified.
  • Runtime idle stop & synchronous wake (iomfb_m4.c, dcp-fabric.c, dcp.c):
    • Arms a 5-second idle work item (DCP_M4_EXT_IDLE_DELAY_MS) after external DCP adoption and route release (and retries recoverable busy refusals with capped backoff up to DCP_M4_EXT_IDLE_MAX_DELAY_MS).
    • Closes host AFK TX admission and drains endpoint workers before A500, rechecks display-DART and session preconditions after A500 drain, defers AFK RX via a fixed-size early-RX ring (dcp_m4_receive_early -> afk_receive_message_early) with bounded worker drain before idling RTKit, and cleanly unwinds on refusal or failure.
    • Exposes a monotonic route-readiness predicate (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.
    • Keeps idle-stopped external DCPs powered off across system suspend/resume until a route activates, and wakes any idle-stopped DCP on device remove so both CIO DART transactions finish cleanly before devres unbinds their owners.
  • Confirmed-reset state hygiene & transport serialization (iomfb_m4.c, afk.c, dptxep.c, dcp.c):
    • Restricts might_sleep() in dcp_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, ring wptr publication, and the mailbox doorbell under dcp->afk_tx_lock, while 14.7 and native-26 doorbells stay outside spinlocks under ep->tx_lock.
    • Propagates doorbell transport errors from afk_send_epic_token() and records whether wptr was published; when a command doorbell fails after wptr publication, afk_send_command_common() keeps the slot and DMA buffers owned (free_on_ack / crashed on ext26) until late completion or session quarantine unless firmware already completed the command.
    • Stages compact initial DPTX discovery and validates/publishes both ports atomically under their service locks (afk_quiesce() on failure); gates compact DPTX rebinding on port->rebind_allowed armed after confirmed CPU reset and waits for fresh-generation unit 0 startup before returning from wake.
    • Retires prior-session swap completion IDs (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 while compact_rx.received is nonzero) on confirmed CPU reset while preserving state on same-session rollback.
  • Host tests: Extends tools/testing/selftests/drivers/gpu/apple-afkv2/extract-send.py to extract production afk_send_may_sleep(), afk_send_raw_locked(), afk_send_ret(), and afk_send_epic_token() with lock-state assertions at dcp_send_message_ret(), overflow-between-admission-and-send coverage, and post-publication doorbell-failure tests; updates tools/testing/selftests/drivers/gpu/apple-dcp/recovery.py (tx_lock field injection and afk_send_epic_published()), compact.c, test-admission.py, afk-parser-test.c, av-lifetime-test.c, and tools/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) at 88ddb89bee8c — 0 errors, 0 warnings.
  • ./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/apple/tests/display.kunitconfig at 88ddb89bee8c — 188 passed, 1 skipped (apple_g17_rx_util_min_test, needs CONFIG_UCLAMP_TASK).
  • ./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/apple/tests/.kunitconfig at 88ddb89bee8c — 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.kunitconfig at 88ddb89bee8c — 216 passed, 1 skipped (apple_g17_rx_util_min_test, needs CONFIG_UCLAMP_TASK).
  • python3 tools/asahi/dcpext26-startup-tests.py --mutants at 88ddb89bee8c — PASS.
  • python3 tools/asahi/afk-compact-start-tests.py (plus all 10 --mutation controls) at 88ddb89bee8c — PASS.
  • python3 tools/asahi/dcp-tunnel-prepare-tests.py (plus all 17 --mutation controls, with -Wno-unused-but-set-global on Clang 23 for split_source_select_calls) at 88ddb89bee8c — PASS.
  • python3 -I tools/asahi/backlight-coldboot-tests.py at 88ddb89bee8c — PASS.
  • make -C tools/testing/selftests/drivers/gpu/apple-afkv2 run_tests at 88ddb89bee8c — 2/2 PASS (run-afkv2-tests.sh 917 assertions + test-admission.py).
  • python3 tools/testing/selftests/drivers/gpu/apple-dcp/run.py --group m4 at 88ddb89bee8c — 9/9 PASS.
  • python3 tools/testing/selftests/drivers/gpu/apple-dcp/run.py --group edid at 88ddb89bee8c — 4/4 PASS.
  • HOSTCC="clang -Wno-unused-but-set-global" python3 -I tools/asahi/run-host-tests.py --only apple-dcp at 88ddb89bee8c — 87/101 passed (14 pre-existing Clang 23 -Wunused-but-set-global failures unrelated to #3321).
  • python3 -I tools/asahi/dart-cio-owner-tests.py at 88ddb89bee8c — PASS (35 CIO DART ownership cases, 14 negative controls).
  • scripts/checkpatch.pl --strict across the 5 non-merge PR commits (e2b3bb83b459, 6a87b4da7a47, 485431e52252, 53c54d67efee, e79507d7594a) — 0 errors, 0 code warnings (1 commit-body line-length warning each on 485431e52252, 53c54d67efee, and e79507d7594a); git diff --check origin/main...88ddb89bee8c clean.
  • J713 (M4 MacBook Air, T8132, firmware 27.2, standalone main + 8854a58b1e2e build, default cmdline, one-shot Stage 2 with t8132-j713.dtb, external display processors unprobed on main +2 err; 8854a58b1e2e was the prior merge head before 88ddb89bee8c merged origin/main 19ee1b5bc9d5 and adopted main's afk_start_compact_service()):
    • Boot: eDP-1 connected and enabled at 2560x1664@60; 0 failed units, 0 AppArmor denials, 0 oops/WARN.
    • DPMS off/on x3 before and x2 after the sleeps: every off dpmsStatus false, every on true, err count unchanged.
    • s2idle x3 (rtcwake -d /dev/rtc1 -m freeze -s 15): suspend_stats success 1 -> 2 -> 3, fail 0; no new err line.
  • Historical J713 (M4 MacBook Air, T8132, firmware 27.2) at e79507d7594a in batched candidate b3dbf237542b (main 9e38a276dcb4, default cmdline): boot, 3x real DPMS off/on and 3x s2idle with 0 iomfb/afk/dptx/dart errors on the internal DCP, DPTX and eDP-1; external dcpext runtime idle-off inactive on 27.2 as expected.
  • Historical standalone J713 (27.2 firmware) boot at 6a87b4da7a47 (earlier standalone J713 row): booted cleanly (0 failed units, 0 AppArmor denials) and passed s2idle, while internal 30ae00000.dcp failed with -ENODEV: no IOMMU domain (falling back to simpledrm) because its pre-merge base 8c6992db4b9f predated main's 27.2 internal-DCP work (resolved by merging main in 7aace5080187 and verified clean in b3dbf237542b).

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>
@erikwb
erikwb requested review from a team as code owners November 26, 2026 22:06
@erikwb
erikwb requested review from Acelogic and maralcbr November 26, 2026 22:06
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Merge readiness at 50fcde6a: not ready yet

Check Detail
CI at head running running: apple-build, KUnit plan
Review ok approved by satchlj
Requested changes ok none
Hardware row at head ok comment at 50fcde6a
Conflicts ok none
PR text ok Risk: two-way · T8132 (iomfbm4.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).

Areas: area:display, area:gpu

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Nov 27, 2026

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

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>
@erikwb
erikwb requested a review from DjDeveloperr as a code owner November 27, 2026 14:36
@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Updated to 6a87b4da7a47 to fix tools/asahi/dcpext26-startup-tests.py, which failed to compile against the dptx-service.h / dptxep.c changes (port->closed, port->rebind_allowed, and dptx_service_rebind()) added here.

At 6a87b4da7a47, dcpext26-startup-tests.py (including --mutants), backlight-coldboot-tests.py, apple-afkv2 (2/2), apple-dcp (--group edid 4/4, --group m4 8/8), dart-cio-owner-tests.py (35 cases + 14 negative controls), and checkpatch.pl --strict (0 errors, 0 warnings) all pass. On the identical kernel sources (485ae602d62b), the ARCH=arm64 LLVM=1 W=1 build of drivers/gpu/drm/apple/{afk,dptxep,iomfb_m4,dcp,dcp-fabric}.o (CONFIG_DRM_APPLE_DCP_T8132=y) and drivers/gpu/drm/apple/tests/display.kunitconfig KUnit (167 passed, 1 skipped) also pass.

On the requested hardware rows: our lab J713 currently runs 27.2 firmware (asahi,os-fw-version 27.2), where dcp_t8132_ext_m4_node() (drivers/gpu/drm/apple/dcp-fabric.c) skips iomfb_m4.c adoption for dcpext, so we cannot run the 26.6.2 runtime idle power-off / hotplug / DPMS / s2idle check locally. A row on a 26.6.2 firmware J713 or another supported laptop with consumer-switched PMGR domains at 6a87b4da7a47 is still needed before merge, alongside a J713 27.2 firmware regression check at 6a87b4da7a47 covering the shared compact DPTX startup paths (which did not run during this pass because J713 halted on its control boot). Both remain honestly listed under **Not yet:**.

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) ci-failing A check failed at the PR head (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Nov 27, 2026
@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Updated the PR body with the standalone J713 (M4 Air, 27.2 firmware) boot check at 6a87b4da7a47 (default cmdline + panic=10): boots cleanly (0 failed units, 0 AppArmor denials) and passes s2idle, while internal 30ae00000.dcp fails with -ENODEV: no IOMMU domain (falling back to simpledrm) because base 8c6992db4b9f predates main's 27.2 internal-DCP work. Merging onto current main hits tx_lock vs afk_tx_lock conflicts in afk.c, dcp.h, and extract-send.py, so 27.2 display regression verification waits for a rebase onto main + #3320.

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>
@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Updated feat/iomfb-m4-ext-idle-off to e79507d7594a:

  • Recreated the forward merge of #3320 (36a97130f2c5, carrying main aa3351bc8e6f) on top of 6a87b4da7a47 at 7aace5080187 with Signed-off-by: Erik Bourget <erik@ebourget.net> so 6a87b4da7a47 remains first parent.
  • Serialized retained-session AFK doorbells with the final early-RX overflow and crash check under dcp->afk_tx_lock (485431e52252) by moving might_sleep() in dcp_send_message_ret() to the sleepable 14.7/native-26 branch, keeping atomic RTKit sends on other firmware and leaving 14.7/native-26 doorbells outside spinlocks under ep->tx_lock.
  • Propagated doorbell transport results from afk_send_epic_token() (53c54d67efee) and tracked whether wptr was published so afk_send_command_common() retains slot and DMA ownership (free_on_ack / crashed on ext26) whenever a doorbell fails after publication unless the command already completed.
  • Extended tools/testing/selftests/drivers/gpu/apple-afkv2/extract-send.py (e79507d7594a) to extract the production send helpers instead of stubbing afk_send_epic(), assert lock state at dcp_send_message_ret(), and test both overflow between admission and send and failed doorbells after ring publication; updated tools/testing/selftests/drivers/gpu/apple-dcp/recovery.py (tx_lock injection and afk_send_epic_published()).

At e79507d7594a, drivers/gpu/drm/apple/{afk,dptxep,iomfb_m4,dcp,dcp-fabric}.o (ARCH=arm64 LLVM=1 W=1, 0 warnings), dcpext26-startup-tests.py (including --mutants), backlight-coldboot-tests.py, apple-afkv2 (2/2), apple-dcp (--group m4 8/8, --group edid 4/4), dart-cio-owner-tests.py (35 + 14), display.kunitconfig (167 passed, 1 skipped), and checkpatch.pl --strict (0 errors) all pass.

J713 (M4 MacBook Air, T8132, firmware 27.2) at e79507d7594a in batched candidate b3dbf237542b on main 9e38a276dcb4: the internal-DCP / DPTX / eDP-1 regression is clean across boot, 3× real DPMS off/on and 3× s2idle (0 iomfb/afk/dptx/dart errors; external dcpext runtime idle-off is inactive on 27.2, as expected).

The 26.6.2-firmware T8132 external-DCP runtime idle power-off / hotplug / DPMS / s2idle row remains open under **Not yet:**.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at e79507d7

Blockers:

  1. Targets open non-default base branch feat/apple-dart-cio-runtime (#3320). Retarget to main once #3320 merges.
  2. 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 domain on the older base) plus green CI (pr-text / readiness were cancelled).

Checked:

  • 485431e5 (afk_tx_lock serialization for retained-session AFK doorbells), 53c54d67 (preserving published DMA on EPIC doorbell error), and e79507d7 (apple-afkv2 selftests across transport branches) look sound; MERGEABLE against feat/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/-200 across 19 files).

@erikwb

erikwb commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Acknowledged the HOLD at e79507d7594a:

  1. Base branch: #3320 (feat/apple-dart-cio-runtime) is still open. Per branch policy, #3321 must be retargeted to main before #3320 merges (to avoid auto-closing when the base branch is deleted), after which the child diff will be verified and full main CI will run at the landing head (the recorded git merge-tree --write-tree e79507d7594a origin/main check against ee36fbdcd1c8 was a historical check that was conflict-free, though live main has since advanced).
  2. CI and hardware status: The cancelled pr-text and readiness runs on e79507d7594a were superseded by passing runs (3/3 in gh pr checks; full main build/KUnit workflows will run at the landing head after retargeting to main). The earlier standalone J713 row at 6a87b4da7a47 hit -ENODEV: no IOMMU domain on 30ae00000.dcp only because its pre-merge base predated main's 27.2 internal-DCP work; the b3dbf237542b candidate run at e79507d7594a includes main 9e38a276dcb4 (with the 11 verified PR paths afk.c, afk.h, dcp-fabric.c, dptx-service.h, dptxep.c, dptxep.h, iomfb_m4.c, iomfb_m4.h, and apple-afkv2/{compact.c,extract-send.py,test-admission.py} byte-identical) and passed J713 (27.2) boot, 3x DPMS off/on, and 3x s2idle cleanly. Because the lab J713 runs 27.2 firmware where dcp_t8132_ext_m4_node() skips iomfb_m4.c adoption for dcpext, the live T8132 26.6.2-firmware external-DCP idle power-off / hotplug / DPMS / s2idle cycle with zero DCP crashes or timeouts (J713 external/dock or J773g, at the landing head after retargeting) remains open under **Not yet:**. For the second Mac family smoke row, the J313 (M1 MacBook Air, T8103) trial kernel carrying #3321 was built and parity-checked against #3321 merged onto main (ee36fbdcd1c8), but could not be booted in this pass after J313 became unreachable on baseline main deep S2R (awaiting physical recovery); it remains tracked under **Not yet:**.
  3. Refreshed offline verification at e79507d7594a and updated PR body (**Revert:** and candidate parity):
    • make ... ARCH=arm64 LLVM=1 W=1 drivers/gpu/drm/apple/{afk,dptxep,iomfb_m4,dcp,dcp-fabric}.o: 0 errors, 0 warnings.
    • KUnit: display.kunitconfig 167 passed / 1 skipped (apple_g17_rx_util_min_test), tests/.kunitconfig (dcp-fabric) 117/117 passed, topology.kunitconfig 208 passed / 1 skipped.
    • Host tests: dcpext26-startup-tests.py --mutants, backlight-coldboot-tests.py, apple-afkv2 (2/2), apple-dcp (--group m4 8/8, --group edid 4/4), dart-cio-owner-tests.py (35 + 14): all PASS.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Dec 1, 2026
@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) labels Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Row: 86da52ca2b54b2c27cde936352b9d07cfa5d0ff8 + J773g (Apple M4 Mac mini, T8132, 27.2 stub) + NO-REGRESSION / dcpext0 NOT BOUND AT THIS BASE.

  • Boot: 7.3.0-j773g-pr3321-86da52ca (boot_id=dc7cfad7-0a47-439a-a37c-06925c8335a4), stock J773g cmdline.
  • dcpext0 backend & idle-off observation: At exact head 86da52ca2b54 (branch base 4f205524, 46 commits behind main), display-gate.c:3945 checks apple_dart_keeps_locked_roots() which in include/linux/soc/apple/dart.h at this commit only matches t6041/t6050/t8140/t8142 (not apple,t8132-dart). As a result, display-gate disables the HDMI/display chain before apple-dcp probes:
    • apple-t8132-display: /soc/dcp@286e00000: the firmware roots of /soc/iommu@286340000 and /soc/iommu@286300000 are not kept, HDMI left off
    • apple-t8132-display: no HDMI chain and no internal display: /soc/display-subsystem disabled, boot framebuffer kept
  • Because dcpext0 never bound at 86da52ca2b54, neither iomfb_v27 nor iomfb_m4 ran, and idle-off did not occur (not reached). To exercise dcpext0 (iomfb_v27), hotplug, and DPMS on J773g 27.2, this branch needs to merge current main (which enables T8132 external display DART fw_mirror).
  • No-regression checks passed: appledrm + dcp_fabric_core + aurora loaded cleanly (aurora-g16 started on boot framebuffer simpledrm 640x1136), plasmalogin active, rtcwake -d /dev/rtc1 -m freeze -s 5 (s2idle) suspended and woke cleanly (RC=0), 0 dcp/drm/iomfb/afk errors, 0 failed units, 0 Oops/WARN.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) and removed ready-to-merge Meets the merge policy: merge it (bot) labels Dec 2, 2026
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>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Forward-merged main deedd808cefd into this branch with a normal merge commit. The new head is 50fcde6abc87. Its tree, aece6983521a, is the same resolution posted above at 13:32 (ci/head-3321-86da52ca-deedd808-resolution). Main has since moved to 0bc45c54fbe6, but only device-tree files changed, so there is no new conflict.

Resolutions:

  • drivers/gpu/drm/apple/afk.c (afk_send_epic_token): kept this PR's afk_tx_lock section (crash and RX-overflow check, afk_tx_closed, tx_paused) and put main's three-state firmware 27 sleep gate inside it. Main's J516s panel OPEN/command exception now only gets past the sleep gate, never past this PR's fences. Replies pass as before.
  • tools/asahi/dcpext26-startup-tests.py: took main's apple_dcp stub (adds hw.afk_name_fallback) and kept this PR's dptx_port fields (closed, rebind_allowed).
  • tools/testing/selftests/drivers/gpu/apple-afkv2/extract-send.py: not a text conflict, but the merge needs it. The stub's sleep_v27_closed was a bool and it had no j516s_panel_service, so the merged sender did not compile. It now uses main's enum and field, and a new case checks that the panel exception still leaves tx_paused, afk_tx_closed and the RX-overflow latch in force.

Local results (pc; the host-tests.yml image with clang 18, gcc 13, rust 1.96.0 and Python 3.14):

  • W=1 build of drivers/gpu/drm/apple/ with the CI config (arm64 defconfig plus asahi.config, LLVM=1): 44 objects, no warnings, no errors. The t8132-j773g, t6030-j516s and t6050-j714s DTBs build and pass CHECK_DTBS. The merge changes no DT files against main.
  • tools/asahi/run-host-tests.py: 950 of 952 pass. apple-afkv2 passes under gcc and clang, including the new case; without the stub change it fails to compile. dcpext26-startup-tests, afk-compact-start-tests and dcp-tunnel-prepare-tests (with all their mutations) pass.
  • The two failures are main's: apple-dcp (the same 6 of 101 cases) and display-sleep-merge-tests fail the same way on plain main deedd808cefd. Their fixtures lack main's new v27_early_svc_ep, ext272, afk_name_fallback, dcp_s2r_t6030 and dcp_ext272_admitted.
  • The hosted Apple build and DCP KUnit run on the same tree (dcp-fabric, dcp-topology, dcp-display) passed: https://github.com/aurora-silicon/linux/actions/runs/46892522007

Hardware row: the 09:45 no-regression row still applies. No resolved line changes what runs on T8132. The panel exception needs j516s_panel_service, which only the T6030 internal DCP sets. With it false, the gate makes the same check as before, because DCP_V27_TX_LIVE is 0. The other two files are host tests only. As before, dcpext0 does not bind on the M4 mini at this base (apple_dart_keeps_locked_roots() still leaves out t8132), so the idle-off path is not reached on hardware. Exercising it needs #3874 first.

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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): preserves afk_tx_lock serialization, afk_tx_failed_under_tx_lock(ep), afk_tx_closed, and tx_paused fencing while layering the 3-state sleep_v27_closed gate and panel_resume exception (DCP_V27_TX_PANEL_OPEN && ep->j516s_panel_service && ...) so panel_resume bypasses only the v27 sleep gate and never afk_tx_closed, tx_paused, or afk_rx_failed.
  • tools/asahi/dcpext26-startup-tests.py: retains both main's expanded struct apple_dcp (hw.afk_name_fallback) and the dptx_port (closed, rebind_allowed) rebind fields.
  • tools/testing/selftests/drivers/gpu/apple-afkv2/extract-send.py: updates the stub to sleep_v27_closed / j516s_panel_service and adds regression coverage confirming DCP_V27_TX_PANEL_OPEN + j516s_panel_service permits AFKV2_OPEN while tx_paused, afk_tx_closed, and afk_rx_failed still reject (-EBUSY / -EBUSY / -ENOSPC) without advancing tx_wptr.
  • Local build and test receipt at 50fcde6abc87 is clean (W=1 drivers/gpu/drm/apple/ 44 objects 0 warnings/0 errors, CHECK_DTBS clean on t8132-j773g/t6030-j516s/t6050-j714s, run-host-tests.py 950/952 with apple-afkv2, dcpext26-startup-tests, afk-compact-start-tests, and dcp-tunnel-prepare-tests passing and only the two pre-#3939 main fixture failures), and pr-text is green.

@DjDeveloperr

DjDeveloperr commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Thanks satchlj, the review gate is met at 50fcde6abc87.

Merge still needs two hardware rows at this head. The earlier J773g row at 86da52ca booted with dcpext0 disabled by display-gate at its old base, so the shared afk.c send and lock changes never ran on hardware.

  • J773g (T8132, 27.2): we boot a merge of this head into main 5b22d796, with dcpext0 HDMI and DP-3 bound. The row covers hotplug, DPMS, s2idle and AFK/DCP errors, and records whether idle-off fires. We expect it not to fire with iomfb_v27.
  • Second generation for the shared AFK code: J700 (T8140), same merge tree, internal panel. The row covers DPMS, s2idle and AFK/DCP errors.

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 50fcde6abc87.

@github-actions github-actions Bot removed the merge-conflict Conflicts with the base branch (bot) label Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

J700 second-generation row: PASS at head 50fcde6abc87

Setup

  • Board: J700 MacBook Neo (T8140, A18 Pro). This is the second generation after J773g.
  • Merge tree: git merge --no-ff 50fcde6abc87 into main 5b22d796. Merge commit 8ab6b69819e3, HEAD^{tree} 02d36e13ceab4137c352e3c01e4a51153a59b8ca.
  • Kernel: stock aurora_defconfig with no fragments, built as 7.3.0-pr3321-50fcde6a. Kernel build ID 3e502ba5…, aurora.ko 3496c220…, appledrm.ko 4f7c281c….
  • Boot: one boot (0db17614) through an aura-try one-shot trial Stage 2, 1.0.0b18-g16648d69 (/chosen/aurora,trial set), so aura's hardware trial watchdog was armed before the kernel started. The trial entry had the stock options plus exactly panic=10. The trial kernel took the watchdog over and kept feeding it: WD1 timeleft read 22, 21, 29 and 19 s across the row, which ran past 190 s of uptime on the same boot.

Checks (all PASS)

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.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Local qualification at 50fcde6abc87 merged into main a76093e384de (tree add68bd5921d).

  • ./linux-build/build kernel linux-pc-edge-pr3321-a76093e3 -- -j5 W=1 olddefconfig drivers/gpu/drm/apple/ drivers/gpu/drm/apple/appledrm.o passed on Mini with LLVM Arm64. llvm-readelf confirmed the AArch64 object and .kunit_test_suites. llvm-nm confirmed the AFK parser, AV lifetime, DCP topology and external resume suites in the link. KUnit coverage here is compile and link only. The build emitted the existing audio fixture DTC warning and the host bindgen alignment notice.
  • python3 -m py_compile passed for all 25 Apple DCP selftest scripts, including transaction.py.
  • The AFK, DPTX, fabric and M4 idle-off source files are byte-identical to the J700 hardware tree. The only difference in dcp.c is main's drm/apple: dcp: stop the T6040 internal DCP in s2idle too #3884 change to dcp_t6041_internal_capable(), which removes the T6040 exclusion for the host-stop path. The device-tree property that admits that path is present only on T6040/T6041, so the J700 and J773g paths are unchanged. Current main 8f2074047808 also merges cleanly. Its only additional change is in the Centauri Wi-Fi driver.

The J700 PASS covers the shared AFK path. The train still lists the exact-head J773g HDMI/DP-3 result as open.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Hardware re-run row (active dcpext0 + dcpext1 AFK path) — J773g (Mac16,10, Apple M4 Mac mini, T8132, OS FW 27.2 / mBoot-20457.41.3) at exact PR head 50fcde6abc87 merged --no-ff into main 5b22d796fa75 (merge-tree SHA 02d36e13ceab4137c352e3c01e4a51153a59b8ca, kernel 7.3.0-j773g-pr3321-50fcde6a, boot_id=7616b05b-e9db-4d66-a998-646f49cf9843): PASS

  • Boot & trial safety: booted cleanly via aura Stage 1 (1.0.0b13-g5dcf62d0, WDT: boot watchdog armed (178 s), 0 "WDT: could not arm the trial watchdog" lines, panic=10, per-kernel initramfs).
  • Both external DCPs bound & AFK active:
    • 286e00000.dcp (dcpext0, DCP index:1, dptx target phy: 4, HDMI card1-HDMI-A-1) bound to apple-drm with AFK endpoints ep:20/23/24/2a active.
    • 48ae00000.dcp (dcpext1, DCP index:2, dptx target phy: 0, card1-DP-3 connected/enabled/On at 3840x2160@60) bound to apple-drm with AFK endpoints ep:20/23/24/2a active.
  • 2x real DRM DPMS off/on on DP-3 (via libdrm.so.2 drmSetMaster + drmModeConnectorSetProperty on connector 82, dpms_prop=2):
    • Cycle 1: Off (6.09 s, rc=0) -> On (rc=0, connected, 3840x2160).
    • Cycle 2: Off (6.15 s, rc=0) -> On (rc=0, connected, 3840x2160).
  • 1x DP-3 unplug/replug (force off -> detect): disconnected -> connected (3840x2160).
  • 1x s2idle cycle (rtcwake -d /dev/rtc1 -m freeze -s 5): suspend_stats/success 0 -> 1; post-wake card1-DP-3 connected/On at 3840x2160, plasmalogin=active, failed_units=0.
  • Idle-off observation: 0 idle-off hits (IDLE_OFF_HITS=0; expected inactive on 27.2 iomfb_v27 / no apple,display-power in DT — both DCPs log no apple,display-power in the device tree, the firmware keeps running).
  • Errors: 0 AFK send/ack timeouts, 0 tx_paused refusals, 0 DART faults/errors, 0 driver DCP errors, 0 WARNING: / BUG: / Oops / SError / Call trace:.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Local CI at exact head 50fcde6abc87. A full Arm64 LLVM Apple build and 961/961 host tests passed on main 3b6b90e7ab2d (tree 4fde69637640).

Refreshed on current main 515377db2a76 (tree 1b7504417f9a) after the main-side HDMI suspend, external PQ and DART changes landed. The PR’s DCP patch ID is unchanged.

  • ./linux-build/build kernel --profile asahi <tree> -- -j10 W=1 drivers/gpu/drm/apple/ drivers/gpu/drm/apple/appledrm.o drivers/iommu/apple-dart.o passed.
  • scripts/ci/apple-kunit.py plan selected DCP fabric, topology and display. kunit.py build --arch=arm64 --make_options LLVM=1 --jobs=10 with the three fragments linked the suites into Arm64 vmlinux. kunit.py run --arch=um --kunitconfig=drivers/gpu/drm/apple/tests/.kunitconfig passed 117/117 on the refreshed tree.
  • python3 -I tools/asahi/run-host-tests.py, filtered separately for HDMI sleep unplug, AFK, external-DCP startup, DCP tunnel prepare, DART DAPF and display sleep merge, passed 52/52 on the refreshed tree.

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.

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

Labels

area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants