Repository navigation
M1/M2 regression fixes on the Type-C hotplug base (tipd SAFE order, atc mux requests, optional legacy EDID service) - #332
Merged
Conversation
atcphy_mux_set() takes the USB3 root hub of a port behind a fixed hub before atcphy_mux_set_locked() works out which PHY mode the new Type-C state needs. Move that lookup into atcphy_typec_target_mode() and do it first, under the PHY lock, so that the mux update can look at the target before it decides what else it needs. atcphy_mux_set_locked() now takes the PHY and the target mode. The lookup keeps its error messages and still maps the off state of a fixed-hub port to USB2. No functional change. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
…s mode On a port behind a fixed hub, atcphy_mux_set() takes the device locks of the USB3 root hub and of the device on its port before it looks at the new Type-C state. hub_wq holds the root hub's lock for a whole hub event, and a SuperSpeed enumeration that keeps failing holds it for its full set of retries, each with 5 s command timeouts. The CD321x driver also calls the mux for DisplayPort HPD and status updates that keep the pin assignment. Such an update touches neither the lanes nor the PIPE, but it still waits for hub_wq, and the HPD event it carries reaches the display only afterwards. On a J700 with a USB-C dock (DisplayPort plus USB3), the display came back 27 s after a cable flip, right after hub_wq gave up on the dock's SuperSpeed hub: 22:06:46 usb 2-1: new SuperSpeed Plus Gen 2x1 USB device number 20 using xhci-hcd 22:06:46 usb 2-1: device descriptor read/8, error -71 22:06:51 xhci-hcd xhci-hcd.0.auto: Timeout while waiting for setup device command ... 22:07:08 usb usb2-port1: unable to enumerate USB device 22:07:08 phy-apple-atc 40b000000.phy: Pipehandler lock not acked. 22:07:11 apple-dcp 416e00000.dcp: dcp_hotplug() connected:1 ... Return early, before any USB reference is taken, when the target mode is the current one, no failed transition is pending and the PIPE already sits on the backend that mode needs. atcphy_mux_set_locked() keeps its own check for the case where the state changes in between. A mode change still takes the root hub, as the PIPE has to be handed over while the controller is quiet. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Test how atcphy_typec_target_mode() maps Type-C states to PHY modes, on Type-C ports and on ports behind a fixed hub, and when atcphy_mux_is_noop() lets a mux update skip the lane and PIPE work: a DisplayPort update with the same pin assignment does, while a new mode, a failed transition and a PIPE handoff still owed to a running controller do not. The tests are built into the driver, so that they can reach its static functions. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Move the bodies of atcphy_mux_set() and atcphy_sw_set() into atcphy_mux_update() and atcphy_set_orientation(), which take the PHY rather than the Type-C mux or switch device. The callbacks only look up the PHY and call them. This lets the driver's KUnit tests run a whole mux update and an orientation change on a PHY without registering Type-C devices. No functional change. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
…B3 root hub The existing tests check atcphy_mux_is_noop() on its own, so they still pass if atcphy_mux_update() stops returning early and takes the USB3 root hub again for every DisplayPort HPD or status update. Run whole mux updates on a PHY behind a fixed hub that has no device tree node. Taking the root hub then fails with -ENODEV at the controller lookup, before any register access. An update with the same pin assignment and orientation must return 0. A new pin assignment, a pending PIPE handoff, a PIPE away from the USB3 backend of a running host, and a cable flip reported through atcphy_set_orientation() must all reach the root hub. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Legacy DCP firmware can start the DPAVSERV endpoint without announcing an EDID service. Stock accepts expiry of the advisory discovery wait, while Aurora reports an endpoint failure even though the endpoint remains live. Keep the discovery window so an early announcement can precede get_modes, and return success when it expires. Only the announcement callback may publish a service. Log expiry and legacy publication at debug level so a late announcement can be distinguished from continued absence without a warning for an optional service. Leave AFK startup errors and H17P's asynchronous admission unchanged. Extend the production-function host tests to check expiry and publication diagnostics as well as optional discovery and genuine startup failures. Fixes: 014aed9 ("drm/apple: retrieve external H17P EDID through bounded AFKV2 inline calls") Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Ordinary Apple USB ports must stop DWC3 before the mux changes the shared PHY lanes. Early SAFE during removal or probe rollback instead reaches ATC with a live PIPE. Prepare display shutdown first and hold the SAFE transaction across role NONE, applying it after successful role shutdown. Let mux providers declare this ordering requirement and use one predicate for disconnect and removal. ATC declares it only for ordinary ports, so a fixed host still applies SAFE while its backend clock is available, even if its firmware graph exposes a no-op role switch. Other providers retain the existing early order. This keeps the fixed-host divergence from Asahi because its shared PIPE must be parked before the host clock disappears. An unregistered role switch returns -EOPNOTSUPP after controller teardown; accept that shutdown result only when it also reports role NONE. Keep unsupported requests on a live role as errors. On other errors abort without applying SAFE and retain recovery ownership. Reject an ordinary-port SAFE against a live PIPE with -EBUSY so the next probe cannot warn or change live lanes. The removal transaction remains open until generic disconnect finishes; the prepared flag prevents an early second application. Cover the ordering, fixed-host no-op switch, absent switch, errors and re-probe in host tests, and the live-PIPE guard in KUnit without MMIO. Fixes: 6f00436 ("usb: typec: serialize display teardown and preserve recovery ownership") Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
USB role shutdown can power the PHY off while its saved Type-C request is still USB3. A subsequent SAFE request needs no lane work, but both mux fast paths return without saving it. A later USB2 PHY initialization can then restore the old USB3 request instead of respecting SAFE. Record every accepted request whose lanes already match, both before acquiring USB runtime ownership and in the locked recheck. Preserve the capability checks, PIPE retries and fixed-hub no-op bypass. Test SAFE after independent shutdown on both paths and call the real USB2 initializer with a KUnit configuration stub that counts lane requests. Extend the host role mock through the production PHY power-off, mux recheck and USB2 init bodies, leaving only MMIO operations mocked. The host cases now verify that role NONE powers the PHY OFF, SAFE requires no lane work, and USB2 init cannot restore stale USB3 after SAFE. Fixes: 48836ec ("phy: apple: atc: Keep USB2 up when the port sits behind a fixed hub") Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Contributor
Author
|
Neo gate passed (2026-10-17 09:0x): smoke boot of the exact combined merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes for regressions that our aurora-wip kernel showed on the M1 Pro (t6000) and M2 (t8112) compared with stock Fedora Asahi, plus the Type-C hotplug series they build on.
Commits
Type-C hotplug base (5,
phy: apple: atc). Needed: the fixes do not apply without them.7156d4c0a7b6Look up the Type-C target mode before the mux updateb0dee3d08c1aDon't wait for USB enumeration when the mux keeps its mode39bb6d308b70Add KUnit tests for the Type-C mux decisions64ef3b3a84f0Split the mux and switch callbacks from their PHY work0aeb0acde3e1Test that a mux update keeping its mode skips the USB3 root hubM1/M2 regression fixes (3).
672846413c59drm/apple: Treat a missing legacy EDID service as optional. The old DCPAVSERV-110warning becomes a debug line, as on stock.4b36583930a5usb: typec: tipd: Apply SAFE after ordinary USB role shutdown. This uses the provider-informed SAFE order, so a refused DR swap plus rebind no longer warns in atc (on stock it warns on the first attempt).2757f43e143ephy: apple: atc: Remember mux requests that keep the lane mode. It returns-EBUSYinstead of a WARN against a live PIPE.Testing
Ref Macs, 2026-10-16/17. We tested this branch merged into aurora-wip
a837bd5f(--no-ff, clean). Kernels7.1.12-aurora-ref-{m1p,m2}-N1-g06cdf1b90+use each Mac's stock config withUSB4_APPLE_SOC=mandapple_sepblacklisted. Each was booted with the aurora DTB and then with the stock DTB.pm_test=platformStock-DTB boots of the same kernel: the M2 shows 0 WARN; the M1 Pro shows 1 WARN, the inherited apple-sio late-IOMMU race, which also appears on true stock. Not covered: USB devices, external displays and cable orientations, because nothing was attached.
MacBook Neo (J700).
4b36583930a5and2757f43e143ealso touch Neo code (tipd, atc). They get a Neo smoke boot of the exact merge before this PR is merged.The earlier stock-DTB qualification of the fixes is in
reports/refmacs-20261015.md("v2 qualification"), and the hand-off isreports/codex-impl-20261015/m1m2-regressions.md.🤖 Generated with Claude Code