Skip to content

drm/apple: dcp: refuse a deep sleep for a firmware-27 external display processor without a stop - #2710

Merged
RyanTheTide merged 4 commits into
j713-dcpext/air-dcpext-272from
airs-promote/dcpext-deep-refusal
Nov 26, 2026
Merged

RyanTheTide merged 4 commits into
j713-dcpext/air-dcpext-272from
airs-promote/dcpext-deep-refusal

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem. On the M4 MacBook Air (J713) running the macOS 27.2 firmware, a deep sleep with the 27.2 DCPEXTs bound (an external monitor on USB-C) wakes up and then stalls in device resume. After about 30 s the hardware watchdog resets the machine. The sleep engine stops the DCPEXT firmware cold, and the DCPEXT has no firmware stop or restart of its own on 27.2, so its resume ends up waiting on firmware that isn't running anymore. The same holds for any external display processor on firmware 27 that no stop path takes (for example the T8122 DCPEXT on 27.2, or a T8142 DCPEXT whose s2r_ext stop is not enabled).

Change. Every dcpext block's match data is marked external_processor. dcp_platform_suspend() refuses a deep (firmware) sleep with -EBUSY for any firmware-27 external processor once none of the stops before it returned: the T6050 firmware-27 sleep, the internal s2r stop and the external s2r_ext stop keep their deep sleep because they return first, not because they are on a list. Suspend-to-idle is unchanged. When a DCPEXT gets a working firmware stop (for the J713, the 27.2 DCPEXT stop in #2721, which passed deep 3/3 with a monitor), it takes that path and this refusal no longer fires for it.

Testing. J713, kernel 7.3.0-bj713b10+ (the J713 deep-sleep and s2idle series on top), stock command line, MSI monitor on DP-2:

  • Without any refusal, the first deep sleep hung twice, once on each Stage 2 aura head (watchdog reset each time). A refusal testing only dcp->external hung a third time, because the J713 DCPEXT never sets it.
  • The second commit (selection by the block's match data instead of two compatibles) compiles clean with W=1 on this base, and checkpatch is clean.

Still to run.

Details for reviewers
  • Where the stall happens: PMU scratch after the watchdog reset shows sleep-engine step 0x7e (.wake: back in Linux, before any device resumes), and per-display marker 0xc0 shows display 0 lowered fine. So the machine really did sleep and wake; the stall is in device resume.
  • Selection: external_processor is set in the hw data of every *-dcpext entry (t6020, t6030, t6041, t6050, t8122, t8132 incl. its 27.2 variant, t8140, t8142, and the generic apple,dcpext). The firmware-27 condition is the firmware ABI that has no stop of its own. No board, SoC or firmware-version gate is added.
  • Head 804dadd tested !hw.s2r_ext, which would have let a DCPEXT with s2r_ext set but its stop not enabled hang again; the second commit tests whether a stop actually ran.
  • The J713 dcpext is only bound when the boot loader hands it over on 27.2; without that handover there is no driver to refuse and deep sleep is unchanged.

…thout a stop

A deep sleep of an M4 MacBook Air with its 27.2 DCPEXTs bound woke and
then stalled in device resume until the watchdog reset the machine: the
sleep had stopped the DCPEXT firmware cold, and the DCPEXT, which has no
firmware stop or restart of its own on 27.2, resumed by talking to it.

Until it has one, refuse the deep sleep for such a DCP, as the other
paths here refuse what they cannot bring back. That is a firmware-27
external DCP without hw.s2r_ext: the T6030 dcpext (dcp->external) and
the T8132 DCPEXT that apple_t8132_dcpext_v27_2() admits, which runs the
firmware-27 external processor path but is not marked dcp->external.
DCPEXTs with their own sleep path (T6050's firmware-27 sleep, T8142's
s2r_ext) return before this. Suspend-to-idle keeps the firmware running
and is not affected.

Signed-off-by: Ryan Murray <[email protected]>
…processor without a stop

The refusal for a firmware-27 external display processor that has no
firmware stop picked its processors by two compatibles: the T6030 dcpext
(dcp->external) and the T8132 DCPEXT on 27.2. Every other external
processor on firmware 27 that no stop path takes, such as the T8122
DCPEXT on 27.2, a T6041 one with no stop of its own, or a T8142 DCPEXT
whose untested s2r_ext stop is not enabled, still let a deep sleep stop
its firmware cold and then hung in its resume.

Mark every dcpext block's match data as an external processor and
refuse the deep sleep for any of them on firmware 27 once none of the
stops above returned: the T6050 firmware-27 sleep, the internal s2r
stop and the external s2r_ext stop keep their machines' deep sleep
because they return first, not because they are left off a list.
Suspend-to-idle keeps the firmware running and is not affected.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide RyanTheTide changed the title drm/apple: dcp: refuse a deep sleep for a firmware-27 external DCP without a stop drm/apple: dcp: refuse a deep sleep for a firmware-27 external display processor without a stop Nov 21, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Host-test result at bdb97ea: tools/asahi/run-host-tests.py --only apple-dcp fails on this head (88/89): resource-profile no longer compiles, host.c:933: field designator 'external_processor' does not refer to any field in type 'const struct apple_dcp_hw_data'. The unit's copy of struct apple_dcp_hw_data (or its extraction) needs the new field from this commit.

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

Adversarial review at bdb97ea67283f71a1f850d1653e7800cb5e9197f.

Block-selection check: Clean. All 10 *-dcpext apple_dcp_hw_data definitions set .external_processor = true, no internal DCP sets it, and dcp_platform_suspend() (drivers/gpu/drm/apple/dcp.c:9655-9659) refuses deep sleep (pm_suspend_via_firmware()) for any dcp->hw.external_processor && dcp->fw_compat == DCP_FIRMWARE_V_27_0 that fell through past every working stop (dcp_v27_sleep_selected, dcp_s2r_capable, dcp_s2r_ext_capable). No chip, board, or firmware-version gates are added, and s2idle is unaffected. Commits/DCO and clean-room rules are clean.

Blocker

  1. Breaks apple-dcp resource-profile host test (tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py:1226-1233):
    Adding .external_processor = true to apple_dcp_hw_t8140_external (drivers/gpu/drm/apple/dcp.c:9875) breaks compilation of the resource-profile host test, which extracts apple_dcp_hw_t8140_external verbatim from dcp.c (lifecycle.py:1178-1181) against its own stub struct apple_dcp_hw_data (lifecycle.py:1226-1233) that does not declare bool external_processor;. Add external_processor to the stub and confirm tools/asahi/run-host-tests.py --only apple-dcp passes cleanly.

Cleanup & merge gates

  • Squash commits: Commit 1 (804dadd2) temporarily introduces the compatible-list check and !hw.s2r_ext condition that commit 2 (bdb97ea6) immediately replaces. Please squash into one clean commit so the history doesn't carry the rejected compatible-gated intermediate state.
  • CI & hardware evidence: No CI has run because the base branch is j713-dcpext/air-dcpext-272 rather than integration/aurora. Retarget to integration/aurora (once base lands) for full CI, and post the open tip-based rows (J713 deep refusal x3 + s2idle x3, J615 + #2704, M2/M5 regression with 0 AVC, 0 failed units, 0 new kernel errors).

…flag

The resource-profile host test compiles dcp.c's hardware tables against
a cut-down struct apple_dcp_hw_data. The dcpext tables now set
external_processor, so the stub needs the field or the test fails to
build. No change to the driver.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

b0865dc adds the external_processor field to the stub struct apple_dcp_hw_data in the apple-dcp lifecycle selftest, the build failure from the review. With it, run-host-tests.py --only apple-dcp passes at this head (previously 92/93, resource-profile did not compile). It changes nothing in the driver.

Still open: squashing the first two commits (the first calls apple_t8132_dcpext_v27_2() and does not build without #2673), and the deep-refusal rows. On integration/aurora at daa9e2d the base (#2673) has not landed; the two driver commits apply there once the hunk for the #2673-only T8132 27.2 table is dropped. On that tip the refusal covers the T8122 dcpext on 27.2 (since #2704), not only the J713 case.

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

Re-review at b0865dc2e72b against the pre-PR checklist (§1–§6) and live integration/aurora (70a00e583b03): selftest blocker resolved, but 3 merge blockers remain (base branch & missing CI, unsquashed intermediate commits, missing exact-head §5 evidence).

Resolved

  • tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py:1232 now declares external_processor in the stub struct apple_dcp_hw_data, fixing the resource-profile host-test build failure.
  • Final tree diff is functionally clean: all 10 *-dcpext / *_external apple_dcp_hw_data entries set .external_processor = true, no internal DCP sets it, and dcp_platform_suspend() refuses deep sleep with -EBUSY for any firmware-27 external processor that fell through past every working stop (s2idle unaffected). Not superseded on integration/aurora.
  • §4 attribution: Clean — all 3 commits carry human author/committer (Ryan Murray) + human Signed-off-by: only, zero AI trailers in commits, disclosure in PR body.

Remaining Blockers

  1. §6 / Target branch & live CI (0 check runs): The PR still targets feature branch j713-dcpext/air-dcpext-272 (#2673, still OPEN) instead of integration/aurora, so no CI check runs have executed on b0865dc2e72b. Rebase/retarget onto integration/aurora (dropping the #2673-only apple_dcp_hw_t8132_dcpext_v27 hunk if landing ahead of #2673 for T8122 #2704, or once #2673 lands) so full CI runs and passes.
  2. §1 / Commit hygiene (unsquashed broken/gated intermediate commits): Commit 1 (804dadd2) still carries the rejected compatible/SoC-gated intermediate check (dcp->external || apple_t8132_dcpext_v27_2(dev->of_node)) and !dcp->hw.s2r_ext test that commit 2 (bdb97ea6) immediately replaces, and commit 2 breaks the apple-dcp selftest until commit 3 (b0865dc2). Squash into a single clean, bisectable commit.
  3. §5 (Exact-head hardware & regression evidence): No hardware run has been posted at bdb97ea6 or b0865dc2. Please post the open tip-based rows listed in the PR (J713 deep refusal x3 + s2idle x3 with monitor, J615 + merged #2704 deep refusal + s2idle, and regression on a Mac without a firmware-27 dcpext / M5 showing 0 SELinux denials, 0 failed units, 0 new kernel errors).

@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Merge readiness at 1f51a954: ready to merge

Check Detail
CI at head ok no CI for this change (the hardware row is the gate)
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok comment at 1f51a954
Conflicts ok none
PR text adopt when you next edit add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: area:display
Merge: gh pr merge 2710 --merge (Owners and Core through the bypass: add --admin).

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

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

Verdict: FINISH, then merge at b0865dc2e72b: the code is ready; it needs only a row at this head.

Blockers: none in the code. Missing row: one J713 run at the head with an external display on the firmware-27 dcpext: a deep sleep is refused with the log line, and without a display it sleeps as before. It's stacked on #2673, so it merges after #2673; once retargeted to main, CI runs.

Checked: no Apple material. In the final tree the refusal is keyed on the external DCP's firmware-27 state, not on a compatible, and lifecycle.py covers it. This replaces my earlier review. Commit 1's intermediate check, which commit 2 replaces, only affects bisecting. Squashing them would be tidier, but it isn't a blocker.

Evidence

Read 804dadd2, bdb97ea6 and the final diff.

@DjDeveloperr
DjDeveloperr dismissed stale reviews from themself November 24, 2026 19:50

Superseded by the review at b0865dc

@github-actions github-actions Bot removed changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 24, 2026
…promote/dcpext-deep-refusal

#2673 now sits on #2819 + the #2818 review fix. The only conflict was
the T8132 hw data in dcp.c: the internal table keeps #2819's sleep stop,
and the firmware-27 T8132 dcpext table gets this branch's
external_processor flag.

Signed-off-by: Ryan Murray <[email protected]>
RyanTheTide added a commit that referenced this pull request Nov 25, 2026
) into j713-s2r/dcpext-s2r-ext-pr

The base moves from the #2660 stack to #2819 (which replaced #2660) and
the reworked #2673. For the internal DCP #2819's version wins: its
stop and start, its power words and the DART stream reads at probe.
From this branch the external DCP stop stays as it was: s2r_ext, the
layout power sequence, the dark display DART, the CPU retain, the J713
dcpext GAPF slices and apple,display-power on dcpext0/1.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Fast-forward to 1f51a95: merges the rebuilt #2673 (now on #2819). The only conflict was the T8132 hw data in dcp.c. external_processor is now on the single firmware-27 T8132 dcpext table, and the internal table keeps #2819's stop. Host tests: dcp 37/37. Row: J713 11-25 on main + #2541 + #2434 + #2818/#2819 + #2673 + #2710 + #2721, PASS (details in #2673).

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Nov 25, 2026
@RyanTheTide
RyanTheTide merged commit c5fea43 into j713-dcpext/air-dcpext-272 Nov 26, 2026
2 checks passed
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) needs-template PR body lacks Tested or Risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants