Skip to content

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

Open
erikwb wants to merge 9 commits into
mainfrom
feat/dcp-s2r-pmc-interface
Open

erikwb wants to merge 9 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), keep dpms_powered_off armed until restart succeeds, drain both display and DCP DARTs before lowering domains, and roll back or latch s2r_start_stuck cleanly on failed power-ons (bde2a1d9743f..241b8646ccdf); stacked on #3297 (retarget to main after #3297 merges).
Tested: At head 241b8646ccdf: LLVM=1 W=1 arm64 build clean (drivers/gpu/drm/apple/dcp.o: 0 errors, 0 warnings), full linux-j713 arm64 kernel/DTB/modules build clean (7.3.0+), arm64 QEMU KUnit display.kunitconfig (197 passed, 1 skipped, including apple-dcp-s2r-pmc 17/17) and topology.kunitconfig (210 passed, 1 skipped, 0 failed), tools/asahi/run-host-tests.py (837/838 passed; apple-dcp 84/99 ok with the 15 pre-existing unrelated TAP failures), checkpatch.pl --strict --git 0378182e01b8..HEAD 0 errors (1 pre-existing MAINTAINERS new-file warning on 4b09f0691c2d), and git merge-tree --write-tree clean against both #3297 (0378182e01b8, 4e4e63426117) and origin/main (dadc9aae8eed); J713 (M4 MacBook Air, T8132, 27.2 firmware, default command line) at the exact head: 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.
Risk: two-way door · Apple SoCs using direct-MMIO display-domain S2R/DPMS power-gating (dcp_s2r_domains_{off,on}()).
Not yet: exact-head J713 hardware exercise of the external-pipe consumer chain and of the power-on rollback / display DART drain unwind paths (needs a tree carrying the dock-display stack, and a failing power-on, which the lab does not produce on demand); 26.6.2 external iomfb_m4.c (requires a 26.6.2-firmware M4; lab J713 runs 27.2); external non-lab Macs.

Details
  • Stacking & base merge: Stacked on #3297 (feat/apple-pmc-consumer-interface-chain). 6cdd799aca96 merged 006f20f150fe from #3297 (bringing in #3307 from main and resolving the dcp.c merge conflicts). Both #3297 (0378182e01b8) and origin/main now merge cleanly with 241b8646ccdf. Retarget to main once #3297 lands.
  • 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 (b43e08447acd, 241b8646ccdf): 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 (marking the DCP crashed if rollback fails).
  • Partial-transition recovery & CONFIG_APPLE_PMC=n fallback: If apple_pmc_interface_consumer_off() fails after lowering DISP_CPU/DISP_FE, checks and restores PMC on -EALREADY while preserving s2r_pmc_off = true if restoration fails. Treats -ENODEV (and -EOPNOTSUPP with no configured DT PMC interface) as an absent optional interface.
  • Revert: git revert -m 1 <merge-commit> on the target branch; kernel driver and KUnit changes only.
Evidence
  • Exact-head J713 row (241b8646ccdf, composite with #3297 0378182e01b8): J713 (M4 MacBook Air, T8132, 27.2 firmware, default command line) at the exact head: 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.
  • Local checks at head 241b8646ccdf:
    • ./scripts/checkpatch.pl --strict --git 0378182e01b8..HEAD: 0 errors (0/0/0 on 6a84c1d95460, 597803b9d48b, bde2a1d9743f, b43e08447acd, f29b4f2d9f48, 241b8646ccdf; 1 pre-existing MAINTAINERS new-file warning on 4b09f0691c2d for dcp_s2r_pmc_test.c); git diff --check clean.
    • make ARCH=arm64 LLVM=1 W=1 drivers/gpu/drm/apple/dcp.o: 0 errors, 0 warnings.
    • Full linux-j713 arm64 kernel + DTBs + modules build: exit 0 (7.3.0+).
    • ./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/gpu/drm/apple/tests/display.kunitconfig: Ran 198 tests: passed: 197, skipped: 1 (apple-dcp-s2r-pmc 17/17 passed, covering DPMS retry, D572 timeout, display DART drain, s2r_start_stuck, prewarm unwind, and CPU timeout rollback; 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/topology.kunitconfig: Ran 211 tests: passed: 210, skipped: 1 (1 skipped apple_g17_rx_util_min_test, needs CONFIG_UCLAMP_TASK).
    • python3 tools/asahi/run-host-tests.py: 837/838 passed (apple-dcp 84/99 ok with the 15 pre-existing unrelated TAP failures).
    • git merge-tree --write-tree origin/feat/apple-pmc-consumer-interface-chain HEAD: clean (4e4e63426117d3bc062210e81e215450e73980b1); git merge-tree --write-tree origin/main HEAD: clean (dadc9aae8eeda8ee0fe2fbbddb6e0bd1abb6e1ce).
  • Combined-build hardware results at ancestor 4b09f0691c2d (prior to 597803b9d48b..241b8646ccdf 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 <[email protected]>
@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 241b8646: not ready yet

Check Detail
CI at head ok 3 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 241b8646
Conflicts ok none
PR text ok Risk: two-way · Apple SoCs using direct-MMIO display-domain S2R/DPMS power-gating (dcps2rdomains{off,on}()).

Areas: area:display

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 <[email protected]>
@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 <[email protected]>
@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.

@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 597803b9

Blockers:

  • Base branch & main conflict: Still targets open non-main base branch feat/apple-pmc-consumer-interface-chain (#3297), and conflicts with origin/main in drivers/gpu/drm/apple/dcp.c (due to merged #3307); retarget to main and resolve the conflict once #3297 lands.
  • Full CI & exact-head J713 hardware row: Full hosted CI (apple-build, kunit, host-tests) has not run against main, and the J713 (27.2) hardware rerun is still owed once #3297 lands and #3307 is merged (as noted in **Not yet:**).

Checked:

  • Audited commit 597803b9 (drivers/gpu/drm/apple/dcp.c, drivers/gpu/drm/apple/dcp-internal.h, drivers/gpu/drm/apple/dcp_s2r_pmc_test.c); zero code blockers found.
  • Confirmed dcp_s2r_display_on() now sets ret = -ETIMEDOUT when wait_for_completion_timeout(&dcp->s2r_dart_done, ...) expires with !completion_done(&dcp->s2r_dart_done), ensuring dcp_s2r_unwind_failed_start() stops the coprocessor/domains/PMC interface and leaves dpms_powered_off and s2r_fw_down armed for retry on the next unblank.
  • Confirmed routing the KUnit display_on hook through dcp_s2r_power() only intercepts on == true, preserving dcp_s2r_power(dcp, false, ...), and the new dcp_s2r_pmc_dpms_retry_after_d572_timeout test covers timeout unwind and second-unblank recovery (5/5 apple-dcp-s2r-pmc, 172 display KUnit, 208 topology KUnit).
  • Confirmed the PR description clearly labels the three prior 4b09f0691c2d runs as combined-build ancestor results and documents **Revert:**.
Evidence
  • drivers/gpu/drm/apple/dcp.c: dcp_s2r_d572_timeout_ms() overrides the timeout only under CONFIG_DRM_APPLE_DISPLAY_KUNIT_TEST when s2r_test_ops->d572_timeout_ms is non-zero; dcp_s2r_display_on() checks !wait_for_completion_timeout(...) && !completion_done(&dcp->s2r_dart_done) and sets ret = -ETIMEDOUT before falling through to out: unwind.
  • drivers/gpu/drm/apple/dcp_s2r_pmc_test.c: dcp_s2r_pmc_dpms_retry_after_d572_timeout verifies s2r_active == false, dpms_powered_off == true, s2r_fw_down == true, s2r_pmc_off == true, s2r_domains_up == false, crashed == true, presentation_paused == true, and PS regs off after timeout, followed by clean recovery on second dcp_dpms_power_on().

@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 — merge of #3297 clean, awaiting #3297 merge, retarget to main, full CI, and J713 rerun at 379d97e8fb8c

Blockers:

  1. Still targets open non-main base branch feat/apple-pmc-consumer-interface-chain (#3297); once #3297 merges to main, retarget this PR to main (and resolve the #3307 conflict in dcp.c).
  2. Full hosted CI (apple-build, kunit, host-tests) against main and the exact-head J713 (27.2) hardware rerun remain open once #3297 lands.

Checked:

  • Merge 379d97e8fb8c pulls #3297's 2617735d5df6 updates cleanly into #3300 with no unintended changes to drivers/gpu/drm/apple/dcp.c, dcp-internal.h, or dcp_s2r_pmc_test.c (MERGEABLE on feat/apple-pmc-consumer-interface-chain).
Evidence
  • Verified delta 597803b9d48b...379d97e8fb8c contains only the #3297 pmgr-pwrstate commits; #3300's own dcp.c / KUnit diff is unchanged from 597803b9d48b.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) merge-conflict Conflicts with the base branch (bot) and removed ci-failing A check failed at the PR head (bot) needs-hw-row No hardware row at the PR head (bot) labels Nov 29, 2026
…e-chain' into feat/dcp-s2r-pmc-interface

Conflicts:
	drivers/gpu/drm/apple/dcp.c

dcp_s2r_display_on(): keep the base's D572 handling (s2r_dart_err,
dcp_s2r_dart_end() before the completion check) and this branch's
unwind: a set_power_state(1) failure, a D572 timeout and a DART stream
error all end in dcp_s2r_unwind_failed_start().

dcp_s2r_prewarm_work(): use dcp_s2r_unwind_failed_start(), which now
follows the base's rule: the domains are powered off only once the
display DART streams have stopped; a failed stop, or a failed power-off,
marks the DCP crashed and leaves them up.

dcp_s2r_domains_off(): keep only the base's s2r_domains_up clear, after
the display DART has gone dark, not this branch's earlier one.

The KUnit fixture initializes s2r_dart_lock and channels_idle_wq, which
the base now uses, and stops the streams through a new stop_streams
test hook, and turns the mailbox off through another; new cases check
that a failed stream stop leaves the domains and the PMC interface up,
and that the resume's start marks the DCP crashed when its unwind cannot
stop the streams or lower the domains.

Signed-off-by: Erik Bourget <[email protected]>
D572 can turn the display DART's streams on before set_power_state(1)
times out, or before another step of the start fails. Where that DART
is not stopped with the DCP's (s2r_disp_dart_with_dcp unset),
dcp_s2r_stop_streams() leaves it to the firmware's next D572, and the
unwind has stopped that firmware: the domains would then go down under
a DART still streaming, and power_dark() leaves the stream enables as
they are.

Drain the display DART first in dcp_s2r_unwind_failed_start(), then the
DCP's, and lower the domains only after both drains succeed; a failed
drain marks the DCP crashed and leaves them up.

Signed-off-by: Erik Bourget <[email protected]>
When DISP_CPU does not report power-on, dcp_s2r_domains_on() returns
with SYS, FE, the PMC word and the PMC interface it raised still up, but
without setting s2r_domains_up, so dcp_s2r_unwind_failed_start() returns
at once and nothing lowers them.

Lower them again on that timeout, in dcp_s2r_domains_off()'s order: the
PMC word, CPU and FE, then the PMC interface this power-on raised, then
SYS. If the interface does not go off, leave SYS up and mark the DCP
crashed.

Signed-off-by: Erik Bourget <[email protected]>
When a failed start's unwind cannot drain the DARTs or lower the
domains, it leaves them up and the DCP crashed, but both DPMS retry
flags stay armed: the next unblank clears crashed and powers on and
boots again over domains in that state.

Remember that state and keep it: dcp_s2r_warm_restart() refuses to run,
and the unwind does not touch those domains again, until the driver is
bound again.

Signed-off-by: Erik Bourget <[email protected]>
The rollback of a power-on whose CPU never came up lowered SYS whenever
this power-on had not raised the PMC interface itself, even with that
interface already on, which dcp_s2r_domains_off() never does. It also
never checked that the CPU went off.

Lower SYS only with the interface off or absent, and poll DISP_CPU off
as dcp_s2r_domains_off() does; otherwise the rollback fails and the DCP
is marked crashed.

Signed-off-by: Erik Bourget <[email protected]>
@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed merge-conflict Conflicts with the base branch (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: HOLD at 241b8646

Blockers:

  • Non-main base branch (feat/apple-pmc-consumer-interface-chain): Full main build/KUnit/host-tests CI has not run on the combined tree. Once the parent branch lands on main, please retarget this PR to main, run full hosted CI, and post an exact-head hardware row covering the power-on rollback path.

Checked:

  • Audited commit 241b8646 (drm/apple: dcp: keep SYS up under a PMC interface in a power-on rollback, MERGEABLE into feat/apple-pmc-consumer-interface-chain): resolves the previous merge conflict and ensures power-on rollback only lowers SYS when the PMC interface is off/absent while polling DISP_CPU off (marking the DCP crashed if rollback fails).
Evidence
  • Head commit: 241b8646ccdfbf9934640fd9766f70351da9ab5c (MERGEABLE into feat/apple-pmc-consumer-interface-chain).
  • CI snapshot: 2P/0F/0Q on feature-branch base.

@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 241b8646ccdf

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: - Audited commit 241b8646 (drm/apple: dcp: keep SYS up under a PMC interface in a power-on rollback, MERGEABLE into feat/apple-pmc-consumer-interface-chain): resolves the previous merge conflict and ensures power-on rollback only lowers SYS when the PMC interface is off/absent while polling DISP_CPU off (marking the DCP crashed if rollback fails).

Follow-ups (not blocking): Merge parent branch first; follow-ups: retarget, full CI, power-on rollback row

@erikwb

erikwb commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Verified head 241b8646ccdf locally (6cdd799aca96 through 241b8646ccdf, including the #3307 merge resolution, display DART drain unwind, s2r_start_stuck latch, and dcp_s2r_domains_on_rollback()):

  • LLVM=1 W=1 arm64 build (drivers/gpu/drm/apple/dcp.o): 0 errors, 0 warnings; full linux-j713 arm64 kernel + DTBs + modules build clean (7.3.0+).
  • display.kunitconfig on arm64 QEMU: 197 passed, 1 skipped (apple_g17_rx_util_min_test, needs CONFIG_UCLAMP_TASK), 0 failed, including apple-dcp-s2r-pmc 17/17 passed.
  • topology.kunitconfig on arm64 QEMU: 210 passed, 1 skipped (apple_g17_rx_util_min_test), 0 failed.
  • tools/asahi/run-host-tests.py: 837/838 passed (apple-dcp 84/99 ok with the 15 pre-existing unrelated TAP failures).
  • git merge-tree --write-tree is clean against both #3297 (0378182e01b8, 4e4e63426117) and origin/main (dadc9aae8eed).

Exact-head hardware row on J713 (M4 MacBook Air, T8132, 27.2 firmware) at 241b8646ccdf, built together with #3297 0378182e01b8 on main 429e7e15f122, default command line: boots clean (0 failed units, 0 AppArmor denials), 4 + 4 internal-panel DPMS off/on cycles before and after a 20 s s2idle and a 25 s deep suspend/resume (both suspend_stats fail 0, no reset). That row covers the direct display-domain S2R path; the external display processors did not probe in that build (main lacks the dock-display stack, which conflicts with these PRs), and the rollback / DART drain unwind paths are failure paths that the lab does not produce, so they are covered by KUnit only.

@github-actions github-actions Bot removed the needs-hw-row No hardware row 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.

drivers/gpu/drm/apple/dcp.c:10822–10825 leaves s2r_domains_up clear after a failed power-on rollback and sets only crashed. The next dcp_s2r_warm_restart() at :11133–11150 checks s2r_start_stuck, then clears crashed with dcp_s2r_forget_crash() and retries over the partially powered domains. Please latch the same terminal state used by the failed-start unwind, and extend the rollback test to check that a second restart is refused.

@github-actions github-actions Bot added the changes-requested A reviewer requested changes (bot) label Dec 1, 2026
Base automatically changed from feat/apple-pmc-consumer-interface-chain to main December 1, 2026 14:52

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) changes-requested A reviewer requested changes (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.

2 participants