Repository navigation
drm/apple: recover when a disconnect never arrives (Andy Wei's fix, ported) - #2096
joshuaswarren wants to merge 7 commits into
Conversation
|
GREEN on b03f2ab Compared with Andy's original. The comment block, the Locking. At the new call, What the new call adds over the original. For an external DCP it also clears Notes, none blocking:
The commit message and trailers match the body: the author is Andy, the sign-off is the submitter's. The branch is based on the current head of I did not rebuild or boot this. The build result is the PR's own claim. |
A connect is silently ignored while the driver still believes a display is attached, and for a tunnelled display that state is easy to get stuck in: the Type-C side reports the disconnect on the controller the connector names, which is the one driving the port's PHY and not the one the tunnel was reported to, and a tunnel whose block loses power never reaches the teardown path that would report it either. Unplugging during the four seconds a connect takes is enough to hit it, and from then on every hotplug on that port does nothing until reboot. Treat the event as authoritative: a display showing up means the previous one is gone, so drop it and carry on instead of ignoring the new one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Originally-by: AndyWeiBoan (commit AndyWeiBoan/linux@dccb4ce) [joshuaswarren: ported onto integration/aurora: dcp_dptx_connect_raw() takes the stale display down with dcp_dptx_release_locked(), the locked core of the disconnect teardown (without its HPD-low step), and the function is declared ahead of its use] Signed-off-by: Joshua Warren <[email protected]>
b03f2ab to
030d6e4
Compare
|
[Joshua's agent] New head 030d6e4 on integration/aurora 677be39. Done: the duplicate forward declaration is removed (the one ahead of dcp_dptx_connect_raw() stays, as it is needed there); the body and commit message now say dcp_dptx_release_locked() is the locked core of the disconnect teardown without the HPD-low step; the M1 Pro claim is dropped (Andy's message does not name hardware). Rebuilt: clang, drm/apple, exit 0, no warnings. Not booted. |
|
GREEN on 030d6e4 Re-review against my first comment. The only code change since All three notes are addressed in the body and the commit message: the call is "the locked core of the disconnect teardown (without its HPD-low step)", the duplicate declaration is gone, and the unsourced M1 Pro claim is replaced by "Andy's commit message does not say what hardware he tested on". The locking result from the first review stands: |
|
Review at head 030d6e4 — draft, not booted. The stale-drop itself is right: dcp_dptx_release_locked is built for hpd_mutex context (lockdep_assert_held), a release failure now propagates instead of being silently ignored, and the T8132 "taken as released" semantics are preserved. One interaction to check with #2097: this path drops the firmware link but never tells the DRM connector — no disconnected_hpd_event, no hotplug, no CRTC release. If the replacement display lands on a different port's connector for the same pipeline, the old connector keeps its CRTC binding and the clone-check rejection that #2097 fixes can still occur. Is dcp->connector still the stale connector at this point (in which case queueing apple_connector_queue_release_crtc would cover it), or has it already moved to the new port's connector (in which case the stale binding needs its own release)? |
…ase_locked and covers the stale-display connect The harness model of dcp_dptx_connect_raw() called dcp_dptx_release_locked() without declaring it, so the host.c compile failed under -Werror=implicit-function-declaration and the lifecycle group exited 1. Declare it in the model, and add a stale-display case: a connect that finds the old display attached drops it and connects, and a release failure fails the connect and leaves the display attached.
|
GREEN on 9ae8510 Second-model review of the 030d6e4..9ae8510 delta (test-harness only, dcp.c untouched in range). The fast-replug-bounce model now declares dcp_dptx_release_locked from the production source, and the two new stale-display cases cover both branches: release succeeds (connect 0, release+1/connect+1, display reattached) and release refuses (ETIMEDOUT, nothing started, stays attached). T6030/T8132-path assertions guard the H17P scenario. host-tests green on this head. No driver change, no merge (Aurora maintainers merge). |
|
Thanks for carrying Andy's fix over. Two points:
Row (Thunderbolt display or dock): unplug during the ~4 s connect x10, replug the same port: lit within 5 s each time; plain unplug/replug x10 never logs "connect while still connected". |
|
[Joshua's agent] Re your review, point by point. 1 (connect while still connected / generation gate): Agreed. Our port of Andy's safety net should not tear down a live link on every 2 (root cause vs safety net): Agreed on the split: route the unplug to the DCP that owns the tunnel and let Hardware row (M5 / Studio Display, w7C after restart): unplug during the ~4 s connect window ×10, replug same port (lit ≤5 s each); plain unplug/replug ×10 with no |
|
Thanks. The head is still 9ae8510, so the agreed changes aren't pushed yet:
Then the row with a Thunderbolt display or dock. Unplug during the ~4 s connect x10 and replug: lit within 5 s each time. Plain unplug/replug x10 should never log "connect while still connected". Andy's |
Record the attachment that acquired each DPTX port. A duplicate connect keeps its display. A newer attachment can replace a stale one before it asks the firmware to connect. Release a withdrawn tunnel while it waits for link configuration. Use the DP IN owner even after HPD falls if that owner still holds a display request. The 35 lifecycle host cases pass. Cross-compilation of dcp.o and dcp-fabric.o succeeds. Signed-off-by: Joshua Warren <[email protected]>
|
183e722 records the cable generation that acquired each DPTX port. A connect in the same generation keeps the live display. A newer attachment can release a stale display before it connects. A provider detach uses the DP IN route owner even when HPD is low if that owner still holds a display. If a tunnel disappears during link training, the wait now lowers HPD and releases the held request. A refused release leaves the request held for teardown to retry. All 35 lifecycle host cases passed. These include duplicate connects and withdrawal with both confirmed and refused releases. |
Integration now checks the return from dcp_direct_crossbar_link(). Give the bounce fixture's unreachable stub an integer return so the production release function still compiles on the merge base. The fixture passes 186 assertions on merge 32b1c49. Signed-off-by: Joshua Warren <[email protected]>
|
af59279 fixes the host check. The merge base changed |
|
Thanks. 183e722 does what we asked in One problem: Still open: the Thunderbolt rows (unplug during connect x10, plain replug x10) and Andy's Signed-off-by. After that we can run a USB-C display replug row on our M1 Pro and M4 Pro. |
The fabric can report a new attachment while the DCP still holds the old display and its cable flag remains set. Start the generation at OOB attachment so the DPTX connect releases that stale request. A retry in the same generation keeps the current request. The bounce host fixture uses the real OOB attach, DPTX connect and release. The stale request survived before this change; all 184 assertions pass after it. Signed-off-by: Joshua Warren <[email protected]>
|
The host case calls The 10 unplugs during connect, 10 ordinary replug cycles, and Andy's own sign-off remain open. The PR stays in draft. |
|
Thanks, 0f2e2a1 fixes the attach path. Every One path still keeps the old generation: when the attach takes the work action. Still open, as you list: the Thunderbolt rows (unplug during connect x10, plain replug x10) and Andy's own Signed-off-by. |
A newly claimed tunnel can queue reconnect work instead of calling the out-of-band connect. If the old display still owns the DPTX port, the unchanged generation makes the new connect a duplicate. Start the attachment and queue its reconnect under the same HPD lock. Exercise the fabric work action with a stale DPTX connection and check that a same-generation retry leaves the new link alone. Signed-off-by: Joshua Warren <[email protected]>
|
The new host case goes through the fabric work action with the old display still connected. It checks that the new attachment releases and replaces that display once, and that a retry leaves the new link alone. The bounce test went from 3 failures to 0 across 192 assertions. The two Thunderbolt hardware rows and Andy’s sign-off remain open. |
|
Thanks, d9afbe9 closes the work path. Nothing further from us on the code. Still open, as you list: the two Thunderbolt hardware rows (unplug during connect x10, plain replug x10), the co-author's sign-off, and CI, which is queued on this head. |
|
J775c (lobata) row request — Thunderbolt display (sheet row U5) Posted by Joshua's lane (wB4) from the 2026-11-20 K114c row set. We supply no image for this; it needs a tree with the J775c DTB, built on the queued/work attach-generation fix head ( Commands: unplug during connect x10 and plain replug x10; save attach/reconnect logs and display return for each trial. Pass: display returns after every trial; attach generation handles the unplug-during-connect case. |
|
Happy for this to go in as a port of my change. Signed-off-by: Andy Wei [email protected] Hardware: MacBook Pro 14" M1 Pro (J314s) with a Studio Display (2022) over Thunderbolt. |
|
@joshuaswarren checking open drafts today. To come out of draft, this still needs:
If it's no longer needed, say so here and we'll close it. Otherwise it stays open as a draft until these are done. |
Signed-off-by: Joshua Warren <[email protected]>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins. |
There was a problem hiding this comment.
Verdict: FINISH, then merge at 09b93ca7
Blockers:
- Queued CI checks (
apple-build,host-tests,kunit,pr-text,readiness, KUnit suites) are still pending; wait for green CI. - Missing exact-head
09b93ca7hardware verification row exercising Type-C/tunnel reconnect recovery and a second-Mac display regression check.
Checked:
09b93ca7cleanly mergesmainover0f2e2a12/d9afbe9d(connected_generationtracking and stale-display teardown viadcp_dptx_reconnect); carried third-party commit030d6e46unchanged per policy;MERGEABLEonmain; no Apple material or private serials.
Evidence
- Head:
09b93ca7(base: main,mergeable: MERGEABLE,+168/-25across 5 files).
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
…S prompt The M1 Max's USB-C controllers (apple,t6000-dwc3) bind only to dwc3-apple, which Aurora's initrd module list lacks. Stage 1 had no xHCI and the cd321x Type-C controllers deferred, so a USB keyboard did not work at the LUKS prompt and the external displays stayed disconnected, leaving the prompt on the internal panel only. Add dwc3-apple, plus typec_displayport for DP alt mode in stage 1, to boot.initrd.availableKernelModules. Additive; kernel, kernelModules and kernelParams are unchanged, and no other host's derivation changes. Risk: DP alt mode and the DCP-ext routes now come up in stage 1 and are handed to stage 2, so a DCP hotplug race (the class of aurora-silicon/linux#2096) could leave an external display dark after boot. Not yet tested on hardware. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…S prompt The M1 Max's USB-C controllers (apple,t6000-dwc3) bind only to dwc3-apple, which Aurora's initrd module list lacks. Stage 1 had no xHCI and the cd321x Type-C controllers deferred, so a USB keyboard did not work at the LUKS prompt and the external displays stayed disconnected, leaving the prompt on the internal panel only. Add dwc3-apple, plus typec_displayport for DP alt mode in stage 1, to boot.initrd.availableKernelModules. Additive; kernel, kernelModules and kernelParams are unchanged, and no other host's derivation changes. Risk: DP alt mode and the DCP-ext routes now come up in stage 1 and are handed to stage 2, so a DCP hotplug race (the class of aurora-silicon/linux#2096) could leave an external display dark after boot. Not yet tested on hardware. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Verdict: MERGE at 09b93ca73752
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: - 09b93ca7 cleanly merges main over 0f2e2a12 / d9afbe9d (connected_generation tracking and stale-display teardown via dcp_dptx_reconnect); carried third-party commit 030d6e46 unchanged per policy; MERGEABLE on main; no Apple material or private serials.
Follow-ups (not blocking): queued CI; Type-C/tunnel reconnect row (2nd Mac not required)
What
Ports Andy Wei's fix (
dccb4ce22568) so a new Type-C/tunnelled display connect recovers if the previous disconnect never arrived.Previously,
dcp_dptx_connect_raw()returned early whileconnectedwas still set, leaving the port stuck until reboot if a tunnel disconnect was lost or arrived on a different controller. This tracksconnected_generation, tears down a stale connected display viadcp_dptx_release_locked()(returning any release error rather than silently returning 0), releases a withdrawn tunnel cleanly, addsdcp_typec_attach_reconnect(), and extendstools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py.Andy Wei is the commit author (
Originally-by:linked); submitting under DCO 1.1 clause (b). @AndyWeiBoan, please add yourSigned-off-by:in a comment.Tested
drivers/gpu/drm/apple/with clang (LLVM=1,modules_prepare) on an aarch64 build host with exit 0 and no warnings.Risk
two-way · Macs with external Type-C or tunnelled DisplayPort outputs using apple-dcp (a repeated connect on a still-connected port with a newer generation now tears down the stale display first).
Not yet
Not booted on any Mac, not a full kernel link, and
CONFIG_KUNITwas off during the build check. Hardware hotplug reproduction and T6050/T6041 display checks have not been run.