Repository navigation
drm/apple: serialize HDMI suspend release under fabric lock - #3214
AxxzyWasTaken wants to merge 1 commit into
Conversation
dcp_platform_suspend() checked dcp->active_typec_route without dcp_typec_fabric_lock, treated negative gpiod_get_value_cansleep() errors (<= 0) as unplugged, and disconnected the HDMI connector and DPTX port without calling dcp_fabric_hdmi_unplugged_locked(). That diverged from the resume-side dcp_hdmi_unplugged_in_sleep() in three ways: a concurrent Type-C route transition could race the check and release, a transient GPIO read error could drop a live HDMI display whose HPD stays high after wake (leaving it dark), and an HDMI display unplugged before suspend left hybrid HDMI/Type-C fabric state stale because dcp_hdmi_unplugged_in_sleep() returns early once the connector is already disconnected. Move the suspend-side HDMI release into dcp_hdmi_suspend() in dcp-fabric.c, called after disable_irq(dcp->hdmi_hpd_irq) so IRQ sync never nests under dcp_typec_fabric_lock, and share the unplugged release path with dcp_hdmi_unplugged_in_sleep() via dcp_hdmi_release_unplugged_locked(): - Hold dcp_typec_fabric_lock across the active_typec_route check, link release, and fabric presence update (preserving the established dcp_typec_fabric_lock -> hpd_mutex -> tb_lock and dcp_typec_fabric_lock -> dcp_peer_lock lock orders). - Treat only an explicit gpiod_get_value_cansleep(dcp->hdmi_hpd) == 0 reading as unplugged so negative GPIO errnos keep an attached link. - Notify dcp_fabric_hdmi_unplugged_locked() when releasing a connected HDMI display whose HPD is explicitly low (including T6030 native outputs that are unplugged at suspend), without arming a spurious presence hold when no HDMI display was connected; release a stale DPTX port link if connected without an active DRM connector. - Kick hybrid_wq in dcp_hdmi_capacity_available() so a yielded Type-C port still recovers once the resume settle hold expires after a suspend-time unplug (when hybrid_wq was disabled). Extend tools/asahi/dcp-hdmi-sleep-unplug-tests.py and tools/asahi/run-host-tests.py to cover the suspend helper, GPIO errors, idle/stale-DPTX links, borrowed native pipelines, and fabric lock placement around disable_irq() across 12 killed mutations. Signed-off-by: AxxzyWasTaken <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
The new suspend helper keeps the fabric lock across the route-ownership check and link release. HPD IRQ synchronization remains outside the lock, and only an explicit low reading is treated as unplugged. The exact-head host fixture passed. I also checked that the native-release, GPIO-error and borrowed-native controls fail with their corresponding mutations. Code approved. Hold for hosted CI and the affected HDMI hardware paths: attached suspend/resume, unplug while asleep, Type-C recovery on a hybrid route, and a native T6030 output.
|
Tested f1e8791 on J473 (M2 mini, fixed DP2HDMI output on dcp 271c00000 with an Acer on HDMI, plus an MSI on USB-C): PASS, as part of a batch boot. Kernel: Row (one guarded one-shot, restored to fleet89 after):
Evidence: For this PR: 4 s2idle cycles with HDMI attached. Each resume logged |
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
|
Status of the remaining hardware cases from the review:
|
|
Merge-train review at |
|
Baseline for the unplug-while-asleep case (J473, Ryan's hands, 14:35): on |
Closes: #3071
What: Align the suspend-side HDMI release path in
dcp_platform_suspend()with the resume-sidedcp_hdmi_unplugged_in_sleep()helper by moving it intodcp_hdmi_suspend()indrivers/gpu/drm/apple/dcp-fabric.cand sharing the unplugged release logic viadcp_hdmi_release_unplugged_locked():dcp_typec_fabric_lockacross thedcp->active_typec_routecheck, link release, and hybrid fabric presence update (called afterdisable_irq(dcp->hdmi_hpd_irq)so IRQ synchronization never nests under the fabric mutex).gpiod_get_value_cansleep(dcp->hdmi_hpd) == 0reading as unplugged, preventing transient negative GPIO errnos from dropping a live HDMI display across sleep.dcp_fabric_hdmi_unplugged_locked(dcp)when releasing a connected HDMI display whose HPD is explicitly low (including unplugged T6030 native outputs), without arming a spurious 10 s presence hold on already-disconnected ports, while still cleaning up any staledptxport[0]link.hybrid_wqindcp_hdmi_capacity_available()so a yielded Type-C port still recovers after wake once the resume settle hold expires after a suspend-time unplug (whenhybrid_wqwas disabled).tools/asahi/dcp-hdmi-sleep-unplug-tests.pyandtools/asahi/run-host-tests.pyto cover the suspend helper, negative GPIO errnos, idle/stale-DPTX links, borrowed native pipelines, and fabric lock placement arounddisable_irq()across 12 killed mutations.Tested:
make ARCH=arm64 LLVM=1 drivers/gpu/drm/apple/andW=1 drivers/gpu/drm/apple/dcp.o drivers/gpu/drm/apple/dcp-fabric.o: clean, 0 warnings.tools/asahi/run-host-tests.py --only dcp-hdmi-sleep-unplug: 13/13 passed (control + 12 killed mutations under ASan/UBSan).tools/testing/selftests/drivers/gpu/apple-dcp/run.py: 96/96 passed;tools/asahi/run-host-tests.py --only dcp: 71/71 passed;--only display-sleep-merge(1/1),--only tunnel-route(1/1),--only tiled-split(2/2).scripts/checkpatch.pl --strict --git HEAD~1..HEAD: 0 errors, 0 warnings, 0 checks.Not yet: Boot and suspend/resume testing on Apple Silicon hardware with an attached HDMI display or T6030 native HDMI output.
Risk: two-way · all Macs with fixed or hybrid HDMI outputs (dcp suspend/resume HDMI release path; plain revert restores previous behavior).