Skip to content

drm/apple: toggle display pipe PMC interfaces across S2R domain transitions - #3300

Merged
DjDeveloperr merged 17 commits into
mainfrom
feat/dcp-s2r-pmc-interface
Dec 3, 2026
Merged

DjDeveloperr merged 17 commits into
mainfrom
feat/dcp-s2r-pmc-interface

Conversation

@erikwb

@erikwb erikwb commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What: Wire consumer PMC BWR/boost interface preflight, clear, and restore into direct-MMIO display-domain S2R transitions (dcp_s2r_domains_{off,on}()) in hardware power-domain order (CPU -> FE -> PMC -> SYS on off; SYS -> PMC -> FE -> CPU on resume), roll back boost enables and verify hardware enable bits on PMC restore failures, track pending PMC restoration separately from confirmed hardware-off state, keep DISP_SYS up and still poll DISP_CPU off across PMC-off failures (latching s2r_start_stuck on timeout), keep dpms_powered_off armed until restart succeeds, drain both display and DCP DARTs before lowering domains, and latch s2r_start_stuck across both internal and external S2R paths (bde2a1d9743f..a37ced381725); builds on #3297 (now on main).
Tested: J713 (T8132, firmware 27.2) at a601a4f903c0: internal DPMS 4/4, s2idle and committed deep suspend passed, with no PMC or DART errors. Hardware receipt. Apple build, host tests and the PMGR power-state KUnit job passed at this head. On the merge tree with main 536a613c0abe, all four grouped KUnit configs built for arm64, 128 DCP cases passed under UML, and 117 affected host checks passed.
Risk: two-way door · Apple SoCs using direct-MMIO display-domain S2R/DPMS power-gating (dcp_s2r_domains_{off,on}()) and consumer-switched PMC display-pipe interfaces (apple_pmc_interface_consumer_*()).
Not yet: External DPMS and the external-pipe PMC interface on J713 with a dock, plus external DCP on firmware 26.6.2. T6050 hardware coverage and hardware fault-injection coverage for power-on rollback and DART drain remain open.

Details
  • Stacking & base: Builds on #3297 (merged to main in 645b086d9989). Targets main; git merge-tree --write-tree origin/main a37ced381725 is clean (922512a6262c6c3b177b252a1e8a6bc0d25df135).
  • Preflight before stopping firmware: Calls dcp_s2r_pmc_preflight() in dcp_s2r_suspend() and dcp_s2r_ext_suspend() before stopping firmware or disrupting presentation, so an unavailable PMC provider or CONFIG_APPLE_PMC=n on a configured pipe refuses cleanly instead of stranding a stopped firmware during refused-sleep recovery.
  • Hardware power-domain ordering (6a84c1d95460):
    • dcp_s2r_domains_off(): preflights PMC before darkening DART or lowering PMGR, lowers DISP_CPU and DISP_FE, polls DISP_FE off, clears PMC interface enables (recording s2r_pmc_off), then lowers DISP_SYS and polls DISP_CPU off.
    • dcp_s2r_domains_on(): raises DISP_SYS and polls DISP_SYS on when s2r_pmc_off is set, restores PMC interface enables before raising DISP_FE and DISP_CPU (aborting before setting s2r_domains_up if restore fails), then raises DISP_FE and DISP_CPU.
  • DPMS retry, D572 timeout propagation, and failed-start unwind (4b09f0691c2d, 597803b9d48b, bde2a1d9743f, f29b4f2d9f48):
    • dcp_dpms_power_on() keeps dpms_powered_off armed when s2r_fw_down is true until dcp_s2r_display_on() succeeds.
    • dcp_s2r_display_on() returns -ETIMEDOUT when D572 completion times out, unwinding through dcp_s2r_unwind_failed_start() so the next unblank retries cleanly.
    • dcp_s2r_unwind_failed_start() drains the display DART (dcp_s2r_disp_streams_off()) before dcp_s2r_stop_streams() and dcp_s2r_domains_off(), and latches s2r_start_stuck with crashed = true if either drain or domain power-off fails so dcp_s2r_warm_restart() refuses to restart over domains left powered on.
  • Power-on timeout rollback & terminal latch (b43e08447acd, 241b8646ccdf, e21f17ce0577, fbdf48f794c2, 224e82ed0a8f, 3124f5f5237e, a37ced381725):
    • When DISP_CPU times out in dcp_s2r_domains_on(), dcp_s2r_domains_on_rollback() lowers the PMC word, DISP_CPU, and DISP_FE, turns off any PMC interface raised during that power-on, lowers DISP_SYS only if the PMC interface is off or absent (keeping DISP_SYS up if an existing PMC interface remains on), and polls DISP_CPU off. If rollback fails, dcp_s2r_domains_on() latches dcp_s2r_start_stuck().
    • apple_pmc_interface_consumer_set() restores the prior boost_enable bit if writing bwr_enable fails on power-on, and apple_pmc_interface_consumer_check() checks both hardware enable bits before returning -EALREADY.
    • When dcp_s2r_pmc_on() fails in dcp_s2r_domains_on(), dcp_s2r_domains_on() checks the PMC interface state (trying dcp_s2r_pmc_off() if active) and keeps DISP_SYS up while latching dcp_s2r_start_stuck() unless the interface is confirmed off or absent.
    • dcp_s2r_ext_start(), dcp_s2r_ext_cycle(), dcp_s2r_refused_domains_off(), dcp_s2r_domains_off(), and dcp_s2r_domains_on() check s2r_start_stuck before clearing crashed or touching hardware.
  • Partial-transition recovery & CONFIG_APPLE_PMC=n fallback: Tracks confirmed hardware-off state (s2r_pmc_off) separately from pending PMC restoration (s2r_pmc_restore). If apple_pmc_interface_consumer_off() fails after lowering DISP_CPU/DISP_FE, checks and restores PMC on -EALREADY; if clearing BWR and rolling back boost both fail (-EIO check), keeps s2r_pmc_off clear (leaving DISP_SYS up) while setting s2r_pmc_restore so the next dcp_s2r_domains_on() must successfully restore PMC before raising DISP_FE or DISP_CPU. Across all dcp_s2r_pmc_off() failures (including failed restoration or -EIO state check), dcp_s2r_domains_off() keeps DISP_SYS up, still polls DISP_CPU off, and latches dcp_s2r_start_stuck() if that poll times out so a later unblank cannot restore PMC and request DISP_CPU on before the CPU has power-cycled. Treats -ENODEV (and -EOPNOTSUPP with no configured DT PMC interface) as an absent optional interface.
  • Revert: git revert -m 1 <merge-commit> on main; kernel driver and KUnit changes only.
Evidence
  • Local checks at head a37ced381725:
    • ./scripts/checkpatch.pl --strict --git e21f17ce05770d3b685c02a8e8468c147958a4b3..HEAD: 0 errors, 0 warnings, 0 checks across fbdf48f794c2 (148 lines), 224e82ed0a8f (213 lines), 3124f5f5237e (241 lines), and a37ced381725 (177 lines).
    • git merge-tree --write-tree origin/main HEAD (8616760ed646): clean (922512a6262c6c3b177b252a1e8a6bc0d25df135).
    • make ARCH=arm64 LLVM=1 W=1 drivers/gpu/drm/apple/dcp.o drivers/pmdomain/apple/pmc.o (defconfig + asahi.config, CONFIG_RUST disabled locally): 0 errors (dcp.o 0 warnings; pmc.o 0 new warnings, 14 pre-existing kernel-doc warnings on apple_pmc_domain).
    • ./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/apple/tests/display.kunitconfig: Ran 205 tests: passed: 204, skipped: 1 (apple-dcp-s2r-pmc 24/24 passed, covering DPMS retry, D572 timeout, display DART drain, s2r_start_stuck, prewarm unwind, CPU timeout rollback, PMC restore failure SYS retention/latch, stuck external start/cycle refusal, failed domains_off rollback followed by unblank restore/blocking, and DISP_CPU off timeout on PMC-off failure blocking restart; 1 skipped apple_g17_rx_util_min_test, needs CONFIG_UCLAMP_TASK).
    • ./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 (CONFIG_APPLE_PMC=y, CONFIG_APPLE_PMC_KUNIT_TEST=y): Ran 18 tests: passed: 18 (apple-pmc 18/18 passed, including apple_pmc_test_interface_consumer_on_stuck).
  • Ancestor local checks at 3124f5f5237e (prior to a37ced381725 on dcp.c/dcp_s2r_pmc_test.c):
    • ./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/apple/tests/topology.kunitconfig: Ran 211 tests: passed: 210, skipped: 1 (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/pmdomain/apple/.kunitconfig.pmgr-pwrstate: Ran 30 tests: passed: 30 (apple-pmgr-pwrstate 30/30 passed).
    • python3 tools/asahi/run-host-tests.py: 837/838 passed (apple-dcp 84/99 ok with the 15 pre-existing unrelated TAP failures).
  • Exact-head hardware & arm64 build status (a37ced381725):
    • J313 (M1 Air, T8103, G13G, firmware 27.2, default cmdline, one-shot Stage 2 + GRUB): PASS (unaffected smoke row: T8103 display pipes use no PMC interface) in composite 807c3bbf2263 (origin/main d3de772ac0c1 + #3507, #3332, #3850, #3359, #3334 + #3410, #3300 a37ced381725, #3289): clean boot (0 Oops/BUG/WARNING/SError/Call trace; err+ lines subset of default kernel; speakerguardd-v2-switchtest.service failed identically on a separate #3321 build without #3359, not attributed to #3300), >= 7 internal eDP-1 DPMS off/on cycles (backlight 0 -> 130, plus DP-2 DPMS when docked), and 3/3 docked deep S2R PASS (rtcwake -d /dev/rtc1 -m mem -s 20, suspend_stats fail 0, 16 MB RAM integrity PASS, pre/post-sleep compute-check and render-check PASS; software-undocked s2idle hung and is tracked under #3334).
    • J713 (M4 Air, T8132, 27.2 firmware): composite 25e08d2ee142 (origin/main d3de772ac0c1 + #3717, #3273, #3289, #3300 a37ced381725, #3359, #3409) built cleanly (kb run -p linux-j713, 352 s, exit 0, CONFIG_DRM_APPLE_DCP_T8132=y); hardware pass not run while J713 is off-network.
    • J716c (M5 Max, T6050, 27.2 firmware): standalone #3300 (a37ced381725) built cleanly (kb run -p linux-j716c), not yet booted (excluded from the J716c composite due to a six-hunk dcp_s2r_domains_off() merge conflict with #3398, and the J716c pass stopped on the composite's s2idle non-wake before booting the standalone build).
  • Ancestor hosted CI at e21f17ce0577:
    • Apple build and KUnit (apple-build, KUnit plan, KUnit dcp-fabric dcp-topology dcp-display): PASS (https://github.com/aurora-silicon/linux/actions/runs/46799385083).
    • Host tests (host-tests): PASS (https://github.com/aurora-silicon/linux/actions/runs/46799385403).
    • pr-text and pr-readiness: PASS.
  • Ancestor J713 row (241b8646ccdf, composite with #3297 0378182e01b8, prior to e21f17ce0577..a37ced381725): J713 (M4 MacBook Air, T8132, 27.2 firmware, default command line): Linux 7.3.0 built from 429e7e15f122 with 0378182e01b8 and 241b8646ccdf (plus five other open PR heads) merged cleanly, one-shot Stage 2 with that tree's devicetree: boots with 0 failed units and 0 AppArmor denials; 4 internal-panel DPMS off/on cycles (each off returns dpmsStatus false, each on re-initialises the DCP firmware and returns true), a 20 s s2idle cycle (PM: suspend entry (s2idle) to PM: suspend exit, suspend_stats fail 0), a 25 s deep suspend/resume (PM: suspend entry (deep) to PM: suspend exit, no reset, fail 0) and 4 more DPMS cycles after resume, with isp, venc and avd domains off-0 and dispext* / pmc-dispext*-interface domains on afterwards. The external display processors did not probe in this build (-ENODEV, "no IOMMU domain"; main does not carry the dock-display stack, and that stack conflicts with these two PRs), so the external-pipe consumer chain (dispext{0,1}_cpu -> _fe -> pmc-dispext{0,1}-interface) and the failure paths (power-on rollback, display DART drain unwind, s2r_start_stuck) were not exercised on hardware; those are covered by KUnit only.
  • Combined-build hardware results at ancestor 4b09f0691c2d (prior to 597803b9d48b..a37ced381725 and #3307 merge):
    • J713 (M4 MacBook Air, T8132, 27.2 firmware, default cmdline + panic=10, candidate 37edba02c535): clean boot (0 failed units, 0 AppArmor denials, same 3 err lines as default), 3+3 eDP-1 DPMS off/on cycles before and after deep sleep, 20 s s2idle PASS (PM: suspend exit), and full hardware deep sleep resume PASS (no reset; all isp, venc, and avd_sys domains off-0, dispext* and disp_* on).
    • J313 (M1 MacBook Air, T8103, docked with Thunderbolt 5 dock + 3840x2160@120 external display on dcpext, default cmdline, default Stage 2 1.0.0b17-gf5ddfff2, fleet candidate 5509a254a6bd): boots cleanly, 3 DPMS off/on cycles of eDP-1 and external output, 2 deep sleeps and s2idle unaffected, 0 failed units, 0 AppArmor denials (unaffected row: T8103 display pipes use no PMC interface; one earlier full run hung in s2idle and did not reproduce on later runs or without #3329/#3332).
    • J716c (16-inch M5 Max, T6050, default cmdline, no external display attached, candidate 3e4078f656d5): boots cleanly to SDDM/Hyprland (eDP-1 3456x2234@120), Borealis GPU (7,940/7,940 dEQP-VK.ssbo.* Pass, 0 GPU faults), 2x DPMS off/on cycles, 0 new failed units, 0 LSM denials, 0 new kernel errors — unaffected.
  • Earlier combined-build J713 run at 6a84c1d95460 (j713-dcpext/air-dcpext-272 7a8022a6d24d + #3297 2b1bab104938 + #3300 6a84c1d95460 + #3307 eab8b5157340 + #3308 05d728d91d68): 286e00000.dcp and 48ae00000.dcp powered domains off in 1 ms, completed pm_test=devices deep suspend/resume and refused-sleep power-cycle recovery, and re-gated 5 s after resume with 0 errors/warnings.

…itions

Wire consumer PMC BWR and boost interface clear/restore into the direct
MMIO display-domain transition helpers (dcp_s2r_domains_off() and
dcp_s2r_domains_on()) in hardware power-domain order:
- preflight PMC availability in dcp_s2r_suspend() and
  dcp_s2r_ext_suspend() before stopping firmware, so an unavailable
  provider or CONFIG_APPLE_PMC=n on a configured pipe refuses sleep
  cleanly instead of stranding a stopped firmware during refused-sleep
  recovery.
- off: preflight PMC before touching DART/PMGR, lower CPU and FE, wait for
  FE off, clear PMC interface enables (recording s2r_pmc_off), then lower
  SYS and wait for CPU off.
- on: raise SYS and wait for SYS on, restore PMC interface enables before
  raising FE and CPU (aborting before setting s2r_domains_up if restore
  fails), then raise FE and CPU.

Treat -ENODEV (and -EOPNOTSUPP when CONFIG_APPLE_PMC is disabled on pipes
with no configured PMC interface in DT) as an absent optional interface,
while propagating -EOPNOTSUPP and all other errors for pipes with a
configured or malformed PMC interface topology.

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb
erikwb requested review from a team as code owners November 26, 2026 18:56
@erikwb
erikwb requested review from LiamRay11 and malik-na November 26, 2026 18:56
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (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 a601a4f9: not ready yet

Check Detail
CI at head running running: KUnit clpc dcp-fabric dcp-topology dcp-display
Review no approved by sithglan, but GitHub does not count it yet (code owner from Core or Omarchy Mac needed, or approval went stale)
Requested changes ok none
Hardware row at head ok in the PR body at a601a4f9
Conflicts ok none
PR text ok Risk: two-way · Apple SoCs using direct-MMIO display-domain S2R/DPMS power-gating (dcps2rdomains{off,on}()) and consumer-switched PMC display-pipe interfaces (applepmcinterfaceconsumer()).

Areas: area:display, area:gpu, area:power

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

Clear dcp->dpms_powered_off in dcp_dpms_power_on() only when s2r_fw_down
is already false or after dcp_s2r_display_on() succeeds, so a failed
PMC interface restore or post-start boot/display-on failure leaves
dpms_powered_off armed for the next unblank to retry instead of
returning early while s2r_pmc_off and s2r_fw_down remain set.

Unwind post-domain start failures via dcp_s2r_unwind_failed_start() in
both dcp_s2r_display_on() and dcp_s2r_prewarm_work(), stopping secure port
polling, detaching the RTKit mailbox, clearing CPU RUN, stopping DART
streams, and powering down the display domains and PMC interface so the
next retry starts from a clean stopped state. Also lower DISP_SYS if
dcp_s2r_pmc_on() fails in dcp_s2r_domains_on().

Add a KUnit suite (apple-dcp-s2r-pmc) under
CONFIG_DRM_APPLE_DISPLAY_KUNIT_TEST covering failed PMC restore, failed
post-start boot handshake, and failed post-start display-on followed by
clean retries.

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Updated the PR body with the J713 (M4 Air, 27.2 firmware) hardware run at head 4b09f0691c2d in candidate 37edba02c535 (j713-dcpext/air-dcpext-272 fd3dc16c121b + #3273 7f21093a0d31 + #3297 2b1bab104938 + #3300 4b09f0691c2d, default cmdline + panic=10): clean boot (0 failed units, 0 AppArmor denials, same 3 err lines as default), 3+3 eDP-1 DPMS off/on cycles before and after sleep, 20 s s2idle PASS, and full hardware deep sleep resume PASS (no reset).

@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 4b09f069

Blockers:

  1. Targets non-main base branch feat/apple-pmc-consumer-interface-chain (#3297), which is still open. Full build/KUnit/host-tests CI has not run against main. Once #3297 lands on main, retarget this PR to main and run full CI for full review.

Checked: PR base branch (feat/apple-pmc-consumer-interface-chain), dependency PR #3297 status, CI status (readiness and pr-text only), no AI attribution, human Signed-off-by.

Evidence
  • Base branch feat/apple-pmc-consumer-interface-chain corresponds to open PR #3297.
  • Because this PR does not target main, apple-build, host-tests, and KUnit workflows have not run on 4b09f069.

When wait_for_completion_timeout(&dcp->s2r_dart_done, ...) times out in
dcp_s2r_display_on(), return -ETIMEDOUT instead of 0 so
dcp_s2r_unwind_failed_start() powers the display domains and PMC
interface back down and dcp_dpms_power_on() keeps dpms_powered_off and
s2r_fw_down armed to retry on the next unblank.

Route KUnit display_on hooks through dcp_s2r_power() with a test D572
timeout so apple-dcp-s2r-pmc exercises the completion timeout and retry
path directly.

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb

erikwb commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both review blockers on top of 4b09f0691c2d in 597803b9d48b (retaining the existing HOLD while #3297 lands on main):

  • D572 completion timeout unwind (drivers/gpu/drm/apple/dcp.c, drivers/gpu/drm/apple/dcp-internal.h, drivers/gpu/drm/apple/dcp_s2r_pmc_test.c): dcp_s2r_display_on() now sets ret = -ETIMEDOUT when wait_for_completion_timeout(&dcp->s2r_dart_done, ...) expires without completion, so dcp_s2r_unwind_failed_start() stops the CPU/streams and powers down the display domains and PMC interface, and dcp_dpms_power_on() keeps dpms_powered_off and s2r_fw_down armed for the next unblank. Routed the KUnit display_on hook through dcp_s2r_power() with a short test D572 timeout and added dcp_s2r_pmc_dpms_retry_after_d572_timeout to verify timeout, unwind, and clean recovery on the second unblank.
  • Combined-build hardware reporting: Updated the PR description to report the three prior 4b09f0691c2d hardware runs (37edba02c535 J713, 5509a254a6bd J313, 3e4078f656d5 J716c) explicitly as combined-build results at ancestor 4b09f0691c2d, noting that both drivers/gpu/drm/apple/dcp.c and drivers/gpu/drm/apple/dcp-internal.h differ across all three candidates due to bundled patches and that the J713 candidate changes domain sequencing and external-path selection. Updated **Revert:** (git revert -m 1 <merge-commit>) and **Not yet:** to record that J713 (27.2) hardware verification must rerun after #3297 lands and the #3307 conflict in drivers/gpu/drm/apple/dcp.c is resolved.

Verified at head 597803b9d48b:

  • make O=_build ARCH=arm64 LLVM=1 W=1 drivers/gpu/drm/apple/dcp.o: 0 errors, 0 warnings.
  • arm64 QEMU KUnit drivers/gpu/drm/apple/tests/display.kunitconfig: 172 passed, 1 skipped (apple_g17_rx_util_min_test, needs CONFIG_UCLAMP_TASK), including apple-dcp-s2r-pmc (5/5 passed: added dcp_s2r_pmc_dpms_retry_after_d572_timeout).
  • arm64 QEMU KUnit drivers/gpu/drm/apple/tests/topology.kunitconfig: 208 passed, 1 skipped (apple_g17_rx_util_min_test), 0 failed.
  • python3 tools/asahi/run-host-tests.py: 696/697 passed (apple-dcp 81/96 ok with the 15 pre-existing unrelated failures on base 8c6992db4b9f).
  • ./scripts/checkpatch.pl --strict --git 2b1bab104938..597803b9d48b: 0 errors (0 issues on 597803b9d48b, 1 pre-existing MAINTAINERS new-file notice on 4b09f0691c2d for dcp_s2r_pmc_test.c); git diff --check clean.
  • git merge-tree --write-tree 2b1bab104938 597803b9d48b: clean against base #3297; origin/main (ee36fbdcd1c8, carrying merged #3307) conflicts in drivers/gpu/drm/apple/dcp.c (dcp_s2r_display_on() and dcp_s2r_prewarm_work()).

Once #3297 lands on main, we will merge main into feat/dcp-s2r-pmc-interface to compose #3307's DART drain/error checks with dcp_s2r_domains_off(), dcp_s2r_display_on(), and dcp_s2r_unwind_failed_start()/dcp_s2r_prewarm_work(), retarget #3300 to main so full CI runs, and rerun J713 (27.2) hardware verification at the merged head.

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

Copy link
Copy Markdown
Contributor

Merged main into this branch to clear the conflict: merge commit 4ecdedc24ec7 (parents a37ced381725 and main 87c01c2c901d). Main has since moved to 1262f9e1b6af; those 7 commits touch none of this PR's files.

Conflict: only drivers/gpu/drm/apple/dcp.c, in three places. Main (#3410, #3334) added static-stub S2R tests (dcp_s2r_test.c, KUNIT_STATIC_STUB_REDIRECT) at the same spots where this PR adds its s2r_test_ops code. The resolution keeps both:

  • dcp_s2r_domains_on(): main's stub redirect stays the first statement, followed by this PR's s2r_start_stuck check.
  • Main's dcp_s2r_warm_rtkit_boot() stays, followed by this PR's dcp_s2r_mailbox_off(), dcp_s2r_disp_streams_off() and dcp_s2r_unwind_failed_start().
  • Both dcp_s2r_test.c and dcp_s2r_pmc_test.c are included.

Nothing else changed. The PR's added and removed lines against main are the same as they were against its old base, and main's own changes come through unchanged.

Local checks (arm64, LLVM=1, clang 23, warm builds):

  • W=1 in the apple-build CI config (defconfig + asahi.config; Rust and WERROR off locally): all 48 objects in drivers/gpu/drm/apple/ and drivers/pmdomain/apple/ build with 0 warnings and 0 errors. dcp.o and pmc.o are also clean with KUnit off, and dcp.o with CONFIG_APPLE_PMC=n.
  • KUnit, build only. QEMU isn't available here, so nothing ran. The union of the display, topology, fabric and pmgr-pwrstate kunitconfigs plus APPLE_PMC_KUNIT_TEST builds and links. apple-dcp-s2r-pmc (24 cases), main's apple-dcp-s2r (3) and apple-pmc (19) are all in vmlinux. W=1 on dcp.o and pmc.o with the tests compiled in: 0 warnings.
  • These suites can't run under UML either. The DCP suites need ARM64, and clpc needs CPU_FREQ. apple-pmc builds on UML, but it fails from its first case because UML rejects reads and writes to the test's kmalloc'd register banks. That says nothing about this PR.
  • checkpatch.pl --strict on this PR's diff against main: 0 errors and 0 checks. The one warning is the generic "does MAINTAINERS need updating" for the new test file.

Still needed: hosted CI at 4ecdedc24ec7, the exact-head hardware rows, and a new approval. This push dismissed the earlier one, and the new approval has to come from someone other than the account that pushed.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Dec 2, 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.

Refresh at 4ecdedc24ec7. I rechecked rollback and the terminal fault latch. If restoring PMC fails, FE and CPU stay down. If a DART cannot drain, its domains stay up and the latch stops both internal and external restart. No code issue found. The substantive hosted checks passed. GitHub shows one cancelled readiness run.

J773g has covered external DPMS, s2idle and deep-sleep refusal matching baseline. The remaining rows are J713 DPMS/s2idle/deep and T6050 on erikwb's J716c. J714s can also exercise the T6050 path if the boot exposes an active display PMC interface. A maintainer who did not push this head still needs to approve.

Independent review of the forward merge at 4ecdedc24ec7 (parents: the earlier head a37ced381725 and main 87c01c2c901d).

Verdict: MERGE. The merge keeps both sides intact, the branch still merges cleanly into today's main, and the build and style checks below came back clean apart from the noted pre-existing items. Exact-head hosted CI and the hardware rows are still owed before landing.

1. Merge correctness. I redid the merge myself and compared the result with 4ecdedc2:

  • git merge-tree --write-tree --merge-base=006f20f150fe a37ced381725 87c01c2c901d (006f20f150fe is GitHub's merge base for the two parents) conflicts in drivers/gpu/drm/apple/dcp.c only. The local clone is shallow, so I passed the base explicitly.
  • git diff-tree -r <that tree> 4ecdedc2: the only file that differs is dcp.c. Every other file equals a clean merge.
  • In dcp.c, all three conflict blocks are resolved the way the notes say:
    • dcp_s2r_domains_on() starts with main's KUNIT_STATIC_STUB_REDIRECT, then the PR's s2r_start_stuck check.
    • Main's dcp_s2r_warm_rtkit_boot() is kept, followed by the PR's dcp_s2r_mailbox_off(), dcp_s2r_disp_streams_off() and dcp_s2r_unwind_failed_start(). The brace that both sides shared now closes the last helper.
    • dcp_s2r_test.c and dcp_s2r_pmc_test.c are both included.
  • Each of these functions is defined exactly once. The two test files share no top-level names.
  • Nothing was lost or reordered. For all five files the PR touches, the ordered list of added and removed lines is identical between 006f20f1..a37ced38 and 87c01c2c..4ecdedc2 (the git diff -U0 +/- lines hash the same). The same holds the other way for main's changes in the four files both sides edited (006f20f1..87c01c2c and a37ced38..4ecdedc2). For dcp.c that is 472 added and 33 removed lines on the PR side, and 1587 added and 217 removed on main's side.
  • The two sides still fit together:
    • Main's apple-dcp-s2r suite stubs dcp_s2r_domains_on() and dcp_s2r_warm_rtkit_boot(). It never sets s2r_test_ops or s2r_start_stuck, so its three cases follow the same op sequence as before.
    • The PR's s2r_test_ops branch in dcp_s2r_warm_restart() still returns before the new dcp_s2r_wake_darts() call.
    • The PR's failed-start unwind still undoes what dcp_s2r_wake_darts() turns on. On s2r_disp_dart_with_dcp pipes, dcp_s2r_stop_streams() drains both DARTs. On the other pipes, dcp_s2r_disp_streams_off() drains the display DART.

2. Current main. I built on main f4b229b300bb. None of its commits since 87c01c2c touch the PR's files, and git merge-tree --write-tree --merge-base=87c01c2c f4b229b3 4ecdedc2 is clean (tree 132800e301f6). Main moved to b47fc630ebd9 while the build ran. Its 38 further commits change 36 files: none of them is one of the PR's files, none is a header, and drivers/iommu/apple-dart.c changes no exported symbol or prototype that dcp.c calls. git merge-tree --write-tree --merge-base=87c01c2c b47fc630 4ecdedc2 is clean too (tree 9fbec8d79f99). The GitHub compare gives merge base 87c01c2c, with the PR 15 commits ahead and 50 behind.

3. Build (test merge 8030a19c = main f4b229b3 + 4ecdedc2, arm64, LLVM=1, clang, warm reflink of a stock aurora_defconfig output):

  • The config came from make aurora_defconfig and is byte-identical to a fresh aurora_defconfig in an empty output directory. It has DRM_APPLE=m, DRM_APPLE_DISPLAY_KUNIT_TEST=y (so both S2R test files are compiled into dcp.o), APPLE_PMC=y and KUNIT=m.
  • make -j20 -k Image modules compiled everything, including the rebuilt dcp.o and pmc.o. It then stopped at modpost on exactly one error: ERROR: modpost: drivers/gpu/drm/apple/appledrm.ko: symbol 'snd_pcm_lib_preallocate_free' undefined!. That error predates this PR. It comes from main's drivers/gpu/drm/apple/audio-legacy-test.c (from #3410; sound/core/pcm_memory.c does not export the symbol), and this PR touches neither file. modpost reports every undefined symbol in a single pass, so nothing else in appledrm.ko or any other module is unresolved.
  • make KBUILD_MODPOST_WARN=1 -j20 Image modules (that same error downgraded to a warning) finished with exit code 0. It produced vmlinux, Image and appledrm.ko (vermagic 7.3.0-rv3300-8030a19c). The other modpost lines are main's existing "missing MODULE_DESCRIPTION()" warnings on four unrelated test modules.
  • make W=1 -j20 drivers/gpu/drm/apple/ drivers/pmdomain/apple/ finished with exit code 0, 0 warnings and 0 errors. It recompiled 81 objects with the W=1 flags, dcp.o and pmc.o among them. The 17 objects it left alone are 14 .mod.o stubs, plus dcp-fabric-core.o, dcp-fabric-test.o and iomfb-state-test.o. Those three are built from drivers/gpu/drm/Makefile, not the apple/ directory, and neither this PR nor the merge touches them.
  • KUnit did not run here (no QEMU on this host). The KUnit plan in hosted CI covers that.

4. checkpatch. scripts/checkpatch.pl --strict on git diff f4b229b3 8030a19c (the PR's net diff against main, 5 files, +1607/-39): 0 errors, 0 checks, 1 warning. The warning is the generic "does MAINTAINERS need updating" for the new dcp_s2r_pmc_test.c. The SPDX sub-check could not run on the build host (no ply module). I checked the new file's header by hand: // SPDX-License-Identifier: GPL-2.0-only.

Hardware. The merge changes no logic on either side. The PR's added and removed lines are the same as at a37ced381725. Still, the S2R path now runs main's dcp_s2r_wake_darts() and dcp_s2r_warm_rtkit_boot() together with the PR's PMC ordering and unwind. So the rows still owed in the PR body (J713 DPMS, s2idle and deep suspend, and J716c) should run at this exact head. They should not be carried over from a37ced381725 or the composites. One J313 DPMS and deep S2R pass is also useful, as an unaffected T8103 row for main's T8103 DART-wake change running alongside this PR.

Still needed: exact-head hosted CI (apple-build, host-tests and the KUnit plan were pending when I checked), those hardware rows, and an approval from an account that did not push this head.

Commands I ran (on the pc build host, partial clone with GIT_NO_LAZY_FETCH=1, builds through ~/bin/aurora-build with 20 threads):

git merge-tree --write-tree --merge-base=006f20f150fe a37ced381725 87c01c2c901d   # conflict: dcp.c only
git diff-tree -r <merged tree> 4ecdedc24ec7                                         # only dcp.c differs
git diff -U0 006f20f1 a37ced38 / 87c01c2c 4ecdedc2 (and 006f20f1 87c01c2c / a37ced38 4ecdedc2), +/- lines hashed per file   # all identical
git merge-tree --write-tree --merge-base=87c01c2c f4b229b3 4ecdedc2                  # clean, 132800e301f6
git merge-tree --write-tree --merge-base=87c01c2c b47fc630 4ecdedc2                  # clean, 9fbec8d79f99
make ARCH=arm64 LLVM=1 aurora_defconfig && make -j20 -k Image modules             # only the known modpost error
make ... KBUILD_MODPOST_WARN=1 -j20 Image modules                                  # rc 0, appledrm.ko built
make ... W=1 -j20 drivers/gpu/drm/apple/ drivers/pmdomain/apple/                   # rc 0, 0 warnings, 0 errors
scripts/checkpatch.pl --strict <(git diff f4b229b3 8030a19c)                       # 0 errors, 1 warning, 0 checks

@DjDeveloperr

Copy link
Copy Markdown
Contributor

J773g 4ecdedc PASS (7.3.0-j773g-comp4-2856-3227 on main 1262f9e, boot_id=a2fdb8dc-5904-45ba-aca5-cd6391aa061a; DP-3 3840x2160 at boot, 4x DPMS off/on OK, 3x s2idle with DP-3 returning, mem refusal matches base [48ae00000.dcp errno=-16] with DP-3 restored; 0 stuck/latch/rollback, 0 DART faults, 0 WARN/Oops, 0 failed units)

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Local host CI at 4ecdedc24ec7 merged onto main 2a6502ffdfd5 (tree c145acded77c), on Mini in the Ubuntu 24.04 CI image. python3 -I tools/asahi/run-host-tests.py --jobs 6 passed 1019/1020, including Apple DCP and both Centauri cases. The one failure occurred before the SIO historical negative control ran because the partial clone lacked its archived source blob. After importing that blob, python3 -I tools/asahi/run-host-tests.py --jobs 2 --only sio-rpm-issue-tests passed 13/13, including that control. The source tree stayed the same.

python3 -I scripts/ci/apple-kunit.py plan selected CLPC, DCP fabric/topology/display, and PMGR power state. This run checked suite selection. Arm64 build and compile/link evidence is in the merge review and the forward-merge receipt.

Keep the PMC availability and preflight helpers alongside the
external DCP disconnect and idle-stop helpers added by main.
The external suspend path still checks PMC before disconnecting.

Signed-off-by: DjDeveloperr <hey@djdev.me>
The fixture extracts the external DCP suspend path and models its
dependencies. Stub the PMC preflight so the external idle cases can
exercise the disconnect and stop logic with a working interface.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) area:gpu Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Dec 3, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Forward-merged main as a601a4f903c0. The only conflict was in dcp.c, where #3822 adds external disconnect and idle-stop helpers next to this PR’s PMC preflight helpers. The merge keeps both. The preflight still runs before the new disconnect path. The five driver and test files have the same added and removed lines as before. The only follow-up is a PMC stub for the external-idle host fixture.

The DCP host suite passed 118 cases on the merge, and all seven external-idle cases passed after adding the stub, including the six negative controls. The merge preview is clean on main 9e6409d78d9d. The arm64 build is pending in CI.

The earlier J773g DPMS and s2idle result still covers the PMC change on its tested base. Committed external deep sleep now uses #3822’s path, so the J713/PMC-active T6050 receipts need to identify a build with both changes.

@RyanTheTide

Copy link
Copy Markdown
Contributor

J713 (MacBook Air 13" M4, T8132), macOS/system firmware 27.2: PASS, internal panel only, at exact head a601a4f903c0

  • Kernel: 7.3.0-mrp3300 built from the PR head a601a4f903c0 (merge base with main 35bfbf3875a7), with no other patches. It boots with its own t8132-j713.dtb through a one-shot aura-try (aura main 70d844e3, U-Boot 5c0d5fe1). The saved default was not changed. boot_id b1f1bd43-776a-49d3-bfa6-db1ea7949807. The default cmdline has mem_sleep = s2idle [deep].

  • Attached hardware: the internal eDP panel, USB-C/USB4 tether partners (3), Wi-Fi. No external monitor is attached to the J713 (DP-1..DP-4 all show disconnected), so the 4 external DPMS cycles could not be run. Only the internal half was done.

  • Boot: dcp_bound 3/3, eDP connected, Wi-Fi up. The only kernel err lines are the same two DCP lines the fleet94 baseline has (AFK[ep:20] init props -2, unsupported DFB layout ... compression=3). There are no PMC preflight/check/on errors and no "did not power"/"left up"/failed-start lines. 0 DART faults.

  • Internal DPMS (Mutter PowerSaveMode 3 then 0): 4/4 cycles reached Off then On. The connector came back enabled. 0 PMC or DART errors after each cycle.

  • s2idle (rtcwake -d rtc1 -m freeze -s 20, rtc1 = apple-pmu-rtc): success +1, fail +0, rc 0. The panel came back On.

  • Committed deep suspend (rtcwake -d rtc1 -m mem -s 20, mem_sleep=deep): success +1, fail +0, rc 0, last_failed_dev empty, resume devices took 0.323 s, "physical sleep completed". Panel, Wi-Fi and DCPs were back afterwards.

  • PMC interface state (/sys/kernel/debug/apple-pmc/382800000.power-management/status):

    • before, with the panel off: bwr 0x0, boost 0x0 (saved 0x1)
    • after DPMS on: bwr 0x0, boost 0x1 (saved 0x1)
    • after s2idle: same
    • after deep: same

    Rails 0x9/0x9 stayed unchanged throughout. genpd showed disp_sys/fe/cpu and pmc-dispext{0,1}-interface on in every snapshot. For comparison, the same Mac on fleet94 reads bwr 0x18 and boost 0x7 (the pre-PR state, with no consumer toggling).

  • Also run in the same boot: vkcube 300 frames PASS. One failed unit (speakerguardd-v2-switchtest.service), which appears on every trial boot of this Mac and also on the PCI: apple: set the T8132 ports up again after a deep sleep (J773g wake reset) #4176 row.

Afterwards the Mac went back to the production default (fleet94, Enforcing).

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 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 a601a4f

Checked: The power-off path darkens the display DART and lowers FE/CPU before disabling the PMC interface. It keeps SYS up on a PMC error and still checks CPU-off. Power-on raises SYS and restores PMC before touching FE/CPU. An exact-function host check passed normal sequencing, failed PMC restore with FE/CPU held off, and failed PMC-off plus CPU timeout latching out a restart. The forward merge keeps PMC preflight ahead of the external disconnect. The final stub is confined to the external-idle host fixture, which passed. The exact J713 receipt covers four internal DPMS cycles, s2idle and committed deep sleep. Apple build, host tests and PMGR KUnit are green. The display KUnit job is still running.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Local checks for a601a4f903c0 merged with main 536a613c0abe (tree ea864020257a).

  • python3 -I scripts/ci/apple-kunit.py plan selected clpc dcp-fabric dcp-topology dcp-display and pmgr-pwrstate. Hosted pmgr-pwrstate passed at this head.
  • ARM64 kunit.py build used the four hosted fragments together with Clang 23.1.3. The build passed, with the CLPC, DCP fabric, and DCP S2R/PMC suites linked in vmlinux.
  • UML kunit.py run --arch=um --jobs=8 passed 128/128 for DCP fabric and standalone topology. The optional PMC UML run could not exercise its fixtures: UML rejected accesses to the memory-backed fake registers with Invalid readl. The same error reproduced on main 536a613c0abe in apple_pmc_test_dcs_floor. The full CLPC and display KUnit runtime coverage still comes from the arm64 job.
  • Clang host runner (tools/asahi/run-host-tests.py --jobs 4 --only <name>) passed clpc 9/9, dcp-s2r-ext-idle 7/7, and apple-dcp 101/101.
Commands
python3 tools/testing/kunit/kunit.py build --arch=arm64 --jobs=8 \
  --make_options LLVM=1 --make_options 'CC=ccache clang' \
  --make_options "BINDGEN=$bindgen" --build_dir="$arm64_out" \
  --kunitconfig=drivers/soc/apple/clpc.kunitconfig \
  --kunitconfig=drivers/gpu/drm/apple/tests/.kunitconfig \
  --kunitconfig=drivers/gpu/drm/apple/tests/topology.kunitconfig \
  --kunitconfig=drivers/gpu/drm/apple/tests/display.kunitconfig
python3 tools/testing/kunit/kunit.py run --arch=um --jobs=8 \
  --build_dir="$uml_out" --kunitconfig="$dcp_uml"
python3 tools/testing/kunit/kunit.py run --arch=um --jobs=8 \
  --build_dir="$uml_out" --kunitconfig="$dcp_uml" \
  --kunitconfig="$pmc_uml" 'apple-pmc*'
# Repeat on main with filter apple-pmc.apple_pmc_test_dcs_floor.
for suite in clpc dcp-s2r-ext-idle apple-dcp; do
  CC=clang HOSTCC=clang python3 tools/asahi/run-host-tests.py --jobs 4 --only "$suite"
done

$dcp_uml selects KUNIT, KUNIT_UML_PCI, DRM, DRM_APPLE_FABRIC_KUNIT_TEST, DRM_APPLE_KUNIT_TEST, OF, and OF_OVERLAY.
$pmc_uml adds COMPILE_TEST, PM, APPLE_PMC, and APPLE_PMC_KUNIT_TEST.

Tested on J713 at the same head: 4/4 internal DPMS cycles, s2idle, and committed deep suspend passed. External DPMS remains open.

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

Verdict: MERGE at a601a4f903c0b8792ebee4a9b0ceddeea016d0a7

Blockers: none (once KUnit finishes green)

Checked:

  • Reviewed drivers/pmdomain/apple/pmc.c & KUnit test: apple_pmc_interface_consumer_set(dom, true) rolls back boost_enable on a bwr_enable write failure, and apple_pmc_interface_consumer_state() cleanly distinguishes off (-EALREADY) from split/dirty hardware state (-EIO) when consumer_off is set.
  • Reviewed drivers/gpu/drm/apple/dcp.c (dcp_s2r_pmc_preflight, dcp_s2r_domains_off, dcp_s2r_domains_on, dcp_s2r_domains_on_rollback, dcp_s2r_start_stuck):
    • Preflight runs before firmware stop on both internal and external suspend paths.
    • Power-off polls DISP_FE off before disabling the PMC interface and never lowers DISP_SYS unless the PMC interface is confirmed off or absent; partial failures keep DISP_SYS up, track s2r_pmc_restore, and mark s2r_start_stuck if DISP_CPU fails to power off.
    • Power-on polls DISP_SYS on before re-enabling the PMC interface, unwinds cleanly via dcp_s2r_domains_on_rollback() on a DISP_CPU bring-up failure, and latches s2r_start_stuck if rollback leaves domains up.
  • Reviewed the head commit a601a4f903c0 (tools/asahi/dcp-s2r-ext-idle-tests.py): clean 1-line stub for dcp_s2r_pmc_preflight() matching the external idle fixture's other dependency stubs.
  • Checked CI (apple-build, host-tests, KUnit pmgr-pwrstate, readiness, pr-text all green) and Ryan's exact-head J713 internal-panel DPMS + s2idle + deep-sleep PASS receipt.

@DjDeveloperr
DjDeveloperr merged commit 33be24a into main Dec 3, 2026
15 checks passed
@DjDeveloperr
DjDeveloperr deleted the feat/dcp-s2r-pmc-interface branch December 3, 2026 16:49
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) area:power Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (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.

4 participants