Skip to content

drm/apple: wire firmware-27 T6050 external DCPs into runtime idle off - #3398

Open
erikwb wants to merge 8 commits into
feat/dcp-v27-ext-idle-offfrom
feat/dcp-v27-ext-idle-off-t6050
Open

erikwb wants to merge 8 commits into
feat/dcp-v27-ext-idle-offfrom
feat/dcp-v27-ext-idle-off-t6050

Conversation

@erikwb

@erikwb erikwb commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What: Stacked on feat/dcp-v27-ext-idle-off (#3410). Serialize T6050 display PMC power helpers, wire unattached firmware-27 T6050 external DCPs (dcpext0..3) into runtime idle power-off and attach/DP-audio/suspend wake, propagate strict v27 wake transport errors (A500, A489, A115), and allow system suspend when a failed idle wake already powered off external DCP domains/DARTs.

Tested: Offline checks pass at current head 224cf52e3c33 (forward-merge 864f2b188ac0 of #3410 f39fdeec3e43 into 87662fb2f093, followed by fix commit 224cf52e3c33):

  • ARCH=arm64 LLVM=1 W=1 KCFLAGS="-Werror" (drivers/soc/apple/sleep.o, drivers/gpu/drm/apple/{dcp.o,dptxep.o,dcp-fabric.o,iomfb.o,afk.o,audio.o,av.o}): 0 errors, 0 warnings.
  • git diff --check f39fdeec3e43..HEAD clean; checkpatch.pl --strict --git f39fdeec3e43..HEAD: 0 errors, 0 warnings, 0 checks across all 4 commits (7531b5b33018, 7bf81725acc2, 1f59a74fb75d, 224cf52e3c33).
  • arm64 QEMU KUnit: drivers/gpu/drm/apple/tests/display.kunitconfig with CONFIG_SOUND=y + CONFIG_SND=y (279 run: 276 passed, 3 skipped including dcp_ext_idle_failed_suspend passing and dcp_v27_ext_wake_transport_errors skipped with CONFIG_APPLE_SOC_SLEEP off), display.kunitconfig with CONFIG_SOUND=y + CONFIG_SND=y + CONFIG_IOMMU_SUPPORT=y + CONFIG_APPLE_DART=y + CONFIG_APPLE_SOC_SLEEP=y (280 run: 278 passed, 2 skipped apple_g17_rx_util_min_test and dcpaud_no_sio_test; apple-dcp-firmware 9/9 passed including dcp_ext_idle_s2r_disp_dart_gate, dcp_ext_idle_audio_dma_pin, dcp_v27_ext_wake_transport_errors, dcp_ext_idle_failed_suspend; apple-dcpaud-legacy 10/10: dcpaud_legacy_unplugged_void_buffer, dcpaud_legacy_unplugged_hotplug_managed_buffer), drivers/gpu/drm/apple/tests/.kunitconfig (117/117 passed), and drivers/soc/apple/t6050-aop.kunitconfig (12 run: 11 passed, 1 skipped).
  • Host & selftests: dcpaud (20/20 passed, 10/10 open-fallback mutants killed), dart (24/24 passed), dcpext26-startup-tests.py --mutants, backlight-coldboot-tests.py, display-sleep-merge-tests.py (17/17), and selftests/drivers/gpu/apple-dcp/run.py --group audio (2/2 passed).

J716c (T6050) one-shot trial boot at 79a2063f331c (pre-fix baseline before 224cf52e3c33 and f39fdeec3e43 / 41ab8f546874; this branch alone, default command line, default Stage 2 b0a2f222b5a9, chained dead-man trial Stage 2): booted, 1 failed system unit (aurora-peripherals.service, as on the default boot), 0 LSM denials, 0 GPU fault / MMU fault / DeviceLost / Oops / WARN / SError lines, kernel err+ 44 lines (the systemd-gpt-auto-generator pair, avd missing-firmware probe, M5 bare-metal bootstrap failed at session: EPROBE_DEFER and 40 apple-dcp ... AFK ... unable to match service lines, none new from this PR). All four unattached external DCPs (2b2e00000, 302e00000, 306e00000, 392e00000) reached fControllerPowerState 0 at about 6.2 s after boot (idle-off engaged) and were back at 0 after 2x pm_test=devices suspend/resume (each PM: suspend entry / PM: suspend exit, 0 new err+ lines). dcp-dp-audio had no bound device with nothing attached, so no DP-audio PCM existed to open (aplay -l listed only the speaker card). On that branch-only kernel the desktop did not start (Hyprland aborts: EGL / Vulkan find no valid GPU with the daily Mesa; the GPU driver registers its DRM node), so eDP-1 compositor DPMS off/on was not run; modetest DPMS writes on eDP-1 (2x) logged a DCP power off/on and left the connector connected / enabled. No external display was attached.

Earlier J716c hardware rows (87662fb2f093 with #3662 TS5 dock 2x 4K + 30 s deep sleep clean; b963090c1f2d batched 3545ebecb76f idle-off + pm_test + 3x DPMS; 1f59a74fb75d in c3da8eed6f72) also predate 224cf52e3c33.

Risk: two-way door · T6050 Macs with firmware-27 external DCPs (J716c, J714s/c, K114/K116).

Revert: git revert -m 1 <merge_commit> after merge (or revert 224cf52e3c33, 1f59a74fb75d, 7bf81725acc2, and 7531b5b33018 in reverse order). Kernel driver changes only; no persistent on-disk, ESP, Stage 2, or DT state is modified.

Not yet:

  • Refreshed J716c (T6050) trial boot + runtime row at final head 224cf52e3c33: idle-off after boot, physical hotplug-from-idle (wake under the fabric lock), dual-pipe peer wake from hints, DP audio playback/unplug, s2idle after idle-off, and compositor DPMS off/on.
  • Second-family unaffected boot/display/DPMS smoke row (J313 T8103 or J713 T8132).
  • A genpd/runtime-PM view of the dcpext power domains (none is exposed on J716c) and J714s/c or K114/K116 runs (external hardware not on site).
  • Retargeting #3398 to main before #3410 merges (per branch policy, deleting a merged base branch closes PRs still stacked on it) and running hosted CI on 224cf52e3c33.
Details

Four PR commits (7531b5b33018, 7bf81725acc2, 1f59a74fb75d, 224cf52e3c33) plus forward merge 864f2b188ac0 stacked on #3410 (f39fdeec3e43, carrying origin/main 41ab8f546874 including #2673 J713 27.2 external display):

  1. 7531b5b33018 (soc: apple: sleep): serialize apple_sleep_m5_display_pmc() with t6050_disp_pmc_lock, validate the disp-4 resource before MMIO, and export apple_sleep_m5_dispext_power_ready().
  2. 7bf81725acc2 (drm/apple):
    • Wire T6050 firmware-27 external DCPs into dcp_ext_idle_*, with peer-reservation checks (peer_waking, DCP_EXT_IDLE_ON, sleep_v27_closed) and checked rollback on transient pre-idle refusals.
    • Close compact AFK command admission for new non-reply messages (category != 2 && offset == 0) on sleep_v27_closed under ep->lock while still allowing firmware-initiated replies and continuation fragments to finish.
    • Drain RX and settle while RTKit TX is live before strict idle; track dcp->tx_errors across dcp_send_message() and verify post-idle RX drain cleanly before clearing RUN and gating DART/PMC power domains.
    • Gate dcp_v27_sleep_resume() on dcp_v27_sleep_active() (phase != V27_LIVE) so a failed runtime idle-off never misroutes a later s2idle resume.
  3. 1f59a74fb75d (drm/apple): pin peer->dev with get_device()/put_device() and track peer->peer_idle_users under dcp_peer_lock across unlocked dcp_ext_idle_wake() / dcp_ext_idle_kick() windows, and drain callers via dcp_peer_idle_drain() in dcp_ext_idle_close() and dcp_comp_unbind().
  4. 864f2b188ac0 (forward merge of #3410 f39fdeec3e43): preserves both #3398's dcp_v27_ext_idle_* block and origin/main's dcp_v27_dpms_* block in dcp-v27-sleep.inc (both #ifdef and #else), inherits #3410's unplugged dcp-dp-audio ADMA deferral and void-buffer fallback (SNDRV_DMA_TYPE_VMALLOC + ext_idle_audio_users DCP pinning so probing/holding /dev/snd/pcm* never wakes or drops DISPEXT*_SYS while ADMAC is active, resolving J714s DP audio coordination), and checks ext_idle_initialized in dcp_ext_idle_wake_internal() and dcp_audio_dma_put() so pins stay balanced on non-idle-capable DCPs. Plugged DP-audio opens on a DCP whose idle state latched DCP_EXT_IDLE_FAILED return ext_idle_err (or -EIO if unset).
  5. 224cf52e3c33 (drm/apple / soc: apple: sleep):
    • In dcp_v27_ext_wake_calls() (drivers/gpu/drm/apple/dcp-v27-sleep.inc), bail out early when !allow_cycle && a500 fails, skip the trailing A500 round if a489 or a115 failed in strict mode, and propagate a489 and a115 errors inside if (!allow_cycle).
    • When ext_idle_state == DCP_EXT_IDLE_FAILED && ext_idle_domains_off (dcp_ext_idle_failed_dark()), allow system suspend and resume cleanly while leaving the failed external DCP dark with ext_idle_domains_off == true:
      • In dcp_ext_idle_suspend(), dcp_s2r_ext_suspend(), dcp_s2r_resume(), dcp_s2r_restart(), and dcp_s2r_pm_notify() (drivers/gpu/drm/apple/dcp.c), skip PM_SUSPEND_PREPARE refusal, stream/DART teardown, and resume domain power-on (dcp_s2r_ext_start() / dcp_s2r_restart_done()), keeping crashed and ext_idle_domains_off intact across suspend/resume.
      • In dcp_v27_sleep_prepare(), dcp_v27_late_arm(), dcp_v27_late_check(), dcp_v27_late_stop(), dcp_v27_late_disarm(), dcp_v27_sleep_restart(), and dcp_v27_sleep_resume() (drivers/gpu/drm/apple/dcp-v27-sleep.inc), mark the dark DCP V27_PREPARED + quiesced without running firmware stop calls or dcp_v27_refuse(), step cleanly through the sleep controller late hooks without touching powered-off registers/DARTs, and return to V27_LIVE on resume without restarting firmware or replugging ports.
      • In t6050_sleep_display_prepare() and sleep_region_replay() (drivers/soc/apple/sleep-t6050.h), accept already-off external display power words (d > 0 with PS_TARGET == 0 && PS_ACTUAL == 0) instead of returning -EAGAIN or counting late_errors.
    • Add KUNIT_STATIC_STUB_REDIRECT hooks in iomfb.c / dcp-v27-sleep.inc and add dcp_v27_ext_wake_transport_errors (all-success + error paths) and dcp_ext_idle_failed_suspend (covering dcp_ext_idle_suspend(), s2r_ext, and v27 deep-sleep suspend/resume paths) in drivers/gpu/drm/apple/dcp-firmware-test.c.
Evidence
  • Current head 224cf52e3c33 (864f2b188ac0 merge of #3410 f39fdeec3e43 + 224cf52e3c33 fix):
    • make O=_build ARCH=arm64 LLVM=1 W=1 KCFLAGS="-Werror" drivers/soc/apple/sleep.o drivers/gpu/drm/apple/dcp.o drivers/gpu/drm/apple/dptxep.o drivers/gpu/drm/apple/dcp-fabric.o drivers/gpu/drm/apple/iomfb.o drivers/gpu/drm/apple/afk.o drivers/gpu/drm/apple/audio.o drivers/gpu/drm/apple/av.o (aurora_defconfig, CONFIG_RUST=n, CONFIG_APPLE_SOC_SLEEP=y, CONFIG_DRM_APPLE=y): 0 errors, 0 warnings.
    • ./scripts/checkpatch.pl --strict --git f39fdeec3e43..HEAD: 0 errors, 0 warnings, 0 checks across all 4 commits (7531b5b33018, 7bf81725acc2, 1f59a74fb75d, 224cf52e3c33); git diff --check f39fdeec3e43..HEAD clean.
    • arm64 QEMU KUnit:
      • drivers/gpu/drm/apple/tests/display.kunitconfig with CONFIG_SOUND=y + CONFIG_SND=y: 279 run: 276 passed, 3 skipped (apple_g17_rx_util_min_test, dcpaud_no_sio_test, and dcp_v27_ext_wake_transport_errors skipped with CONFIG_APPLE_SOC_SLEEP off; dcp_ext_idle_failed_suspend passed).
      • drivers/gpu/drm/apple/tests/display.kunitconfig with CONFIG_SOUND=y + CONFIG_SND=y + CONFIG_IOMMU_SUPPORT=y + CONFIG_APPLE_DART=y + CONFIG_APPLE_SOC_SLEEP=y: 280 run: 278 passed, 2 skipped (apple_g17_rx_util_min_test, dcpaud_no_sio_test), including apple-dcp-firmware 9/9 (dcp_ext_idle_s2r_disp_dart_gate, dcp_ext_idle_audio_dma_pin, dcp_v27_ext_wake_transport_errors, dcp_ext_idle_failed_suspend) and apple-dcpaud-legacy 10/10 (dcpaud_legacy_unplugged_void_buffer, dcpaud_legacy_unplugged_hotplug_managed_buffer).
      • drivers/gpu/drm/apple/tests/.kunitconfig: 117/117 passed (apple-dcp-fabric).
      • drivers/soc/apple/t6050-aop.kunitconfig: 12 run: 11 passed, 1 skipped (apple_t6050_aop 8/8, apple_mbox_g17_stall 3 passed / 1 skipped).
    • Host & selftests:
      • python3 -I tools/asahi/run-host-tests.py --only dcpaud: 20/20 passed (dcpaud-open-fallback-tests + 10/10 mutants killed: no-retry, wait-any, gone-fails, keep-cookie, mask-all, drop-put-dma, void-lib-free, void-alloc-lib-free, managed-in-init-dma, void-free-runtime-dmab).
      • python3 -I tools/asahi/run-host-tests.py --only dart: 24/24 passed.
      • python3 -I tools/asahi/dcpext26-startup-tests.py --mutants: PASS.
      • python3 -I tools/asahi/backlight-coldboot-tests.py: PASS.
      • python3 -I tools/asahi/display-sleep-merge-tests.py: PASS (17/17).
      • python3 tools/testing/selftests/drivers/gpu/apple-dcp/run.py --group audio: 2/2 passed (compact-audio-reply-bounds, cec-only-av-endpoint).
  • Prior J716c runs (predate 224cf52e3c33, 864f2b188ac0, and f39fdeec3e43):
    • 79a2063f331c (trial boot, T6050, default Stage 2 b0a2f222b5a9): all 4 unattached external DCPs (2b2e00000, 302e00000, 306e00000, 392e00000) reached fControllerPowerState 0 at ~6.2 s and returned to 0 after 2x pm_test=devices, 0 GPU/MMU faults, 0 Oops/WARN, 2x modetest eDP-1 DPMS writes clean.
    • 87662fb2f093 (on #3410 c4797d399ba0, main 94104a69193b, with #3662): docked on TS5 with two 3840x2160 displays, 30 s deep sleep resumed with both back, 0 oopses.
    • b963090c1f2d in batched trial kernel 3545ebecb76f (origin/main b897ccb4e71c + 18 open PR heads): all 4 external DCPs (2b2e00000, 302e00000, 306e00000, 392e00000) reached fControllerPowerState 0 at 5.907–5.910 s after boot and returned to 0 after 4x pm_test=devices, 2x pm_test=platform, and 3x DPMS off/on cycles, 0 DCP panics.
    • 1f59a74fb75d in batched candidate c3da8eed6f72 (over main 9af21b007425): boot idle-off and 2x pm_test=devices suspend/resume clean.

…diness

Runtime idle power-off for T6050 external display processors and async
system resume for the internal display both read-modify-write the same
T6050 display PMC boost and bandwidth registers (0x286808020 and
0x286808028).

Unify the PMC mapping (0x286806000..0x286808030) under a single mutex
in drivers/soc/apple/sleep.c, export apple_sleep_m5_display_pmc() for
the internal display handshake alongside apple_sleep_m5_dispext_power(),
and export apple_sleep_m5_dispext_power_ready() so callers can probe
hardware capability without touching registers.

Signed-off-by: Erik Bourget <[email protected]>
Extend the external DCP runtime idle power-off path to firmware-27
external display processors whose hardware exposes the DISPEXTN power
domains, DT sleep arguments, display DART save/restore, and PMC boost
helper.

When an unattached external pipe settles:
- Publish DCP_EXT_IDLE_STOPPING under dcp_peer_lock alongside the peer
  ownership check, mark waking peers with peer_waking, and gate paired
  modeset on !peer_waking && DCP_EXT_IDLE_ON && !sleep_v27_closed.
- Record the V27 backend on the pipe and reset non-failed pipes on
  component rebind while leaving non-idle pipes untouched on close.
- Close IOMFB admission and settle callbacks before A484; defer cleanly
  on live drain timeouts, opt out on unsupported endpoint inventories,
  and run checked rollback on pre-idle refusals (including AFK -EAGAIN).
- Quiesce RTKit, verify ASC IDLE|STOPPED, detach and drain mailbox RX
  via apple_rtkit_mailbox_off() while powered, stop the ASC and
  dart-dcp, snapshot the display DART unconditionally, and lower
  DISPEXTN power domains while tracking exact power state (ON, OFF,
  UNCERTAIN) and routing the internal PMC handshake through the shared
  apple_sleep_m5_display_pmc() mutex.
- On wake (Type-C attach, peer reservation, or system suspend), restore
  domains, display DART, and dart-dcp, restart firmware (re-acquiring
  both dark fences before any retry power cycle and skipping MMIO
  cleanup unless power is confirmed ON), reopen sessions, and validate
  V27 external wake calls without entering system-resume's RTKit cycle.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb
erikwb requested review from a team as code owners November 27, 2026 14:40
@erikwb
erikwb requested review from LiamRay11 and maralcbr November 27, 2026 14:40

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

The peer wake now uses a borrowed apple_dcp pointer after dropping dcp_peer_lock. peer_waking gates modeset, but the peer is devm-owned and I could not find a lifetime pin or teardown drain for this cross-device wake. dcp_ext_idle_close() drains its own delayed work, while the synchronous wake is running on the requesting DCP. Please show which existing teardown synchronization keeps the peer and its resources live through this call and the subsequent recheck, or add explicit lifetime synchronization. Also identify the landing parent now that #3308 is closed and post the exact-head docked hotplug/wake and full suspend/resume row. The unplugged pm_test=devices result covers a narrower path.

@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m5 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 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Merge readiness at 224cf52e: not ready yet

Check Detail
CI at head ok 2 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes no requested by DjDeveloperr
Hardware row at head ok in the PR body at 224cf52e
Conflicts no merge conflicts with feat/dcp-v27-ext-idle-off: merge it in (no force push)
PR text ok Risk: two-way · T6050 Macs with firmware-27 external DCPs (J716c, J714s/c, K114/K116). Revert: git revert -m 1 <merge_commit> after merge (or revert 224cf52e3c33, 1f59a74fb75d, 7bf81725acc2, and 7531b5b33018 in reverse order). Kernel driver changes only; no persistent on-disk, ESP, Stage 2, or DT state is modified.

Areas: area:display, area:platform

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

dcp_peer_hints_v27() drops dcp_peer_lock before calling dcp_ext_idle_wake()
on a peer DCP (and before calling dcp_ext_idle_kick() on a released peer).
Take a device reference and track active cross-device idle users under
dcp_peer_lock across those unlocked windows, and drain active callers in
dcp_ext_idle_close() and dcp_comp_unbind() after dcp_peer_forget() so
the peer and its resources stay live through the call and recheck.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 1f59a74fb75d (drivers/gpu/drm/apple/dcp-internal.h, dcp-peer-v26_6.inc, dcp-peer-v27.inc, dcp.c).

  • Cross-device peer lifetime (dcp_peer_hints_v27()): dcp_peer_idle_get_locked() now takes get_device(peer->dev) and increments peer->peer_idle_users under dcp_peer_lock before dropping the lock for either dcp_ext_idle_wake(peer) or dcp_ext_idle_kick(released), returning the referenced struct device * so callers save it while the peer is protected. On the wake path, peer->peer_waking is also counted under dcp_peer_lock; after re-acquiring dcp_peer_lock, it decrements peer->peer_waking and calls dcp_peer_idle_put_locked(peer) (decrementing peer_idle_users and waking dcp_peer_idle_wq) before rechecking peer/ownership state, keeping dcp_peer_lock held through populating r->primary_id/r->peer_id on success with put_device(peer_dev) called before unlocking on the success path (and after unlocking on the error path and on the dcp_ext_idle_kick() release path).
  • Teardown synchronization (dcp_ext_idle_close(), dcp_comp_unbind()): both paths now call dcp_peer_idle_drain(dcp) (wait_event(dcp_peer_idle_wq, !dcp_peer_idle_busy(dcp))). dcp_ext_idle_close() drains after publishing DCP_EXT_IDLE_CLOSED and cancelling ext_idle_wq, and dcp_comp_unbind() drains right after dcp_peer_forget() sets peer_unbinding and clears peer_reserved/peer_owner so no new caller can enter and any in-flight cross-device wake or recheck completes before unbind/devres teardown proceeds.
  • Landing parent: feat/dcp-v27-ext-idle-off (#3410, head 944b0ba788d2, targeting main), which replaced closed #3308.

Verified at 1f59a74fb75d:

  • ./scripts/checkpatch.pl --strict --git 944b0ba788d2..HEAD: 0 errors, 0 warnings, 0 checks across all 3 commits.
  • make ARCH=arm64 LLVM=1 W=1 KCFLAGS="-Werror" drivers/soc/apple/sleep.o drivers/gpu/drm/apple/dcp.o drivers/gpu/drm/apple/dptxep.o drivers/gpu/drm/apple/dcp-fabric.o drivers/gpu/drm/apple/iomfb.o drivers/gpu/drm/apple/afk.o (C build with CONFIG_RUST disabled): clean.
  • ./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/apple/tests/.kunitconfig: 117/117 passed (apple-dcp-fabric).
  • ./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/apple/tests/display.kunitconfig: 168 run, 167 passed, 1 skipped (apple_g17_rx_util_min_test requires CONFIG_UCLAMP_TASK).

J716c live hardware at 1f59a74fb75d (batched candidate c3da8eed6f72, default command line): all four dcpext instances reached fControllerPowerState 0 at 6.167-6.185 s after boot, and after each of 2x pm_test=devices suspend/resume cycles re-ran RTKit init and returned to state 0 ~5 s later. The evidence is the firmware power-state log (runtime-PM sysfs reports unsupported and pm_genpd_summary has no display domains). Real s2idle/deep suspend and external DP cable attach/detach were not run and remain open.

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Nov 27, 2026

@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 1f59a74f

Blockers:

  1. Targets open non-default base branch feat/dcp-v27-ext-idle-off (#3410). Retarget to main once #3410 merges and re-run cancelled pr-text and readiness checks (plus live T6050 external-DCP idle-off/wake row if not yet recorded at the final head).

Checked:

  • 1f59a74fb75d cleanly resolves the prior cross-device apple_dcp peer-lifetime blocker by taking get_device(peer->dev) and incrementing peer->peer_idle_users under dcp_peer_lock in dcp_peer_idle_get_locked() before dropping the lock for cross-device idle wake/kick.
  • KUnit apple-dcp-fabric (117/117) and display.kunitconfig (167/168, 1 skip) pass; 8/8 build/KUnit CI checks green; no Apple material, tool attribution, or private serials.
Evidence
  • Head: 1f59a74fb75d (base: feat/dcp-v27-ext-idle-off, mergeable: MERGEABLE, +871/-95 across 9 files).

@erikwb

erikwb commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Merged updated feat/dcp-v27-ext-idle-off (38c26d8a6b57, carrying origin/main 18058ea228e2 and #3410's s2r_disp_dart_with_dcp safety guard) into feat/dcp-v27-ext-idle-off-t6050 at ba54710a1438 (clean merge).

On the lifetime question: the peer pin and teardown drain survive the forward merge intact. dcp_peer_idle_get_locked() pins peer->dev with get_device() and increments peer_idle_users under dcp_peer_lock across both unlocked dcp_ext_idle_kick() (drivers/gpu/drm/apple/dcp-peer-v27.inc:209) and dcp_ext_idle_wake() (drivers/gpu/drm/apple/dcp-peer-v27.inc:275), and component unbind at drivers/gpu/drm/apple/dcp.c:7738 calls dcp_peer_forget(dcp) before dcp_peer_idle_drain(dcp) at drivers/gpu/drm/apple/dcp.c:7739 to drain outstanding callers (alongside dcp_ext_idle_close()).

Verified at ba54710a1438:

  • make ARCH=arm64 LLVM=1 W=1 KCFLAGS="-Werror" (defconfig + asahi.config, CONFIG_RUST=n) for drivers/soc/apple/sleep.o and drivers/gpu/drm/apple/{dcp,dptxep,dcp-fabric,iomfb,afk}.o: 0 errors, 0 warnings.
  • ./scripts/checkpatch.pl --strict --git 38c26d8a6b57..HEAD: 0 errors, 0 warnings, 0 checks across 7531b5b33018, 7bf81725acc2, and 1f59a74fb75d; git diff --check 38c26d8a6b57..HEAD clean.
  • arm64 QEMU KUnit: drivers/gpu/drm/apple/tests/.kunitconfig (apple-dcp-fabric) 117/117 passed, drivers/gpu/drm/apple/tests/display.kunitconfig 168 passed (1 skipped: apple_g17_rx_util_min_test requires CONFIG_UCLAMP_TASK, including apple-dcp-firmware 6/6 with dcp_ext_idle_s2r_disp_dart_gate), and drivers/soc/apple/t6050-aop.kunitconfig 11 passed (1 skipped).
  • Host tests: tools/asahi/dcpext26-startup-tests.py PASS (including --mutants) and tools/asahi/backlight-coldboot-tests.py PASS.

Hardware status & open items:

  • Combined-stack idle-off and pm_test evidence on J716c (T6050, batched trial kernel 3545ebecb76f at b963090c1f2d, predating ba54710a1438): all four dcpext instances (2b2e00000, 302e00000, 306e00000, 392e00000) reached fControllerPowerState 0 at 5.907–5.910 s, returned to 0 after 4x pm_test=devices and 2x pm_test=platform (re-idle within 8 s), and 3x DPMS cycles (samples DCP state 0 during DPMS-off and records display re-enable during DPMS-on) passed, 0 DCP panics, smoke clean, and 0 new failed system units (aurora-peripherals.service fails on default Stage 2 after warm reboots on this Mac). Note 3545ebecb76f also carries #3289 (ba76eb6e18f7)'s dcp_v27_warm_restart() cache reset and #3294 (6aefc6058db0)'s dcp_v27_reopen_live() changes beyond adjacent helper additions; 18 files is the stack count relative to main, while 3 of the 9 files in #3398's own diff (dcp-internal.h, dcp.c, dcp-v27-sleep.inc) differ from 3545ebecb76f due to #3289/#3294.
  • Still under **Not yet:**: physical attach from idle-off (including docked hotplug) and real s2idle / deep suspend (rtcwake) on the landing head ba54710a1438 or a runtime-preserving candidate (apple-pmu-rtc cannot wake J716c unattended), a second-family unaffected smoke row (J313 Group F trial kernel at b963090c1f2d was built and parity-checked against main ee36fbdcd1c8, and never booted because J313 became unreachable after the second deep-sleep cycle on baseline main), hosted CI on the final diff, and retargeting #3398 to main before #3410 merges (per branch policy, deleting a merged base branch closes PRs still stacked on it).

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

Blockers:

  1. Targets open non-default base branch feat/dcp-v27-ext-idle-off (#3410). Retarget to main once #3410 merges so full main CI runs on the final diff, and record exact-head J716c external Type-C display hot-plug wake after idle power-off.

Checked: Merge of updated feat/dcp-v27-ext-idle-off (38c26d8a6b57) in ba54710a14 and offline build/KUnit verification at ba54710a.

Evidence
  • Delta since 1f59a74f (0 code blockers): Clean merge of #3410@38c26d8a preserving dcp_peer_lock synchronization across dcp_ext_idle_kick()/dcp_ext_idle_wake() and dcp_peer_forget()/dcp_peer_idle_drain() teardown; W=1 -Werror, display.kunitconfig (168 passed / 1 skipped), apple-dcp-fabric (117/117), t6050-aop (11 passed / 1 skipped), and checkpatch --strict pass at ba54710a.

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Nov 30, 2026

@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 87662fb2f093

Blockers:

  • Stacked on open non-default base branch feat/dcp-v27-ext-idle-off (#3410); retarget to main before #3410 merges and wait for full main-targeted hosted CI to complete green (currently 0 passed, 0 failed, 8 queued on the stacked base).
  • Exact-head hardware verification noted in Not yet is still pending: physical external Type-C display attach/hot-plug wake from idle-off and real s2idle/deep suspend on T6050 (J716c), plus a second-family unaffected regression row.

Checked:

  • Forward-merge 87662fb2f093 (ba54710a + #3410@c4797d39): verified clean integration across all 9 PR files with human Signed-off-by and MERGEABLE status on feat/dcp-v27-ext-idle-off.
  • Verified cross-device peer lifetime pin and teardown drain remain intact (dcp_peer_idle_get_locked(), peer_idle_users, dcp_peer_idle_put_locked(), dcp_peer_idle_drain() called in both dcp_comp_unbind() and dcp_ext_idle_close()).
  • Verified afk.c (sleep_v27_closed send gate), dcp-v27-sleep.inc (dcp_v27_ext_idle_* + rollback paths), dcp.c (DCP_EXT_IDLE_STOPPING + dcp_v27_ext_idle_capable() routing), and drivers/soc/apple/sleep.c + include/linux/soc/apple/sleep.h (t6050_disp_pmc_lock serialization, apple_sleep_m5_display_pmc(), apple_sleep_m5_dispext_power_ready(), and !CONFIG_APPLE_SOC_SLEEP stubs); no Apple material or AI attribution.
Evidence
  • Head: 87662fb2f093cd60acb223d4b9193ceab47386a0 (base: feat/dcp-v27-ext-idle-off, MERGEABLE, +871/-95, 9 files, 6 commits).
  • Merge parents: ba54710a + c4797d39.

@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Nov 30, 2026
@github-actions github-actions Bot added 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 30, 2026

@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: MERGE at 87662fb2f093

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: - Forward-merge 87662fb2f093 (ba54710a + #3410@c4797d39): verified clean integration across all 9 PR files with human Signed-off-by and MERGEABLE status on feat/dcp-v27-ext-idle-off.

  • Verified cross-device peer lifetime pin and teardown drain remain intact (dcp_peer_idle_get_locked(), peer_idle_users, dcp_peer_idle_put_locked(), dcp_peer_idle_drain() called in both dcp_comp_unbind() and dcp_ext_idle_close()).
  • Verified afk.c (sleep_v27_closed send gate), dcp-v27-sleep.inc (dcp_v27_ext_idle_* + rollback paths), dcp.c (DCP_EXT_IDLE_STOPPING + dcp_v27_ext_idle_capable() routing), and drivers/soc/apple/sleep.c + include/linux/soc/apple/sleep.h (t6050_disp_pmc_lock serialization, apple_sleep_m5_display_pmc(), apple_sleep_m5_dispext_power_ready(), and !CONFIG_APPLE_SOC_SLEEP stubs); no Apple material or AI attribution.

Follow-ups (not blocking): Merge parent #3410 first; follow-ups: retarget, main CI, J716c attach/hot-plug wake + suspend row

@tully-8888

Copy link
Copy Markdown
Contributor

Independent review at 87662fb2f093 (T6050 / J714s impact):

Verdict: changes requested — 3 code blockers + 1 hardware-test gap

  1. Strict idle wake ignores A489 / A115 transport errors (drivers/gpu/drm/apple/dcp-v27-sleep.inc:742-748, 765-776):

    • a489 and a115 are sent on every strict wake (v27_a115 defaults to true), logged at line 756, and omitted from the if (!allow_cycle) error propagation block (:765-776). Transport failures (-ETIMEDOUT/-EIO) therefore allow strict idle wake and rollback to publish DCP_EXT_IDLE_ON as healthy.
    • Fix: propagate if (!ret && a489) ret = a489; if (!ret && a115) ret = a115; inside if (!allow_cycle) (and bail early in strict mode if a500 fails).
  2. J714s DP audio sits under DISPEXTn_SYS (arch/arm64/boot/dts/apple/t6050-j714s-dpaudio.dtsi:20-74, t6050-peripherals.dtsi:181-192):

    • dpaudio1..3 use ps_dispext{0,1,2}_adma, whose parent DISPEXTn_SYS is lowered by external DCP idle-off, exposing J714s's 3 USB4/TB5 ports to the same -ENODEV DP audio failure already blocking drm/apple: power off idle firmware-27 external display processors #3410 on J813 (plus risk of lowering DISPEXTn_SYS while ADMAC is runtime-active).
    • Fix: coordinate external DCP idle-off with DP audio / DISPEXTn_ADMA runtime PM (or hold off lowering DISPEXTn_SYS while DP audio is bound/active) before enabling T6050 idle-off.
  3. One failed idle wake permanently blocks system suspend until reboot (drivers/gpu/drm/apple/dcp.c:11204-11205):

    • When a wake fails leaving dcp->ext_idle_domains_off set, nothing clears DCP_EXT_IDLE_FAILED, and dcp_ext_idle_prepare_suspend() returns dcp->ext_idle_err ?: -EIO on every subsequent s2idle and deep suspend attempt, preventing lid-close sleep until reboot.
    • Fix: when the external engine's domains/DARTs are already powered off in the failed state, allow system suspend to proceed (return 0) instead of permanently vetoing sleep.
  4. Missing T6050 hotplug-from-idle hardware row: no T6050 run yet exercises live attach-from-idle (wake under the fabric lock), dual-pipe peer wake from hints, or s2idle after idle-off.

Non-blocking notes
  • dcp.c: using disable_delayed_work_sync() instead of cancel_delayed_work_sync() on teardown avoids a dcp_ext_idle_kick() re-queue race on remove.
  • dcp-peer-v27.inc: releasing a peer does not kick its idle timer, leaving an unused peer engine powered.
  • dcp.c: t6050_dcpext hardware flags (v27_sleep_protocol/v27_sleep_recovery) remain false even though this PR enables those paths.

…pend

Propagate A489 and A115 transport failures during strict v27 external
idle wake, bail out early if the initial A500 RPC fails, and skip the
trailing A500 round when strict A489/A115 calls fail.

When a failed idle wake has already left the external DCP domains and
DARTs powered off (DCP_EXT_IDLE_FAILED with ext_idle_domains_off), allow
system suspend and resume across s2idle, s2r_ext, and T6050 v27 sleep
without vetoing deep sleep or powering the failed DCP back on, accept
already-off external display words in T6050 sleep prepare/replay, and
add KUnit coverage for both paths.

Signed-off-by: Erik Bourget <[email protected]>
@erikwb

erikwb commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Forward-merged updated #3410 (f39fdeec3e43, carrying latest origin/main 41ab8f546874 including #2673 J713 27.2 external display) at 864f2b188ac0 and added fix commit 224cf52e3c33 addressing every item from @tully-8888's review:

  1. Strict idle wake A489 / A115 / A500 transport errors (drivers/gpu/drm/apple/dcp-v27-sleep.inc): fixed in 224cf52e3c33 (dcp_v27_ext_wake_calls()). Strict mode (!allow_cycle) now bails out immediately if the initial A500 RPC fails, skips the trailing A500 round if A489 or A115 failed, and propagates both a489 and a115 errors inside if (!allow_cycle). Covered by new KUnit test dcp_v27_ext_wake_transport_errors (all-success case with v27_ext_a500_again = true and error paths).
  2. J714s DP audio under DISPEXTn_SYS: resolved by merging #3410 (f39fdeec3e43) at 864f2b188ac0. dcp-dp-audio now defers ADMA channel setup on unplugged opens with a SNDRV_DMA_TYPE_VMALLOC void buffer fallback (so probing /dev/snd/pcm* never wakes DISPEXT*_SYS), and plugged opens hold dcp_audio_dma_get() / dcp_audio_dma_put() across DMA-backed PCM lifetimes (ext_idle_audio_users checked in dcp_ext_idle_eligible()), keeping ext_idle_initialized balanced on non-idle-capable DCPs too.
  3. DCP_EXT_IDLE_FAILED vetoing suspend or powering back on across resume (drivers/gpu/drm/apple/dcp.c, drivers/gpu/drm/apple/dcp-v27-sleep.inc, drivers/soc/apple/sleep-t6050.h): fixed in 224cf52e3c33:
    • dcp_ext_idle_suspend() returns 0 when ext_idle_state == DCP_EXT_IDLE_FAILED && ext_idle_domains_off (dcp_ext_idle_failed_dark()).
    • On T6050 v27 sleep (dcp_v27_sleep_prepare(), dcp_v27_late_{arm,check,stop,disarm}(), dcp_v27_sleep_restart(), dcp_v27_sleep_resume()), and in dcp_s2r_pm_notify() PM_SUSPEND_PREPARE, a failed dark external DCP skips dcp_v27_refuse() and v27 firmware stop calls, registers as V27_PREPARED + quiesced with the sleep controller, accepts already-off external display words in t6050_sleep_display_prepare() / sleep_region_replay(), and returns to V27_LIVE on resume without restarting firmware or replugging ports.
    • On s2r_ext (dcp_s2r_ext_suspend(), dcp_s2r_resume(), dcp_s2r_restart()), suspend keeps s2r_stopped routed to dcp_s2r_resume() without taking DART refs or parking routes, and resume skips dcp_s2r_ext_start() / dcp_s2r_restart_done() so ext_idle_domains_off, crashed, and s2r_fw_down stay intact.
    • Covered by expanded KUnit test dcp_ext_idle_failed_suspend across dcp_ext_idle_suspend(), s2r_ext, and v27 deep-sleep suspend/resume paths.
  4. Hardware-test gap (T6050 hotplug-from-idle, dual-pipe peer wake from hints, s2idle after idle-off): still pending at final head 224cf52e3c33 and kept open in Not yet. The earlier 79a2063f331c J716c trial boot (idle-off at ~6.2 s + 2x pm_test=devices) is retained as pre-fix evidence only.

Non-blocking notes:

  • disable_delayed_work_sync() vs cancel_delayed_work_sync(): dcp_ext_idle_close() transitions ext_idle_state out of DCP_EXT_IDLE_ON under ext_idle_lock before cancel_delayed_work_sync(), and both dcp_ext_idle_kick() and dcp_ext_idle_off_work() check ext_idle_state == DCP_EXT_IDLE_ON && ext_idle_armed under ext_idle_lock, so no re-queue race exists while keeping re-bindable open() and KUnit setup self-contained.
  • Peer release idle kick (dcp-peer-v27.inc): dcp_peer_hints_v27() already calls dcp_ext_idle_kick(released) on peer release when the active-route hint clears.
  • t6050_dcpext v27_sleep_protocol / v27_sleep_recovery flags (dcp.c): neither field has any reader in drivers/ (runtime idle-off is gated by dcp_v27_ext_idle_capable(), and firmware-27 sleep by apple,sleep-*-args).

Verified offline at 224cf52e3c33: W=1 KCFLAGS="-Werror" object builds (0 errors, 0 warnings across sleep.o, dcp.o, dptxep.o, dcp-fabric.o, iomfb.o, afk.o, audio.o, av.o with CONFIG_APPLE_SOC_SLEEP=y), git diff --check f39fdeec3e43..HEAD clean, checkpatch.pl --strict --git f39fdeec3e43..HEAD (0 errors, 0 warnings, 0 checks across all 4 commits), KUnit (display.kunitconfig + CONFIG_SOUND=y CONFIG_SND=y: 276 passed / 3 skipped; display.kunitconfig + CONFIG_SOUND=y CONFIG_SND=y CONFIG_IOMMU_SUPPORT=y CONFIG_APPLE_DART=y CONFIG_APPLE_SOC_SLEEP=y: 278 passed / 2 skipped with apple-dcp-firmware 9/9 including dcp_v27_ext_wake_transport_errors and dcp_ext_idle_failed_suspend, plus apple-dcpaud-legacy 10/10; tests/.kunitconfig 117/117; t6050-aop.kunitconfig 11 passed / 1 skipped), and host/selftests (dcpaud 20/20 with 10/10 open-fallback mutants killed, dart 24/24, dcpext26-startup-tests.py --mutants, backlight-coldboot-tests.py, display-sleep-merge-tests.py 17/17, selftests/drivers/gpu/apple-dcp/run.py --group audio 2/2).

Remaining before merge: retarget #3398 to main before #3410 merges, run hosted CI at 224cf52e3c33, and run the refreshed J716c (T6050) hardware row (hotplug-from-idle, dual-pipe peer wake, DP audio, s2idle after idle-off) plus a second-family unaffected smoke row.

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Dec 1, 2026

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

The failed-dark exception also accepts a partially completed power transition. At drivers/gpu/drm/apple/dcp-v27-sleep.inc:2155–2161 and 2320–2325, a PMGR timeout sets both DCP_EXT_POWER_UNCERTAIN and ext_idle_domains_off. Both dcp_ext_idle_failed_dark() and dcp_ext_idle_suspend() then treat that flag as confirmed off. I replayed the two functions with the timeout state and got failed_dark=1, suspend=0. On a failed power-on, the T6050 final check can also accept an auto-enabled word with a nonzero actual state, so it does not establish that all domains stayed off. Keep the failed-dark path for confirmed-off domains, propagate the saved error on uncertain power, and add that case to dcp_ext_idle_failed_suspend.

@erikwb

erikwb commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

We carry this PR on top of #3410 in our J716c (M5 Max, T6050) daily kernel.

Without wiring T6050's external display processors (dcpext0..3) and serialized display PMC helpers into #3410's runtime idle-off state machine, unattached external DCPs on J716c remained powered continuously at idle even with no external monitor connected.

Running smoothly on our J716c daily kernel alongside #3410, powering down unattached external DCPs at idle and waking cleanly on display attach.

@github-actions github-actions Bot added changes-requested A reviewer requested changes (bot) merge-conflict Conflicts with the base branch (bot) labels Dec 1, 2026

This branch has not been deployed

No deployments
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:platform Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) changes-requested A reviewer requested changes (bot) door:two-way Revertible or not, from Merge risk (bot) merge-conflict Conflicts with the base branch (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants