Repository navigation
usb: dwc3: apple: select idle runtime PM by DT power domains, not a SoC list - #2299
Conversation
…device tree
An idle controller, whose core is down because no cable is connected,
could runtime-suspend only on T6040 and T8132 ("the PHY driver and the
DARTs follow runtime PM on these SoCs"). A port that never saw a cable
could do so only on T8132 and on T6041 machines. The glue, the DARTs'
runtime PM and the way the PHYs use the controller's power domain are
the same on every SoC, so these lists record where it was tried, not a
hardware difference. On T6000, T8112, T8140 and the others an idle
controller stayed runtime-active for good after its first cable, and
with it its DARTs.
Select it from the device tree instead: the controller, every DART in
its iommus and every PHY provider in its phys must name a power domain.
That is the condition for a domain drop to be safe:
- a DART is resumed before its consumer, and so before the consumer's
domain is on. A DART outside any domain would be restored into a block
that is still off;
- a PHY in the domain either keeps it on (an ATC PHY without idle
power-off has runtime PM disabled, so genpd counts it as in use),
follows it and restores its state (T8132), or holds it while it is
started (the T6050 combo PHY).
Every enabled Apple DWC3 node in the tree meets this: 179 nodes in 135
DTBs, on T8103, T6000, T8112, T6020, T8122, T6030, T6031, T6040, T8132,
T8140, T8142 and T6050. Where the ATC PHY has no idle power-off, the PHY
keeps the domain on, so an idle controller now suspends the glue and its
DARTs only. The PHY is not power-cycled by this, and the base M1 USB3
handoff path is not reached by it.
The never-plugged path uses the same property. It stays off only for a
fixed-hub host, which starts at probe and never waits for a cable.
This builds on the idle runtime PM work of Jonathan Goyvaerts (T6040),
Erik Bourget (T8132) and AxxzyWasTaken (T6041), which this only widens.
Fixes: 4cacc48 ("usb: dwc3: apple: Let an idle T8132 controller runtime-suspend")
Fixes: dcb1f4f ("usb: dwc3: apple: Let a never-plugged T6041 port runtime-suspend")
Signed-off-by: Ryan Murray <[email protected]>
The USB3 PHY was optional only for T8132 and T6040 controllers. Whether a port has a USB3 PHY is what its device tree says in phys/phy-names, and the glue already handles a NULL PHY everywhere (phy_set_mode() on NULL is a no-op and the USB3 paths check for it). Look it up as optional on every SoC. A device tree that names the PHY behaves as before, including probe deferral. One that does not name it now gets a USB2-only port instead of a failed probe, which is what the two listed SoCs already got. Fixes: a50abc4 ("usb: dwc3-apple: support host-only T6040 ports with a USB2 PHY only") Signed-off-by: Ryan Murray <[email protected]>
dwc3_apple_setup_hibernation() sets GCTL's hibernation enable and a power-down scale on T8140 only. Keep that scope and write down the reason: the power-down scale is the number of suspend clock periods in one 16 kHz period, so it depends on the SoC's suspend clock rate, and T8140 is the only SoC whose value is known. Another SoC that keeps its core through a deep sleep needs its own scale first. No functional change. Signed-off-by: Ryan Murray <[email protected]>
|
J700 (MacBook Neo) row, from one combined test kernel (integration b4cd7b3 plus this PR, #2477, #2474 and #2370), one-shot boot, compared against the production kernel:
|
|
Looks good; approve once the plug-after-idle row below is on the current head. I checked
HW row: on the current head, J316s (T6000) and J413 (T8112): leave the ports idle until they reach Assisted-by: LLM (Claude:Opus 5.5) |
RyanTheTide
left a comment
There was a problem hiding this comment.
Independent source review at 0d8e6bde9b28. The runtime-PM selector now follows attached power domains and preserves the fixed-hub exception. A cold boot with no cable only covers the never-connected path. Please test a J413 and J473 through USB3 attach, detach, runtime idle and re-enumeration after s2idle while watching the controller and DART state.
There was a problem hiding this comment.
Pre-PR checklist (§1–§6) review at 0d8e6bde9b2825732574b0147500afa1b1726e52 (all 7 CI checks SUCCESS: host-tests, source, rust-build, kunit, and DWC3/ATC build matrix; not superseded on integration/aurora).
Technical verification
Source changes in drivers/usb/dwc3/dwc3-apple.c are clean and apply cleanly onto live integration/aurora:
dwc3_apple_idle_rpm()verifiespower-domainson the controller, everyiommussupplier, and everyphyssupplier, properly putsit.nodeon early return, and conservatively returnsfalseon malformed phandle lists (err != -ENOENT).- Making
usb3-phyoptional on all SoCs viadevm_phy_optional_get()is safe: allappledwc->usb3_phycallers handleNULL(either viaphy_set_mode()no-op or explicit NULL checks), and named-but-unbound providers still defer probe. pre_core_rpmhandoff indwc3_apple_core_start()and cleanup indwc3_apple_probe()/dwc3_apple_remove()remain balanced; fixed-hub controllers are excluded.- Commit 3 documents the hardware reason (
PWRDNSCALE/ suspend clock rate) why T8140 hibernation remains SoC-scoped. - Minor non-blocking nit: the overview comment near the top of live
drivers/usb/dwc3/dwc3-apple.c(L116-120) still saysRuntime PM (T6040 and T8132...)andOn T8132 a port that has not seen a cable yet.
Blockers
- §5 Hardware evidence — newly enabled cable-attach / resume handoff from
suspendedis untested:- This PR newly enables both idle runtime PM and
pre_core_rpmnever-plugged suspend on every non-T6040/T8132 Apple Silicon SoC (andpre_core_rpmon T6040). - All posted non-fixed-hub hardware runs (J413, J616s, J316s) were run on a combined multi-PR test kernel with nothing plugged in, and J700 has a fixed hub that never enters idle/pre-core runtime PM.
- As already noted in
## Still to runand prior review comments, please post a live-head hardware run on newly enabled hardware (at minimum T8112 J413 and T6000 J316s, plus T6040 J616s) exercising: idle untilsuspended-> plug USB3 and USB2 devices into a never-plugged port (exercisingpre_core_rpmhandoff, DART restore, and firstdwc3_core_probe()) -> enumerate & verify I/O -> unplug -> idle back tosuspended-> s2idle -> re-plug/re-enumerate, with0DART faults,0new kernel errors,0SELinux denials, and0failed units.
- This PR newly enables both idle runtime PM and
Checklist (§1–§6)
- §1 No model gating: Pass (replaces SoC allowlists with DT
power-domainsinspection; justifies remaining T8140 hibernation gate). - §2 Production-ready: Pass (default command line, no hacks).
- §3 Safety: Pass (conservative DT supplier check).
- §4 Clean-room and attribution: Pass (all 3 commits
4fe837a0bc1d,93bd6e7e2cdc,0d8e6bde9b28carry human author/committer andSigned-off-by:only, zero AI commit trailers; plainAssisted-by:in PR body). - §5 Evidence: Incomplete — see Blocker #1.
- §6 Naming: Pass.
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 0d8e6bde9b28: the code is ready; it needs only a row at this head.
Blockers: none in the code. Missing row: idle runtime PM now runs on SoCs that never had it, and the J413, J616s and J316s boots don't cover a cable attached after the controller has idled. Needed: on one of them at this head, let the port idle into runtime suspend, then plug in a USB device and a host; both should enumerate.
Checked: no Apple material. This removes a SoC list: runtime PM is chosen by the DT power domains. CI green.
Superseded by the review at 0d8e6bd
|
Scope note: the |
Commit 0d8e6bd ("usb: dwc3: apple: select idle runtime PM by DT power domains, not a SoC list", merged in aurora-silicon#2299) replaced the inline SoC check in dwc3_apple_probe() with a call to dwc3_apple_idle_rpm(dev->of_node). atc-t8132-usb3.py extracts the early dwc3_apple_probe() prefix into its usb-native-shutdown host harness and stubs out probe helpers. Add the matching dwc3_apple_idle_rpm() stub so the host test compiles and passes again on main. Signed-off-by: Dj <[email protected]>
Problem
An idle Apple DWC3 controller (no cable, core down) could runtime-suspend only on T6040 and T8132
(
drivers/usb/dwc3/dwc3-apple.c:1841, from c8372a0 and 4cacc48). A port that never saw a cablecould suspend only on T8132 and on T6041 machines (
:1934, from 4cacc48 and dcb1f4f). The T6040commit left other SoCs out because they were untested. The glue, the DART runtime PM and the way the PHYs use
the controller's power domain are the same on every SoC. On T6000, T8112, T8140 and the others, an idle
controller and its DARTs stayed runtime-active after the first cable. The USB3 PHY was also optional only on
T8132 and T6040 (
:1863, from a50abc4).Change
iommusand everyPHY provider in its
physmust havepower-domains. That is what makes a domain drop safe: a DART is resumedbefore its consumer's domain is on, and a PHY in the domain either keeps it on, follows it, or holds it while
started. The never-plugged path uses the same property. Only a fixed-hub host is left out, because it starts
at probe.
usb3-phyis looked up as optional on every SoC. A DT that names it behaves as before.suspend clock rate. No functional change.
All 179 enabled DWC3 nodes in the 135 Apple DTBs have the property. The DWC3 DARTs already name their power
domain on every SoC, so this does not depend on any DT change.
The idle runtime PM mechanism is by Jonathan Goyvaerts (T6040), Erik Bourget (T8132) and AxxzyWasTaken (T6041).
This change only widens where it applies.
Why each SoC is safe
controller's domain is powered. A DART outside any domain would be restored into a block that is still off.
T8122, T6030, T6031, T8140, T8142) keep runtime PM disabled. genpd counts them as in use, so
atcN_usbstayson. On these SoCs an idle controller now suspends the glue and its two DARTs only. No block loses power, the
PHY is not power-cycled, and the base M1 USB3 handoff path is not reached by this.
restore_after_pd_off,idle_power_off).T8132 already ran this.
port suspends too, as T6041 ports already did.
usbdomain in its start and drops it in its stop, and its start runs the fullsequence again. While it is stopped, an idle controller's domain can now drop.
shutdown, and xHCI keeps the controller active as its child.
Other single-SoC gates in dwc3-apple.c (reviewed, kept)
Each of these follows a PHY IP or board difference:
dis_u3_susphyin host mode: those PHYs do not bring a SuperSpeed link back from U3.The ATC PHY's own
idle_power_off(T8132 only) is unchanged. The PHY documents that its DisplayPort andtunnel calls take no runtime PM reference.
Testing
Build (arm64, LLVM=1, release config, W=1) of
drivers/usb/dwc3/dwc3-apple.o: base, each commit and head build with 0 warnings and 0 errorsDT review of every enabled
apple,*-dwc3node, with its DARTs and PHY providers: 179/179 havepower-domains(T8103, T6000/1/2, T8112, T6020/1/2, T8122, T6030, T6031, T6040/1, T8132, T8140, T8142, T6050).Hardware, one-shot boot of a test kernel carrying this series (integration 0abc2f3 + this and other draft PRs), production Stage 2 DT, nothing plugged:
unsupportedon the current kernel,suspendedwith this series, at boot, after 20 s idle and after 3 s2idle cycles (rtcwake, ~20 s each, rc=0). 0 kernel errors, 0 DART errors, 0 AVC, 0 failed units, 28 DARTs bound as before.unsupportedbefore,suspendedwith this series; the in-use one staysactive. 3 s2idle cycles rc=0, 0 AVC, 0 failed units. Thegenpd_prepare returns -11line on 392280000.usb at each sleep is also on the current kernel (not from this series).unsupportedbefore,suspendedwith this series, same checks, 3 s2idle cycles clean, 34 DARTs bound as before.Still to run
Hardware rows, one combined test kernel:
active. Hub devices work, and one sleep/wake is clean (nochange expected): pending.