Repository navigation
drm/apple: stop the M4 MacBook Air's internal DCP firmware on macOS 27.2 (DPMS off, deep sleep) - #2660
drm/apple: stop the M4 MacBook Air's internal DCP firmware on macOS 27.2 (DPMS off, deep sleep)#2660RyanTheTide wants to merge 7 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>
|
Looks good; approve once the regression row below is in. What I checked at the head.
HW row: J713, 27.2 stub, default command line, this series on its own (without #2691/#2692): DPMS off/on x10 plus 10 RTC-wake deep sleeps with the panel lit. Pass: suspend_stats fail 0, eDP back after each wake, 0 DART faults, 0 AVC, 0 failed units, 0 new kernel errors. Then the lid-wake row from "Still to run". Assisted-by: LLM (Claude:Opus 5.5) |
|
No blockers. The two points from the last review are still open at 2218023. First, the comments at t8132-j713.dts:197 and dcp.c:297, :582 and :7412-7413, and the d81cf76 commit message, still describe the stop as behind appledrm.s2r_untested or J813-only, but for the DT-derived T8132 layout it runs by default. Second, apple_dart_enabled_streams() (apple-dart.c:7768-7774) reads only the first enable word, so streams at 32 or above are silently dropped. Please read every word up to num_streams, or warn and refuse. Also, dcp_s2r_find_darts() (dcp.c:8428) uses dcp_streams == 0 as its "not read yet" flag. A first read of 0 would make dcp_dpms_power_on(), the prewarm work and dark_finish read the DCP DART while DISP_CPU is still lowered, and the restart would enable no streams. A separate flag, plus refusing the DT layout when the DCP DART reads 0, closes that. The new gapf reg on dcp_dart (0x38079cb80) is the same word as its |
… 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>
|
Both open points are addressed at 634fbb2, one commit on top with no force push.
The GAPF word appears twice, as you say: J715: it gets none of the new nodes, so its DCP keeps running into a sleep (fail-safe). I'll say so in the description; the nodes move to the shared dtsi once the J715 has a row. The regression row you asked for: J713 on the 27.2 stub, stock cmdline, this series alone at 634fbb2 without #2691/#2692, using production Stage 2 af341272 with this tree's DTB.
Evidence: traces/display/20261122-j713-2660-alone/ (README, summary2.txt). W=1 is clean for |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial Pre-PR Checklist Review (head 634fbb2d2029)
Requesting changes for two real code bugs in the DT power/DART layout helpers added by this PR.
Code Blockers
-
Incomplete fail-closed check in
dcp_s2r_layout_streams()(drivers/gpu/drm/apple/dcp.c:404-412):- Commit
634fbb2dproperly fails closed (return -ENODATA) whendcp_dartreturns0streams fromapple_dart_enabled_streams(), but does not fail closed when thepiodmachild node is present and its DART (disp_dart) is missing or returns0:piodma = of_get_child_by_name(dcp->dev->of_node, "piodma"); if (piodma) { dart = dcp_s2r_find_dart(piodma); of_node_put(piodma); if (dart) { dcp->s2r_dt_layout.disp_streams = apple_dart_enabled_streams(dart); put_device(dart); } }
- If
disp_darthas any stream >= 32 enabled (causingapple_dart_enabled_streams()to warn and return0, per its fail-closed contract) or isn't bound,dcp_s2r_layout_streams()silently succeeds withdisp_streams = 0. On power-on,dcp_s2r_dart_power()then callsapple_dart_display_streams(dcp->s2r_disp_dart, 0, true, false), writing0toDART_T8110_ENABLE_STREAMSand leaving display streams disabled. - When
piodmaexists, requiredart != NULLanddcp->s2r_dt_layout.disp_streams != 0, returning-ENODEV/-ENODATAotherwise so the DT layout fails closed cleanly.
- Commit
-
Unsigned underflow and missing alignment check in
dcp_s2r_layout_from_dt()(drivers/gpu/drm/apple/dcp.c:339-341):off[i] > resource_size(&ps_res) - 4underflows unsignedresource_size_tifresource_size(&ps_res) < 4, bypassing the upper-bound check, andoff[i] % 4is unchecked (unlike the retention offset checkat % 4at line 349).- Guard
resource_size(&ps_res) < 4 || off[i] > resource_size(&ps_res) - 4 || off[i] % 4.
Non-Blocking Nit
- Stale comment at
drivers/gpu/drm/apple/dcp.c:307-308: still states "The DART streams are the ones its DARTs have enabled at the first stop, see dcp_s2r_find_darts()", whereas634fbb2dmoved the read to probe (dcp_s2r_layout_streams()).
Other Checklist Notes (§1–§6, CI)
- §1 / §2 / §3 / §4 / §6: Good design deriving power/retention words and DART streams from DT/hardware rather than per-SoC tables, running on default cmdline, and keeping J715 fail-safe until qualified. All 6 commits carry human identity (
Ryan Murray) andSigned-off-by:with no agent trailers; PR body hasAssisted-by:. - CI / Base / §5: Stacked on unmerged
#2590(j713-disp2/dcp272-internal, which currently has conflicts against its base) with 0 CI checks run on this PR. J713 10/10 DPMS off/on on634fbb2dalone is clean; remaining §5 rows after fixing the bugs above and running CI are J713 lid wake and a Neo (T8140) DPMS smoke covering the shareddcp_s2r_ret_write()/ layout path.
Assisted-by: LLM (Gemini 4 Neon)
…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>
|
Both blockers are fixed in 48789bf: one commit on top of 634fbb2, no force push.
Host: drm/apple Row: J713 on the 27.2 stub with the stock command line. The kernel is the fleet80c default cut plus this commit, tested A/B against the same cut without it; the J713 DTB is identical, so only a grub one-shot was used.
The DPMS power words are identical on both kernels (off 0x0f000300 / 0x2300 / 0x300, on 0x1000030f / 0x23ff / 0x3ff). The J713 tree passes the stricter checks: there is no Still open from your list:
Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Re-review against pre-pr-checklist.md (§1–§6) at verified live head 48789bf2a42f41713426f702a902f7a8ec9f53de: 0 code or §1–§4/§6 blockers remain.
Prior CHANGES_REQUESTED Items — All Fixed Cleanly in 48789bf2
dcp_s2r_layout_streams()fail-closed handling (drivers/gpu/drm/apple/dcp.c:406-416): Fixed. When apiodmachild exists, a missing display DART returns-ENODEVand a0stream mask (including theapple_dart_enabled_streams()refusal on streams >= 32) returns-ENODATA, causingdcp_s2r_check_dt()to refuse the DT layout cleanly with no node/device ref leaks.- Offset underflow and alignment guard (
drivers/gpu/drm/apple/dcp.c:339-342): Fixed. Guardsresource_size(&ps_res) < 4 || off[i] > resource_size(&ps_res) - 4 || off[i] % 4. - Stale overview comment (
drivers/gpu/drm/apple/dcp.c:307-308): Fixed. Now points to probe-timedcp_s2r_layout_streams().
Checklist Summary (§1–§6)
- §1 / §2 / §3 / §4 / §6: Clean. Power/retention words and DART streams are derived from DT/hardware, default kernel command line is used, J715 stays fail-safe until qualified, all 7 commits carry human identity (
Ryan Murray) +Signed-off-by:with no agent trailers, and the PR body includesAssisted-by:. - §5 J713 A/B on
48789bf2: Strong — 10/10 DPMS off/on with identical power words and 10/10 lit-panel RTC deep sleeps (0 DART faults, 0 oops, 0 failed units, 0 AVC, layout accepted at probe).
Remaining Before APPROVE
- Base / CI: Still stacked on unmerged
#2590(j713-disp2/dcp272-internal, currently conflicting with its base) with 0 CI runs executed on48789bf2. Needs retargeting ontointegration/aurora(once#2590lands/rebases) with green CI (dt-checks,host-tests). - Remaining §5 HW rows:
- J713 lid wake (hands-on-lid row).
- Neo (T8140) DPMS smoke covering the shared
dcp_s2r_ret_write()path indcp_s2r_domains_off()/dcp_s2r_domains_on().
All code blockers from the prior CHANGES_REQUESTED review are resolved; happy to upgrade to APPROVE once CI and the remaining §5 rows are in.
Assisted-by: LLM (Gemini 4 Neon)
|
Neo (J700, T8140) DPMS smoke for 48789bf: PASS. This is the shared DT display-power layout path. Stock fleet cmdline, no appledrm params.
That leaves the J713 lid-wake row, which needs someone at the lid. It is armed and will be posted here when it runs. |
Problem
On macOS 27.2 the M4 MacBook Air's (J713) internal DCP runs the firmware-27 backend (#2590), but nothing stops its firmware on T8132. A deep sleep finds the display coprocessor still running and is refused, and DPMS off only turns the backlight down.
Change
apple,retention-workaround, writing only the masked bits (the off value at power-off, the value read at probe at power-on);Without those properties the firmware keeps running, as before. T8140 and T8142 keep their tables.
apple_dart_enabled_streams(), for the streams above.hw.s2ralready decides it, since a derived layout only survives probe when opted in (the same hunk as soc: apple: sleep, mfd: macsmc, drm/apple: Select the T8142 sleep paths by hardware, not J813 #2384).apple,t8132-display-power(T8140's layout).apple,display-poweron the DCP, and the DCP DART's clock-protection slice (ADT dart-dcp index 42) as itsgapfword. The stop releases it after the DART's power-down flush, so that DISP_CPU's power state can be written.Stacked on #2590.
Testing
Notes
-ENODEV/-ENODATA) instead of restoring 0 streams at power-on. The DISP_CPU/FE/SYS offsets can't underflow the "ps" size check and must be word aligned.apple_dart_enabled_streams()reads every enable word; the comments no longer describe the stop as behindappledrm.s2r_untested.Still to run
Where the words come from, and runtime reads
t8132_sleep_soc.ps.disp[0]lowers at every deep sleep.ps_disp_cpu'sapple,retention-workaround(pmgr 0x2504c / 0x25070) = pwrgate 0x104c / 0x1070, the pairt8132_sleep_soc.pwrgate_disp[0]writes. They read 0 / 1 while running.dcp_methods_27_2.Assisted-by: LLM (Claude:Opus 5.5)