Repository navigation
M2 Mac mini USB-C on the default boot; keep USB4 links across dwc3 role swaps - #3040
Open
RyanTheTide wants to merge 2 commits into
Open
RyanTheTide wants to merge 2 commits into
RyanTheTide wants to merge 2 commits into
Conversation
…neration The PHY returns to its off mode when the dwc3 host or device on the port stops, except in a CIO mode (USB4 or Thunderbolt) on T8132, where the Type-C mux owns the mode and takes it down when the connection ends. Other generations power the PHY off under a live CIO link instead. dwc3 stops for every data role swap, not only for a cable change. On the M2 Mac mini (J473) with a host-to-host USB4 peer, a partner that leaves and comes back during s2idle can come back with the data roles swapped. At resume dwc3 goes from device to host, which takes the PHY off and back to USB4 within the same millisecond, while the peer is still training the link. The peer times out, the link never trains again, and the XDomain is gone until the next replug or sleep. A partner event in the next s2idle then stops the J473 for good (5 of 6 such sleeps hung on the bench). Nothing about this is specific to T8132: the router owns the lanes in a CIO mode on every generation, and the PIPE is parked before the check either way. Drop the generation from the condition. The Type-C mux still takes a CIO mode down on a real disconnect, an ordinary USB mode still ends with its host, and a CIO mode whose last transition failed is still taken down. Extend the USB3 host model: the CIO cases now run on the T8103 sequence (which T8112 and T600x use) as well as on T8132, and a mutation that restores the T8132-only condition is caught. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…re is refused A display processor whose firmware-compat is not supported fails its probe with -ENODEV and never registers the Type-C display routes under its node. The USB-C port controllers that name such a route as their mode switch then wait for it for good: fwnode_typec_mux_get() keeps returning -EPROBE_DEFER, so the port is never registered and USB2, USB3, USB4 and the role switch stay down on every port the processor routes, not only DP alt mode. On the M2 Mac mini (J473) the routes of both USB-C ports sit on the primary DCP, which refuses the 27.2 firmware: both CD321x stay in "deferred probe pending" and neither USB-C port works at all. The firmware cannot change before the next boot, so disable the routes in the device tree on this refusal, as the processor failure paths that already give up for good do (dcp_native_routes_error(), dcp_ext_give_up(), dcp_platform_probe_t8132_ext()). The connector's graph lookup then skips the disabled route endpoints (fwnode_graph_devcon_matches()), the port takes the PHY mode switch alone, and the ports come up without DP alt mode on that processor. The routes stay disabled for the rest of the boot: a driver that would accept the firmware gets them back after a reboot, not by loading a newer module in the same boot. Selected by what the device tree describes (a typec-routes child of the refusing processor); a processor without one is unchanged. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
DjDeveloperr
left a comment
Contributor
There was a problem hiding this comment.
Formal adversarial §1–§6 pre-PR review at live head a9654421c21282bc4d092fa9d7b1bf04514c00c2 (against integration/aurora 5746ef8a5afd, MERGEABLE/CLEAN, CI 2/2 SUCCESS: Apple DRM KUnit / kunit, Host tests / host-tests).
Code, policy, and CI are clean; posting COMMENT rather than APPROVE solely because exact-head §5 hardware rows and cross-generation USB4/TBT regression rows remain listed under Still to run.
Checklist Audit (§1–§6)
- §1 No model gating: Pass. Commit 1 (
f1effbd17a55) removes theATCPHY_GENERATION_T8132generation check inatcphy_usb3_power_off()rather than adding a gate, and commit 2 (a9654421c212) is driven purely by DTtypec-routespresence whendcp_check_firmware_version()returnsDCP_FIRMWARE_UNKNOWN. - §2 Production-ready / Code review: Pass.
drivers/phy/apple/atc.c: Returning0inatcphy_usb3_power_off()whenatcphy_mode_is_cio(atcphy->mode) && !atcphy->mode_dirtyruns strictly afterhost_active = false,usb3_port_off = false,atcphy_park_pipehandler(atcphy, true), andt8103_usb3_retry = false. Leaving the PHY in a clean CIO mode preserves runtime PM ownership (atcphy_rpm_busy()stays true), letsatcphy_usb2_init()+atcphy_usb3_route()restore USB2 and re-route PIPE across role swaps without tearing down the live router link, still tears down failed CIO transitions (mode_dirty), and still letsatcphy_mux_switch(APPLE_ATCPHY_MODE_OFF)power down on real disconnect.tools/asahi/atc-usb3-tests.pycleanly extends CIO coverage toATCPHY_GENERATION_T8103and adds mutationusb-stop-keeps-cio-t8132-only.drivers/gpu/drm/apple/dcp.c: Callingdcp_typec_routes_disable_dev(dev)onDCP_FIRMWARE_UNKNOWNmatches the existing permanent give-up paths (dcp_native_routes_error(),dcp_ext_give_up(),dcp_platform_probe_t8132_ext()).- Non-blocking note: Other permanent
-ENODEVprobe refusals indcp_platform_probe_pipe()(e.g., unsupportedapple,t8140-dcpexthandoff, missing IOMMU domain, or missingapple,bw-scratch) still return-ENODEVwithout callingdcp_typec_routes_disable_dev(dev); fine to keep this commit narrowly scoped toDCP_FIRMWARE_UNKNOWN, just worth keeping in mind if any of those ever carrytypec-routes.
- §3 Safety: Pass. No hardcoded limits or Stage-1 changes; default command line throughout.
- §4 Clean-room & attribution: Pass. Both commits (
f1effbd17a55,a9654421c212) carry human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and humanSigned-off-by:only, with zero AI commit trailers;Assisted-by:disclosed in the PR body. - §5 Evidence (remaining before
APPROVE): Strong pre-rebase evidence on J473 (rowsf1on110861f4ands10on0f111a0d: 12 cycles, 6/6 role flips kept XDomain, 0 hangs vs 5/5 hangs before) and J413 (dcpcommit). To convert toAPPROVE, please attach:- An exact-head (
a9654421c212) J473 default-cmdline functional + §5 regression row (0 SELinux denials, 0 failed units, 0 new kernel errors). - At least one non-T8132 regression row exercising the
atccommit with a live USB4/Thunderbolt peer or dock (e.g., J413 T8112, J615 T8122, or M1 Pro T6000) to confirm disconnect/replug and tunnel/link stability on other generations.
- An exact-head (
- §6 Naming: Pass.
Assisted-by: LLM (Gemini 4 Neon)
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.
Problem
On the M2 Mac mini (J473) with 27.2 firmware, both USB-C ports are dead on the default boot: no USB2, USB3, USB4 or role switch. The Type-C display routes of both ports sit on the primary DCP. That DCP refuses the 27.2 firmware, so it never registers them, and both CD321x port controllers wait for that mode switch forever (
deferred probe pending).Bringing the ports up exposes a second bug, which affects every Apple Type-C PHY generation except T8132. When dwc3 stops on a port in USB4 or Thunderbolt mode, the PHY powers off under the live link. dwc3 stops for a data-role swap as well as for a cable change. With a host-to-host USB4 peer, a partner that leaves and comes back during s2idle can come back with the roles swapped. At resume, dwc3 then goes from device to host and the PHY cycles off and back to USB4 within the same millisecond while the peer is still training the link. The link never trains again and the XDomain is lost. A partner event in the next s2idle then hangs the J473 (no wake, no reset; only a VDM reboot recovers it).
Change
phy: apple: atc: when its USB host stops, leave a PHY that is in a CIO mode (USB4/Thunderbolt, last transition not failed) as it is, on every generation. Until now this only applied on T8132. The PIPE is still parked, and the Type-C mux still takes the mode down when the connection ends. This removes a generation check instead of adding one. The USB3 host model (tools/asahi/atc-usb3-tests.py) now runs the CIO cases on the T8103 sequence (used by T8112 and T600x) as well as on T8132, and has a mutation that restores the T8132-only condition.drm/apple: dcp: when a DCP refuses its firmware, disable itstypec-routeschild, as the three existing give-up paths already do. The connector graph lookup then skips those endpoints and the ports come up on the PHY mode switch alone, without DP alt mode on that DCP. This is selected by the device tree. It is a no-op where the DCP accepts its firmware.Testing
J473, production Stage 2, default kernel command line, one-shot trial boots, J616s (M4 Pro) as the USB4 host-to-host peer on port 0, a USB-C-to-HDMI adapter on port 1.
USB-C bring-up (dcp commit, row f1, on integration/aurora 110861f + the same patch): both CD321x bind and nothing is left deferred. Both Type-C ports register (PD, DP and TBT altmodes). USB4 host-to-host runs at 20 Gb/s x 2 lanes, with TCP throughput of 10.5 to 12.8 Gbit/s each way. DP alt mode is entered on port 1 (no picture yet: the primary DCP is still refused, which is drm/apple: adopt a DCP handed over running (M2 Mac mini HDMI on 27.2) #2853 job). Real PD unplug/replug passed 5/5 on each port. The USB-A ports and a 27.2 IPSW USB stick are unchanged (SuperSpeed, full
unzip -tclean, 410 MB/s O_DIRECT). 0 oops, 0 DART faults.Peer churn in s2idle (atc commit). In each row the peer drops its port for 5 s inside each 20 s s2idle, so the link drops and trains again while the J473 sleeps:
On s10: 13/13 host discoveries (boot plus every resume), no port restart on either side, 0 Oops/BUG/WARN/DART. With dynamic debug on, the role swap now logs
PIPE park: mode=5 pipe=2followed bymode=5 pipe=0: the PHY stays in USB4. Before the fix the same swap loggedmode=0.An idle peer was already fine before the fix (20/20 30 s s2idle).
M2 Air (J413, same T8112, 13.5 firmware), dcp commit: all 3 Type-C ports, both dwc3 bound, nothing deferred, USB-C DP alt to an external monitor connected, 3/3 s2idle, 0 oops/WARN/DART. Here the DCP accepts its firmware, so the new path does not run.
Host:
tools/asahi/atc-usb3-tests.py: 38/38 cases pass.--mutations: 56/56 killed, including the one that restores the T8132-only condition, so the old code fails the new model. checkpatch --strict: 0/0/0 on both commits.Still to run
Mechanism and evidence detail
atcphy_usb3_power_off(). On a non-T8132 PHY that calledatcphy_configure(APPLE_ATCPHY_MODE_OFF)under the live USB4 link, and the host start then reconfigured the PHY to USB4 (atcphy_usb2_init()on mode OFF). The whole sequence took 0.3 ms with no Type-C event involved.peer link lost with the cable attached, restarting the port (1/3)), and the link never trained again. The J473 kept a new, never-answered XDomain.fwnode_graph_devcon_matches()skip its endpoints, so tipd gets the atcphy mux only. A newer appledrm loaded in the same boot cannot get the routes back; that needs a reboot. A late mux bind in the typec core was considered and rejected: it regressed non-tipd typec users.Assisted-by: LLM (Claude:Opus 5.5)