Repository navigation
phy: apple: atc: one held PIPE lock for the live USB3 handoff, on every T8103-generation PHY - #2403
RyanTheTide wants to merge 3 commits into
Conversation
Before a lane change, a live T8103-generation USB3 PIPE is parked on the dummy backend under the PIPE handler's lock. The lock was asked for up to ten times: each request polled for 1 ms, dropped, then usleep_range(5000, 10000) before the next. The ACK is the controller's own signal that it has let go of the PIPE. Dropping the request and asking again adds nothing it waits for. Ask once, keep the request up, and poll the ACK for 100 ms, the span the ten tries covered. Poll in 100 us steps over a window that long. A controller held in reset or clamped (PIPEHANDLER_AON_GEN) clocks no ACK. Refuse the lock at once then, instead of waiting out the window. Update the host harness (tools/asahi/atc-usb3-tests.py): the retry cases become single-request cases, a held controller is never asked, and the mutations follow the new body. 39 cases pass and every mutation is killed. The handoff is Chris Kearney's, after milijan's AsahiLinux/linux#503. Fixes: 0287dbe ("phy: apple: make legacy USB3 handoff completion retryable") Signed-off-by: Ryan Murray <[email protected]>
The USB3 handoff of the T8103-generation PIPE handler parks a live PIPE under a held lock before a lane change, skips host BIST, and routes USB3 for an early dwc3 role once Type-C asks for it. bb71dfa admitted it only on an apple,t8103 machine, because M1 Pro/Max/Ultra, M2 and M2 Pro/Max/Ultra had not been qualified. Those SoCs bind the same apple,t8103-atcphy fallback and get the same PIPE handler (atcphy_hw_t8103). The handoff is a property of that block, so select it by the PHY generation, as 0287dbe first did. T8122, T8132, T8140 and T8142 PHYs are another generation and stay out. Update the KUnit admission case and the host harness to the generation rule; the mutations that equated machine and generation become equivalent and are dropped. Fixes: bb71dfa ("phy: apple: restrict the USB3 handoff workaround to base M1") Signed-off-by: Ryan Murray <[email protected]>
|
Blockers: 2.
Commit 1 is sound. Nit: the HW row: on this head, M1 Pro J316s and M2 J413, each with a SuperSpeed device on a Type-C port. Assisted-by: LLM (Claude:Opus 5.5) |
The live PIPE lock window in drivers/phy/apple/atc.c is written with USEC_PER_MSEC. The host units that compile the extracted atc.c bodies had no definition, so eleven cases stopped building: host.c: error: use of undeclared identifier 'USEC_PER_MSEC' (pm-ownership, controller-lifecycle, usb-unreachable, parking, adverse-retry, masked-context, off-hardening, warm-reset, pipe, probe-mux-pm-dispatch and dwc3-teardown). Define it, with the kernel's value from include/vdso/time64.h, next to the usleep_range() stub in the three phy.py preludes and in dwc3/prefix.c. The driver keeps the named constant. Signed-off-by: Ryan Murray <[email protected]>
|
Host-test blocker fixed in 1adc1d7: the atc host preludes (three phy.py preludes + dwc3/prefix.c) now define Testing: apple-dcp phy group 5/14 -> 14/14, lifecycle 33/35 -> 35/35 (the 11 failing cases); |
RyanTheTide
left a comment
There was a problem hiding this comment.
Independent source review at 1adc1d7acc1c. The PHY-compatible selector expands this path to the M2, where the posted tests had no SuperSpeed consumer. Please verify repeated USB3 ↔ DP Alt Mode changes with a linked device on both J473 ports and a J413 port, and confirm SuperSpeed re-enumerates after s2idle while the cable remains attached.
Problem
drivers/phy/apple/atc.c:1390(0287dbe, bb71dfa): before a lane change, a live USB3 PIPE is parked under the PIPE handler's lock. On base M1 the lock was asked for up to ten times. Each request was polled for 1 ms, dropped, and followed byusleep_range(5000, 10000). bb71dfa also limited this whole handoff (live park, no host BIST, early dwc3 role) to anapple,t8103machine. The reason given was qualification, not a hardware difference.Change
PIPEHANDLER_AON_GEN), it clocks no ACK. The lock is then refused at once.atcphy_hw_t8103), not by the machine compatible. T600x, T8112 and T602x DTs list"apple,t60x0/t8112-atcphy", "apple,t8103-atcphy"and bind the same hardware row. T8122, T8132, T8140 and T8142 are a different generation and stay out.The handoff is Chris Kearney's work, following milijan's AsahiLinux/linux#503.
Testing
make W=1 drivers/phy/apple/atc.owith the release config: builds, no new warnings.tools/asahi/atc-usb3-tests.py --mutations(host harness that compiles the real driver bodies): 39 cases pass, every mutation is killed. The harness was updated in the same commits (single-request cases, held-controller case, generation admission).KUnit admission case updated (
atcphy_test_t8103_usb3_generation_scope). KUnit was not run.Hardware (one-shot test kernel 7.3.0-aurora-swl1 = integration 0abc2f3 + this and the other open sweep PRs, 2026-11-20):
Still to run
lsusb -tshows5000M. Then switch that port between USB3 and a DP-alt adapter three times. dmesg must show noPipehandler lock not acked, noFailed to switch PIPE, and no WARN fromatcphy_mux_switch, and USB3 must come back at 5000M. Then s2idle three times (rtcwake -d rtc1 -m freeze -s 20) with the device still enumerated at 5000M. These are the first rows of the handoff on these SoCs, because the second commit enables it there.apple,t8103-atcphyrow and PIPE handler as M1 Pro/M2. If the M1 Pro or M2 row fails, drop the second commit.Commits
phy: apple: atc: hold one PIPE lock request for a live USB3 handoff. Behaviour changes only on base M1.phy: apple: atc: take the USB3 handoff on every T8103-generation PHY. Widens the handoff to M1 Pro/Max/Ultra, M2, M2 Pro/Max/Ultra. Can be dropped on its own.