Repository navigation
drm/apple: stop the M4 MacBook Air's internal DCP firmware on macOS 27.2 (DPMS off, deep sleep; replaces #2660) - #2819
RyanTheTide wants to merge 8 commits into
Conversation
A DCP whose device tree names its display power words but not its DART streams stops the streams its DARTs have enabled before its first power-down and enables them again at power-up. Let it read them: the first 32 streams of a T8110 DART, read while its domain is up. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…ry hw.s2r SoC The system-sleep stop ran with an active panel only where the power words are measured, or on the J813, so another SoC's internal DCP stayed running into a deep sleep unless DPMS had turned its panel off first, and the sleep was refused. A derived layout only survives probe with appledrm.s2r_untested set, which already decides it: drop the board check. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
… power words from the device tree The M4 MacBook Air's internal DCP runs the firmware-27 backend on macOS 27.2 but has no firmware stop, so a deep sleep is refused with the processor still running, and DPMS off only darkens the backlight. Give it the hw.s2r stop the T8142 runs on 27.2: set_power_state(0), D572, the AP link's release (A550 in the 27.2 table), RTKit idle and the CPU stop, then the DCP DART's streams. It has no secure mailbox. Its power words are not a per-SoC table: a hw.s2r DCP without a layout in its hw data takes them from its device tree, the ones its deep sleep lowers. DISP_CPU is the first state of its power-domains, DISP_FE that state's parent and DISP_SYS theirs; the retention words are DISP_CPU's apple,retention-workaround, of which only the masked bits are written, the off value at power-off and the value read at probe at power-on; pmc-dcp counts it where the display-power node has that word; and the DART streams are the ones its DARTs have enabled before the first stop. Without those properties the firmware keeps running, as before. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The T8132's words are T8140's: pmc-dcp, the power manager's power states and its power gate block. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Name the power manager blocks the internal DCP's firmware-27 stop writes, the ones the deep sleep lowers (pmc-dcp, the power states and the power gate block), and the DCP DART's clock-protection slice (42 in the ADT's dart-dcp) as its gapf word: the stop clears it after the DART's power-down flush so that DISP_CPU's power state can be written. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
… probe, and only all of them Review points on the device-tree power layout: - Its DART streams were read at the first stop, with dcp_streams == 0 standing for "not read yet". A first read of 0 would have had later stops and power-ons read the DART again, maybe with DISP_CPU still lowered, and the restart would enable no streams. Now the streams are read once at probe, with the firmware running. A DCP DART that reads none refuses the layout, and the firmware keeps running as with no power words. - apple_dart_enabled_streams() read only the first enable word. If a stream above 31 is enabled, the 32-bit mask can't describe the DART, so it now reads every word up to num_streams, warns once, and reports 0 in that case. - Comments still described the stop as behind appledrm.s2r_untested or J813-only. The device tree's words stop the firmware by default; only a SoC whose static words are merely derived (T8142) needs the parameter. The same holds for the layout added in "drm/apple: dcp: stop a DCP for a deep sleep with its panel lit on every hw.s2r SoC", whose message says otherwise. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…and check power word alignment A DCP with a piodma child restores the display DART's streams at power-on from the layout. If that DART is not found, or reads no streams (none enabled, or streams above 31 that the 32-bit mask cannot describe), the layout kept disp_streams = 0 and power-on would have enabled none. Refuse the layout then, like a DCP DART that reads none: the firmware keeps running. The DISP_CPU/FE/SYS offsets are checked against the "ps" block without underflowing on a block shorter than a word, and must be word aligned like the retention offsets. The overview comment named the old first-stop stream read; point it at dcp_s2r_layout_streams(). Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial pre-PR checklist review (§1–§6) at verified live head 888805b87936b04d41f3fcea35beade5f84f6f26: 0 code blockers in these 7 commits, but not ready for APPROVE / MERGETRAIN-LINUX4 yet due to base stack state, 0 CI runs, and pending rebased-head hardware rows.
Verification Against #2660
- Confirmed patch-identical replay of
#2660(dde724cb..48789bf2vsa912b89b..888805b8: 0 code/text diffs, hunk line offsets only). Both priorCHANGES_REQUESTEDfixes from#2660(dcp_s2r_layout_streams()fail-closedpiodmaDART handling anddcp_s2r_layout_from_dt()non-underflowing bounds + 4-byte alignment checks) are preserved.
Checklist Audit (§1–§6)
- §1 (No model gating): Pass. Power words (
DISP_CPU/DISP_FE/DISP_SYSviapower-domainschain, retention registers/masks/off-values viaps_disp_cpu'sapple,retention-workaround, optionalpmc-dcp) and enabled DART streams (apple_dart_enabled_streams()) are derived from DT and hardware state rather than a per-SoC table. Drops theof_machine_is_compatible("apple,j813")board check indcp_platform_suspend(). J715 stays fail-safe without the new DT nodes until qualified. - §2 (Production-ready, no hacks): Pass. Default kernel command line; no new cmdline or module parameters.
- §3 (Safety / DCP stop, handoff, suspend & non-M4-Air impact): Pass.
- DT register math checks out against
t8132.dtsi,t8132-pmgr.dtsi, andt8132-j713-pmgr.dtsi(dcp_powerps/pwrgate/pmc-dcpcover0x240,0x248,0x10000, retention0x2504c/0x25070, anddcp_dartgapf0x38079cb80=ps_prot+0x100+42 * 0x40, matchingapple,dart.yaml). dcp_s2r_layout_from_dt()puts alldevice_noderefs on every path, validatesat > gate_res.start(guaranteeingret_ff != 0), bounds, alignment, and mask containment, and fails closed cleanly.dcp_s2r_layout_streams()runs insidedcp_comp_bind()afterdcp_create_piodma_iommu_dev(), so bothdcp_dartanddisp0_dartare bound and powered when read; any missing DART,0stream mask, or enabled stream >= 32 fails closed (-ENODEV/-ENODATA) and leaves the firmware running.dcp_s2r_ret_write()preserves exact whole-word writes (3/0off,0/1on) whenmask == 0(T8140/T8142 static layouts) and masked RMW for DT-derived layouts, so non-M4-Air SoCs are unaffected.- (Minor non-blocking note)
apple_dart_enabled_streams()readsdart->regswithoutpm_runtime_resume_and_get(dev)(safe here becauseps_disp_cpuis firmware-owned and active at bind, matchingapple_dart_display_streams(), but worth noting if ever reused on a runtime-suspended DART).
- DT register math checks out against
- §4 (Clean-room & attribution): Pass. All 7 commits carry human author/committer (
Ryan Murray) and humanSigned-off-by:with zero AI trailers; PR body includesAssisted-by:. - §5 (Hardware evidence): Prior
#2660(48789bf2) rows are strong: J713 A/B 10/10 DPMS off/on + 10/10 lit-panel RTC deep sleeps (0 DART faults, 0 oops, 0 failed units, 0 AVC), plus Neo (T8140) DPMS smoke 10/10 + 1/1 RTC deep sleep (0 errors, 0 failed units, 0 AVC — note the PR body's "Still to run" still lists the Neo smoke even though it already passed on#2660). Still pending on this rebased PR: the queued J713 one-shot row on888805b8over currentintegration/aurora, and J713 lid wake. - §6 (Naming): Pass.
Remaining Before APPROVE / Merge
- Base stack & CI: Currently stacked on unmerged Draft
#2818(j713-disp3/dcp272-internal, which is itself stacked on Draft#2541) with 0 CI checks executed on888805b8. Needs#2541->#2818landed, retargeted ontointegration/aurora, and green CI (dt-checks,host-tests). - Remaining §5 rows: Post the queued J713 one-shot row for this rebased head on
integration/aurora(with full regression counts) and the J713 lid-wake row.
Assisted-by: LLM (Gemini 4 Neon)
|
Review at 888805b.
|
|
J713 row (M4 MacBook Air, macOS 27.2 stub), one-shot boot of integration/aurora f1d5b24 merged with this stack (#2819 head 888805b on #2818 a912b89). Default kernel command line, unchanged Stage 2:
|
Take #2818's review fixes (runtime-PM read order, t8132_dcp_v27 naming, refusal message, dcp.c comment order) under this stack. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Review at 7a0110d. The only change since 888805b is a merge of #2818's review fixes (c9f24a4..df2748e: the DART TCR read before the PM put, the refused-DART naming and messages, the J773g comment). The seven stack commits are unchanged. The merged delta looks fine to me and belongs to #2818's review. None of the six points from my review at 888805b has been answered yet. I checked each at this head:
New: against integration/aurora the branch now conflicts in Verdict: CHANGES (1 and 5 are the substantive ones; 2-4 are small). Rows above are for RyanTheTide/lab (J713, Neo, J813). The lid-wake row needs someone at the Air. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Pre-PR Checklist Re-Review (§1–§6) — 7a0110dc1cf070fdecf56d278dbef73674bcc4de
The only change since 888805b8 is merge commit 7a0110dc bringing in Draft #2818's review fixes (df2748e9); all 7 stack commits are unchanged. Fresh adversarial audit against pmgr-pwrstate.c and the T8132 DTs confirms concrete architecture and §1 blockers that must be addressed before APPROVE / MERGETRAIN-LINUX4:
Blockers
- Bypassing
apple-pmgr-pwrstatelock &consumer_offstate machine (drivers/gpu/drm/apple/dcp.c:121-196,9124-9216, §2/§3):t8132-j713-pmgr.dtsi(&ps_disp_sys,&ps_disp_fe,&ps_disp_cpu) already marks this domain chainapple,firmware-owned+apple,consumer-switched(withapple,retention-workaroundon&ps_disp_cpu), anddrivers/pmdomain/apple/pmgr-pwrstate.calready implementsapple_pmgr_ps_consumer_off()/apple_pmgr_ps_consumer_on()underps->genpd.slockwithconsumer_off/consumer_failedtracking, per-domain ACK waits, and power-off-time retention save/restore with readback verification.- Instead of using (or extending, if v27 ordering differs)
apple_pmgr_ps_consumer_*(),dcp_s2r_domains_off()/_on()ioremaps raw PMGRps/pwrgateMMIO through a parallelapple,t8132-display-powernode outsidepmgr-pwrstate's lock and state tracking, and restores retention registers from a probe-time snapshot. Please driveDISP_CPU/DISP_FE/DISP_SYSthrough the PMGR consumer API or document concretely in code and commit message why it cannot be used.
- SoC-level DT nodes placed in the J713 board file (
arch/arm64/boot/dts/apple/t8132-j713.dts:46-66, §1):dcp_power: display-power@3828a9c14,&dcp_dartgapf(0x38079cb80), and&dcp { apple,display-power = <&dcp_power>; }are T8132 SoC addresses, not J713-specific. With#2818making the 27.2 internal DCP path board-independent, keeping these int8132-j713.dtsleaves other T8132 laptops (e.g., J715) without display power words and silently keeps their firmware running. Move these SoC descriptions tot8132-dcp.dtsi/t8132.dtsi(ort8132-j713-j715.dtsiif laptop-scoped).
- Unmerged Draft base stack, 0 CI runs, and owed §5 hardware rows:
- Base branch is still unmerged Draft
#2818(j713-disp3/dcp272-internal, itself stacked on Draft#2541) with 0 CI checks executed on7a0110dc. Needs#2541->#2818landed, retargeted ontointegration/aurora(resolving any conflicts cleanly), and green CI (dt-checks,host-tests). - The J713 tip row at
7a0110dc(#2818#issuecomment-7084588069: DPMS 3/3 + s2idle 2/2, 0 faults/oops/AVC/failed) is solid; still owed before merge are J713 DPMS x10 + lid wake at head, Neo (T8140) DPMS + s2idle smoke for the shareddcp_s2r_ret_write()path on this stack, and J813 s2idle no-regression.
- Base branch is still unmerged Draft
Smaller Fixes to Bundle
drivers/gpu/drm/apple/dcp.c:7383: update theapple_dcp_hw_t8132_v27comment —"Linux never starts its CPU"is no longer true once.s2r = truerestarts it after DPMS off / sleep.drivers/gpu/drm/apple/dcp.c:161:at <= gate_res.startexcludes offset 0 ofpwrgatebecausel->ret_ffdoubles as a truthy sentinel indcp_s2r_domains_off/on; use an explicit boolean or comment why offset 0 is reserved.- Commit
77e0841edropsof_machine_is_compatible("apple,j813")indcp_platform_suspend(), extendingappledrm.s2r_untested=1system-sleep stop to other T8142 boards (e.g., J815): either provide a J815 row or state in the commit message that this reach is intended.
Passing Checks
- §4 (Clean-room & attribution): Pass. All 8 commits carry human author/committer (
Ryan Murray) and humanSigned-off-by:with zero AI trailers; PR body carriesAssisted-by:. - §6 (Naming): Pass.
Assisted-by: LLM (Gemini 4 Neon)
Problem
#2660 (stop the M4 MacBook Air's internal DCP firmware on macOS 27.2, for DPMS off and deep sleep) is stacked on #2590, which can no longer be merged (its base #2541 was rebased onto integration). #2590 is replaced by #2818.
Change
The same 7 commits as #2660 at 48789bf, replayed without conflicts onto 2818 (
git range-diffshows all 7=). This replaces #2660. Nothing changes in what they do:apple,retention-workaround, pmc-dcp, the DART streams its DARTs have enabled), not a per-SoC table. Without those properties the firmware keeps running, as before.apple_dart_enabled_streams().hw.s2ralone (no J813 check).apple,t8132-display-power; J713 DT: the display-power node,apple,display-poweron the DCP, and the DCP DART's clock-protection slice.No kernel or module parameter is involved.
Testing
Earlier rows on #2660's commits (unchanged here) are on #2660: DPMS off/on 10/10 with the power words read back, and 10/10 lit-panel deep sleeps with RTC wake on the fleet80c cut, A/B against the same cut without 48789bf.
Still to run
Update: #2818's review fixes are merged into this branch (7a0110d, a merge, no rewrite). J713 row of integration 120d6aa + this head: DPMS off/on 3/3 with the same DISP_CPU/FE/SYS power words, s2idle 2/2 with the panel bound, 0 DART faults/oops/AVC/failed (details in #2818 (comment)). The lid-wake row still needs someone at the Air.
Reviewer / agent detail
git range-diff dde724cb..48789bf2 a912b89b..888805b8: 7 of 7=).traces/display/20261123-j713-disp3/in the lab store.Assisted-by: LLM (Claude:Opus 5.5)