Repository navigation
drm: apple: t8132: keep an external display across a deep sleep - #2200
Conversation
5924bd0 to
0184115
Compare
|
Thanks for this; the 7/7 and 6/6 sleep runs with both ports in use are convincing. One small point. We select protocol-level behaviour for every device that speaks the protocol, not for the chip where it was seen. In Could you drop the |
0184115 to
3e2fe31
Compare
|
Done in 3e2fe31: the No firmware gets that error for a rate 0 today, so none can rely on it: the T8132 ATC PHY is the only PHY driver that returns -EOPNOTSUPP for one. The others:
So on the M1 Pro, M2, M4 Pro and A18 Pro the firmware gets the same answers as before, and the no-regression rows there would confirm it. On T8132 the change is a no-op, so the Air runs stand. Host tests (full run): 425/425 on each commit. |
|
Thanks for 3e2fe31 and for the per-PHY survey of what a rate-0 request returns; that makes the no-op on the other machines easy to follow. This reads right to us. |
A dcpext's firmware sets its link rate to 0 when its HPD goes low, from within the set_hpd(0) call. In DP alt mode the rate goes to the ATC PHY, whose configure may refuse it (-EOPNOTSUPP) once the PHY has left DP mode, as the T8132 ATC PHY does when the display is released for a deep sleep. The refusal goes back to the firmware, which then waits on its own call and answers nothing else: the set_hpd(0) and the release_display after it time out, and the next connect does too. A link going down on a PHY that is out of DP mode is down already: answer the rate 0 as done, whichever DCP asks. No other PHY driver refuses a rate 0 with -EOPNOTSUPP: they take the link down, or fail with another error that goes back as before. Signed-off-by: Bartosz Nitka <niteria@gmail.com>
A deep sleep powers a T8132 dcpext down whole (iomfb_m4_ext_stop()), and its firmware starts again from reset after it. Firmware that starts with its DPTX port still connected brings the link up on hardware the sleep reset, and crashes (an SError) with any display attached. So in its deep-sleep suspend, before A500 while its firmware still runs, the display is released as an unplug releases it (HPD low, then dcp_dptx_disconnect()) and its crossbar output is parked. The cable stays connected: after the restart the route is unparked and the type-C work connects the display again, as for a plug. A suspend that fails after the release connects it again at once. A release call that timed out is never answered by the firmware that starts from reset: it is dropped once the firmware is stopped, so that the connect after the wake does not wait for it. DRM does not see that release and reconnect. From the release until the replay of its state at PM_POST_SUSPEND, the connector is held: it stays connected, its modes are those of the link it had (the link's capacity is kept at the release; its rate is 0 meanwhile), and its hotplugs wait. Only an output that took the hold at PM_SUSPEND_PREPARE is held, as its PM_POST_SUSPEND is what ends the hold. The replays wait for their displays to be connected again (each one's D575 and its sink's timing catalog), together and 3 s at most, before any takes the modeset locks, so that each modeset finds its link up. A display unplugged during the sleep ends its wait as soon as that is known (no cable at the reconnect, or the type-C unplug after it). When the replay is done (for an output that was not replayed, when the wait is over), the hotplug held meanwhile goes out. The release's own HPD low and rate 0 are among the hotplugs held, so one goes out after every such sleep, and the compositor finds what the sleep changed: a display gone, also one whose CRTC was off, or a new link or sink. A replay that fails sets the link status BAD and sends the hotplug as well. Signed-off-by: Bartosz Nitka <niteria@gmail.com>
3e2fe31 to
118b39f
Compare
RyanTheTide
left a comment
There was a problem hiding this comment.
Sorry for the long gap. My earlier comment said this read right, but nobody followed it up with a verdict, and that's on us.
Re-checked at 118b39f:
- Against the head I read on 11-19 (3e2fe31), the trees are identical. The update only drops the trailers.
- It still merges cleanly onto current integration/aurora, and also onto the open 27.2 external-DCP sleep work (#2710 / #2721). Those act on a different backend: everything here sits under
iomfb_is_m4()(fw_compat == DCP_FIRMWARE_M4), while a firmware-27.2 dcpext runs the v27 method table. So the two neither duplicate nor collide. This covers T8132 dcpexts on the M4 firmware backend, and #2721 covers 27.2. - Selection is by the block (
apple,t8132-dcpext) and the sleep target, with no board or firmware-version check. The rate-0-EOPNOTSUPPanswer applies to any DCP, and only the T8132 ATC PHY returns it. - The held-hotplug design, the single 3 s deadline across replays, and dropping a timed-out release call over the stop are each backed by a forced-case row.
APPROVE at 118b39f.
Assisted-by: LLM (Claude:Opus 5.5)
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial review of head 118b39f5f79a000a601f813d0135d794ab7ae0b8 (base integration/aurora, MERGEABLE/CLEAN, Host tests/host-tests green).
Findings
- Correctness & concurrency:
drivers/gpu/drm/apple/dptxep.c:690-691: treating-EOPNOTSUPPonphy_link_rate == 0as success prevents firmware deadlock when the ATC PHY has already left DP alt mode during HPD teardown; applies generically to all DCPs without any SoC/board/fw gate, and the per-PHY survey confirms no other PHY driver returns-EOPNOTSUPPfor rate 0.drivers/gpu/drm/apple/dcp.c:9256-9305,9350-9362,9468-9473:dcp_t8132_sleep_release()/dcp_t8132_sleep_reconnect()/dcp_t8132_sleep_stopped()sit strictly insideiomfb_is_m4(dcp)anddcp_is_t8132_ext(dcp)forPM_SUSPEND_MEM, cleanly isolated from the internal panel, s2idle, other SoCs, and firmware-27.2 T8132 dcpexts. Failediomfb_m4_suspend()immediately reconnects; stopped firmware drops timed-out release orphans (afk_compact_orphans_drop()+t8132_release_late = false) so post-wake connect does not stall 15 s.drivers/gpu/drm/apple/iomfb_m4.c&drivers/gpu/drm/apple/t8132_ext_drm.c: connector hold (ext_relink,ext_hold_capacity,hotplug_held) is taken only whent8132_ext_sleep_prepare()claims ownership (ext_relink_owned), released on every exit path oft8132_ext_sleep_restore()/t8132_ext_sleep_end()/t8132_ext_drm_fini(), and waits across all outputs against a single wrap-safe 3 s deadline while ending immediately on unplug (ext_relink_lostsynchronized underhpd_mutex) or session error.dcp_m4_ext_sink_gone()retainsext_modesacross the hold so probes during sleep do not drop modes.
- No model/board/firmware gating (§1) & production readiness (§2): No board or firmware-version checks, no cmdline/module params, no sleeps over races.
- Attribution & clean-room (§4): Both commits (
85a32f2c969e,118b39f5f79a) carry solely human author/committer andSigned-off-by: Bartosz Nitka <niteria@gmail.com>with no agent trailers; PR body carriesAssisted-by: LLM (Claude:Opus 5.5). - Hardware evidence (§5): Extensive J713 M4 Air deep-sleep runs (5/5 crash repro before; 7/7 + 6/6 deep sleeps across both ports, greeter and Hyprland, unplug during sleep for both active and DPMS-off outputs, plus forced-case verification for orphan drop, single 3 s deadline, unowned hold, and unplug).
118b39f5is a trailer-only update of3e2fe315, whose only code difference from the tested tree (droppingdcp_is_t8132_ext()on the rate-0-EOPNOTSUPPcheck) is a no-op on T8132.
Approving at 118b39f5f79a.
Assisted-by: LLM (Google:Gemini 4 Neon)
b8c5bb0
into
aurora-silicon:integration/aurora
Deep sleep with an external display attached crashes the M4 (T8132) external DCP on its restart after the wake, and the display stays dark until a reboot. This keeps the display across the sleep: it is released before the DCP powers down and connected again after, with the DRM connector held meanwhile so the compositor sees no unplug.
The crash
A deep sleep stops a dcpext and powers it down whole (eb34e77); its firmware starts from reset after the wake. With its DPTX port still connected and a display attached (4K@30 or 1080p@60, USB-C to HDMI, either port), the restarted firmware crashes at once: RTKit "co-processor has crashed", an SError with the async error at 0x286100688 every time. The enable then fails with -67, DPTX calls time out, and a replug doesn't bring the display back. With nothing attached the restart is clean.
The change
The release is in the DCP's suspend, not the PM_SUSPEND_PREPARE notifier: there atcphy_suspend refuses the sleep with -EBUSY.
Tested
J713 (MacBook Air M4), integration/aurora a7dd26e + #2166 (EDID) + these commits as an out-of-tree appledrm.ko, dcpext handover (chosen.asahi,j713-dcpext=1, atcphy0/1 apple,dp-alt-mode), Aura b13.1, a Samsung 4K (3840x2160@30) and a 1080p display over USB-C to HDMI adapters, RTC wake (rtc1):
These runs had the rate-0 rule limited to T8132 dcpexts; on the Air that is the same as without the limit.
Based on cb57d4a, the integration/aurora merge before #2135, since with #2135 the M4 Air doesn't deep-sleep. It merges cleanly onto current integration/aurora and onto #2166, and doesn't depend on it.
Host tests (tools/asahi/run-host-tests.py, full run): 425/425 on each commit and on the base.
Assisted-by: LLM (Claude:Opus 5.5)