Repository navigation
drm/apple: dcp: stop a T8132 firmware-27.2 external DCP for a deep sleep - #2721
RyanTheTide wants to merge 3 commits into
Conversation
On 27.2 the M4 MacBook Air's DCPEXTs are handed over running, and nothing stopped their firmware for a deep sleep: the sleep powered them off with it, and their resume talked to a dead firmware until the watchdog reset the machine. Give them the external DCP stop and start that already exists (A550, RTKit idle, CPU stop, DART streams, then the domains), with the power words taken from the device tree the way the internal DCP's are: the DISPEXTn CPU/FE/SYS states from its power-domains chain, the retention words from the CPU domain's apple,retention-workaround, and the shared pmc-dcp count. An external DCP with such a layout takes the layout's power sequence rather than the fixed DISPEXT0 one, and needs no lab parameter. On the J713 both DCPEXTs point at the internal DCP's display-power node. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Blockers: 1.
The rest looks right:
Rows still needed: a Neo deep sleep with the dock/DP monitor on the fixed head (no regression), plus the J713 deep x3 on the merged candidate. |
…e has no power words Deriving an external DCP's power words from the device tree cleared hw.s2r_ext whenever that failed. The MacBook Neo's (T8140) external DCP has s2r_ext and apple,display-power but no apple,retention-workaround on its DISPEXT0 CPU state, so it lost the fixed DISPEXT0 stop it uses for a deep sleep and went to sleep with its firmware running. Keep s2r_ext when the device tree has no layout. A firmware-27 external DCP without one is still not dcp_s2r_ext_capable() unless the lab parameter is set, so it refuses the deep sleep as before. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial review at aed223c40c20964a866a5f34498c7673b05c3363.
Commit/DCO, clean-room compliance, DT layout validation in dcp_s2r_layout_from_dt(), and removing the s2r_untested requirement for validated DT layouts on the default cmdline look good. However, there are three code blockers that must be fixed before merge:
Blockers
-
Regresses T8140 (MacBook Neo) external-display deep sleep (
drivers/gpu/drm/apple/dcp.c:410-418,8685-8692,9874-9886):
dcp_s2r_check_dt()derives a DT layout for every DCP withhw.s2r_ext && !hw.s2r_layoutand setsdcp->hw.s2r_ext = falseif derivation fails (dcp.c:416).apple_dcp_hw_t8140_external(dcp.c:9874-9886) has.s2r_ext = trueand.s2r_layout = NULL, withapple,display-power = <&dcp_power>(arch/arm64/boot/dts/apple/t8140-j700-dcpext.dtsi:27), but itsps_dispext0_cpu(arch/arm64/boot/dts/apple/t8140-pmgr.dtsi:204-212) has noapple,retention-workaround.dcp_s2r_layout_from_dt()returns-EINVAL(dcp.c:342-344), clearinghw.s2r_extand disabling Neo's working fixed DISPEXT0 (0x328) stop (dcp.c:8691).#2710only refusesDCP_FIRMWARE_V_27_0, so Neo silently loses its H17P external-display stop.- Important when fixing: If you leave
hw.s2r_extset whendcp_s2r_layout_from_dt()fails, also tightendcp_s2r_ext_capable()(dcp.c:8687-8690) forDCP_FIRMWARE_V_27_0to requiredcp->s2r_dt_layout_ok || (dcp->hw.s2r_layout && s2r_untested). Otherwise, booting aV_27_0DCPEXT without a valid DT layout underappledrm.s2r_untested=1would makedcp_s2r_ext_capable()returntruewhiledcp_s2r_ext_by_layout()isfalse, sending it down T8140's hardcoded0x328/0x320/0x288sequence!
- Important when fixing: If you leave
-
Refused deep sleep on J713 faults in
dcp_s2r_ext_cycle()becausedcpext0_dart/dcpext1_dartnever release their clock-protection slices (drivers/gpu/drm/apple/dcp.c:9229-9255,8975,drivers/iommu/apple-dart.c:5661,7722,7754,arch/arm64/boot/dts/apple/t8132-j713.dts:289-303):
On a real deep sleep,linux#2722(sleep_display_off()) clearsPS_PROT_SLICE_ONon slices 5 and 30 before loweringDISPEXT0_CPU/DISPEXT1_CPU. However, when a deep sleep is refused afterdcp_s2r_ext_suspend()has already stoppeddcpext0/dcpext1(e.g., a later device refuses.suspend(),pm_test, ordcp_s2r_restart_failed_stop()),dcp_s2r_resume()->dcp_s2r_restart(dcp, false)->dcp_s2r_ext_cycle()callsapple_dart_gapf_ready(dcp->s2r_dcp_dart)(dcp.c:9236) and thendcp_s2r_ext_domains_off()->dcp_s2r_domains_off()(dcp.c:8975), writingDISPEXTn_CPU(0x1e8/0x4f0).- In
arch/arm64/boot/dts/apple/t8132-j713.dts:289-303,dcpext0_dartanddcpext1_dartonly carryapple,clock-protection = <&ps_prot 5/30>(nogapfreg, unlike&dcp_dartat lines 212-216), anddrivers/iommu/apple-dart.c:5661only parsesapple,clock-protectionwhenj713_displayis true (notj713_dcpext). - Thus
dart->gapfisNULLondcpext0_dart/dcpext1_dart, makingapple_dart_gapf_release()(apple-dart.c:7722) andapple_dart_gapf_ready()(apple-dart.c:7754) silent no-ops. WritingDISPEXTn_CPUindcp_s2r_domains_off()while slice 5/30 still hasPS_PROT_SLICE_ONset will fault (the same fault#2722fixes insleep.c), andapple_dart_gapf_protect()also never re-protects slices 5/30 after wake. - Fix: wire
dcpext0_dart/dcpext1_dartto release and re-protect their clock-protection slice (viagapfreg orapple,clock-protectionsupport inapple_dart_gapf_*), and verify a refused deep sleep (pm_test=devices/platform) on J713.
- In
-
dcp_s2r_ext_domains_off()skipsapple_dart_power_dark(dcp->s2r_disp_dart, true)on the layout path (drivers/gpu/drm/apple/dcp.c:9157-9174vs9137-9138):
Returningdcp_s2r_domains_off(dcp)immediately atdcp.c:9157-9158bypassesapple_dart_power_dark(dcp->s2r_disp_dart, true)(dcp.c:9173-9174), whiledcp_s2r_ext_start(dcp, true)(dcp.c:9137-9138) still unconditionally callsapple_dart_power_dark(dcp->s2r_disp_dart, false). Duringdcp_s2r_ext_cycle()'s 1000 ms power-off hold (dcp.c:9248-9251),dispextN_dartis powered down withoutdisplay_darkset, exposing concurrent IOMMU maps/unmaps to powered-off DART registers. Marks2r_disp_dartdark before callingdcp_s2r_domains_off(dcp)on the layout path as well.
Minor notes & merge gates
drivers/gpu/drm/apple/dcp.c:7218-7219: update the stale"No sleep support"comment aboveapple_dcp_hw_t8132_dcpext_v27.- No CI has run on this head (stacked base
j713-s2r/dcpext-pr-base). Retarget tointegration/auroraonce dependencies land, and post: (a) Neo deep-sleep regression row with external display, (b) J713 refused-sleep row (pm_test), and (c) J713 deep x3 on the tip-merged head with 0 AVC, 0 failed units, and 0 new kernel errors.
Assisted-by: LLM (Google:Gemini 4 Neon)
|
Pushed 597f023 for the blocker above, as one commit with no force push. When the device tree has no power words, the driver now logs that at debug level and keeps
W=1 |
…p stop Three gaps in the DCPEXT deep-sleep stop, found in review: - A firmware-27 DCPEXT is capable of the stop only with a power layout, the device tree's or a static one under the lab parameter. Without one, the lab parameter alone would send it down the fixed DISPEXT0 sequence, which is not its own. - A refused sleep powers a stopped DCPEXT off and on again (dcp_s2r_ext_cycle()). On the layout path its display DART was left powered on in the driver's view while its domains were off; mark it dark first, as the fixed sequence does. - On the J713 the DCPEXT DARTs had no GAPF slice to release, so the power-off on a refused sleep wrote DISPEXTn_CPU with its clock protection still on. Give dcpext0/1_dart their slices (5 and 30, at PS_PROT + 0x100 + 0x40 * n), as the internal DCP's DART has slice 42. Also describe the J713 DCPEXT's sleep in its hw data. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Thanks. All three blockers are fixed at 8d7df23, which sits on 597f023; it is one new commit, with no force push.
I also replaced the stale "No sleep support" comment. J713 hardware row (X2): the lab kernel carries exactly this content, on the stock fleet cmdline, with the MSI monitor on DP-2.
Still owed: a Neo deep sleep with the dock or DP monitor on this head. It needs the Neo, and I'll request it through its queue. |
|
Relation to #2200 (keep an external display across a deep sleep on T8132): the two don't overlap at runtime, and they merge without conflicts on integration/aurora cacf355 (#2200 first, then this).
J713 rows on 27.2 with this head: t5 = integration + #2692 + this @ 8d7df23, deep 3/3 (rtc 20 s) with the MSI monitor on USB-C plus a USB4 peer. Both DCPEXTs stopped and restarted warm, and DP-2 came back at 2560x1440 each time. No crash on restart with the display attached. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR re-review at verified live head 8d7df2306d93b688d97986ef0a91bf1a026d76e6 (vs integration/aurora 70a00e583b03).
Resolved from prior review (aed223c40c20)
- Neo (T8140) regression & V_27_0 guard (
597f023d,8d7df230): Fixed —dcp_s2r_check_dt()preserveshw.s2r_extwhen no DT layout is present (keeping Neo's H17P fixed DISPEXT0 path), anddcp_s2r_ext_capable()requiresdcp->s2r_dt_layout_ok || (dcp->hw.s2r_layout && s2r_untested)onDCP_FIRMWARE_V_27_0so a layout-less V_27_0 DCPEXT can never fall through to T8140's hardcoded offsets even withappledrm.s2r_untested=1. - Clock-protection GAPF slices (
8d7df230): Fixed — verifieddcpext0_dart(reg = <0x2 0x86340000 ...>, <0x3 0x8079c240 0x0 0x4>, slice 5 =0x38079c000 + 0x100 + 5*0x40) anddcpext1_dart(reg = <0x4 0x8a340000 ...>, <0x3 0x8079c880 0x0 0x4>, slice 30 =0x38079c000 + 0x100 + 30*0x40) matcht8132-dcpext.dtsiandapple,dart.yaml, and J713pm_test=devices/platformrefused-sleep rows pass with GAPF release/restore and DP-2 recovery. - Display DART dark on layout path (
8d7df230) & stale comment: Fixed (see rebase note below regarding48b7191062ea). - §1–§4 & §6 naming: Pass — DT-derived power layout, default cmdline, human author/committer +
Signed-off-by:only across all 3 commits, zero AI commit trailers.
Remaining blockers
- Non-integration target branch & unmerged dependencies: PR targets
j713-s2r/dcpext-pr-baserather thanintegration/aurora. Its stacked prerequisites are still unmerged (#2660was closed and replaced by#2819, which is open on#2818;#2710is also still open). Please rebase and retarget ontointegration/auroraonce the dependency stack lands. - No live CI runs: Zero check runs (
host-tests/dt-checks) have executed on8d7df2306d93due to the non-integration base branch. Both checks must run and pass onintegration/aurora. - §5 Evidence incomplete:
- MacBook Neo (T8140) regression row still owed: Deep sleep with an external display/dock on this head confirming
597f023dpreserves Neo's H17P DISPEXT0 stop without regression. - Full §5 regression line on J713: X2/t5 rows confirmed
0 DART faults, 0 WARN, 0 oopsacross 3/3 deep sleep andpm_testrefused sleep, but have not yet reported the full §5 regression line (0 SELinux denials, 0 failed units, 0 new kernel errors) on the finalintegration/aurora-based head.
- MacBook Neo (T8140) regression row still owed: Deep sleep with an external display/dock on this head confirming
Rebase / minor notes (non-blocking until rebase)
- Interaction with
48b7191062ea(#2962, now onintegration/aurora):dcp_s2r_domains_off()on liveintegration/auroranow callsapple_dart_power_dark(dcp->s2r_disp_dart, true)itself afterdcp_s2r_map_power()succeeds. When rebasing ontointegration/aurora, please drop the now-redundant pre-map call indcp_s2r_ext_domains_off()(dcp.c:9167-9168), which would otherwise leaves2r_disp_dartmarked dark ifdcp_s2r_map_power()fails. - Minor comment wording (
drivers/gpu/drm/apple/dcp.c:412-413):"a firmware-27 one is then not dcp_s2r_ext_capable() without the lab parameter"— after8d7df230, a firmware-27 DCPEXT with neither DT nor static layout is refused even withs2r_untestedset.
Assisted-by: LLM (Gemini 4 Neon)
Problem. On macOS 27.2 firmware the M4 MacBook Air (J713) hands its two DCPEXTs over running. Nothing stopped their firmware for a deep sleep. The sleep powered them off anyway, and on resume the driver talked to a dead firmware until the watchdog reset the machine. This happened on every deep sleep with the external-display handover, with or without a monitor. #2710 refuses that sleep as a stopgap.
Change. The DCPEXTs on 27.2 (
apple_dcp_hw_t8132_dcpext_v27) now use the external-DCP sleep stop and start that already exists: A550, RTKit idle, CPU stop and DART streams on the way down; domains, warm restart and route unpark on the way up. Their power words come from the device tree, the same way as the internal DCP's (#2660):power-domainschain;apple,retention-workaround;pmc-dcpcount.An external DCP with such a layout uses the layout's power sequence instead of the fixed DISPEXT0 one, and needs no lab parameter. On the J713 both DCPEXTs point at the internal DCP's display-power node. There is no new module parameter and no chip or board check. Once this is in, #2710's refusal no longer fires on the J713, because it applies only without
hw.s2r_ext.Testing. On the J713 (macOS 27.2 firmware), with the external-display handover and an MSI monitor on USB-C, deep sleep passed 3 out of 3. Before this change, the same setup hung on every deep sleep. Each cycle was
rtcwake -m memon the PMU RTC for 30 s, with return code 0 and suspend_stats 3/0. In every cycle both DCPEXTs stopped their firmware for the sleep and came back after the wake. The monitor was connected and lit after each one (2560x1440@280 with DSC). There were no DART faults and no warnings. The Air was booted with the stock cmdline. The kernel was the tested lab tree, which carries the same change; the only difference is that it keys the CPU retention on the olderdcp->dcpextflag, where this tree uses #2710'shw.external_processor. On this base,dcp.oandt8132-j713.dtbbuild with W=1 and no new warnings.Still to run. Lid wake (needs Ryan at the Air); unplug and replug of the monitor during sleep.
Reviewer details
j713-s2r/dcpext-pr-base; the DT-derived power layout comes from drm/apple: stop the M4 MacBook Air's internal DCP firmware on macOS 27.2 (DPMS off, deep sleep) #2660). Retarget once both land.dcp_s2r_check_dt()now derives the DT layout forhw.s2r_extas well. If derivation fails it clearss2r_ext, so drm/apple: dcp: refuse a deep sleep for a firmware-27 external display processor without a stop #2710's refusal applies instead.dcp_s2r_ext_capable()on V_27_0 accepts a DT layout withoutappledrm.s2r_untested. T8142's static table keeps the lab gate.dcp_s2r_ext_domains_on/off()anddcp_s2r_ext_cpu_on()take the layout path (dcp_s2r_domains_on/off) for any external DCP with a layout, not only T8142. The external CPU gets PS_MIN 4 on power-up, as on J813.DART streams for the stop: DCP 0x800000, display 0x10001, thenfirmware stopped for sleep: control 0x0 status 0x6e. After the wake,dcp_hotplug() connected:1 valid_mode:1 nr_modes:38.link fault 22and 1xlink fault 24. They do not appear at boot. The link comes up every time.dcp->external, which is set only for T6030.