Repository navigation
T6050: J714s: a USB4 dock's router sleeps in place across a deep sleep, and the dock comes back - #2046
Merged
Conversation
…the sleep early when it cannot be saved The USB4 port's NHI and tunnelled PCIe DARTs on T6050 report layout v2.4. Admit it for the CIO snapshot: every register macOS writes on these DARTs at a wake is one the snapshot holds, at the same offset. Add a check that tells, with nothing captured or written, whether a later capture would be refused, so the router's sleep can be refused while everything still runs; the check applies to every CIO DART owner (the J713's too), refusing only what the later snapshot would have refused. A port DART that is removed gives up its clock protection before its power domain can go. Signed-off-by: Diljit Singh <[email protected]>
… sleep When the USB4 router behind it sleeps, take the tunnelled PCIe port down as macOS does: PME_Turn_Off through the port's +0x8c register, so the link reaches L2 before the routers sleep, then the port stopped and its DART saved. A tunnel that is gone with its dock after the sleep does not fail the resume: the port is closed as after an unplug and its functions come back with the dock. For a port that is powered off for the sleep instead, the disks behind the tunnel (NVMe) are removed in order first, unless one of them is in use. Signed-off-by: Diljit Singh <[email protected]>
…er's sleep For a USB4 router that sleeps in place, stop the combo PHY's CIO mode after the router (its processor idled, no power-down message) and start it again from cold in the same mode before the router's domains and processor at the wake. Give the router's host the calls it needs for a USB host kept on the router's USB3 tunnel: keep it, park its PIPE on the dummy producer behind the router's sleep, and report whether it was kept, parked or lost. A router whose dock did not come back does not get the tunnel's PIPE until the port starts again. Signed-off-by: Diljit Singh <[email protected]>
…h the router's sleep A host whose PIPE is on a USB4 router's USB3 tunnel stays up for the router's sleep, as on macOS: xHCI and the devices behind it suspend in place, the glue keeps the core powered, and the router's host parks the PIPE behind the router firmware's sleep. After the sleep a host that was kept goes on; one whose PIPE was parked, whose core was lost, or whose port controller asked for another role meanwhile is stopped and started again from a work, as after a cable's return. Signed-off-by: Diljit Singh <[email protected]>
…e across a deep sleep With a dock attached, the deep sleep was refused: the displays behind the dock's DP tunnels could not be released while the router stayed up. Put the routers to sleep in place instead, in macOS's order: - release every display behind every port before any port goes down, and hand no new tunnel to a display until the sleep is over; - give the host lane its PM roles and the CL-state cycle macOS uses, and skip the retimer scan on these links, which sends sideband operations macOS never sends and times the router firmware out; - take the tunnelled PCIe down to L2 and its power domain off, keep the USB host on its USB3 tunnel, then send the dock and the host router their wake and sleep words, the host router's firmware sleep request and its state save, and stop the router's processor, domains and PHY; - at the wake, start the PHY, the domains and the processor, give the router its saved state, its two wake operations and the cable word, and wait for the link. When the dock does not come back in place, the wake gives it up inside the resume: its tunnels are retired as after an unplug, the tunnelled PCIe port is closed, and the port starts again from cold, so the dock and its devices come back by re-enumeration. A step that fails before the router sleeps refuses the sleep with the router awake. A J714s port that does not sleep in place (no bindings, e.g. the left port) is powered off for the sleep instead and restarted after it (t6050_sleep_teardown, on by default; t6050_sleep_pcie selects how its PCIe tunnel goes). The control channel gets a frame recorder for diagnosis, off unless cio_frames is set. The waits are bounded: 10 ms for a router notification, 12 ms after the dock reports sleep ready. Signed-off-by: Diljit Singh <[email protected]>
…in place Give the right port's router what its sleep in place needs: the protection syscon, its combo PHY and the clock-protection slices of its NHI and tunnelled PCIe DARTs. Signed-off-by: Diljit Singh <[email protected]>
DjDeveloperr
force-pushed
the
j714s/usb4-dock-sleep
branch
from
November 16, 2026 07:18
6dd5cdb to
52ab745
Compare
DjDeveloperr
marked this pull request as ready for review
November 16, 2026 07:18
…n place
The harnesses that paste the CIO DART, PCIe-C, NHI and connection
manager code, and the apple-dcp dwc3 teardown unit, no longer matched
the code this branch changes:
- dart-cio-power: "iommu/apple-dart: T6050: take a v2.4 DART's CIO
snapshot, ..." admits layout v2.4, which T6050's ACIO and PCIe-C
DARTs report: every register a macOS wake writes on them is one the
snapshot holds. The case for a layout too new to be guessed at used
0x204; it uses 0x205. The round trips run v2.2 to v2.4, and a v2.4
disable writes the error status words 0 and 0x4204 all ones after the
error mask and before the streams (an older layout neither).
dart_cio_check() refuses what the capture refuses, with nothing
written: the layout and the TrustZone lock with the requesters
running, a fault, a busy queue and the error mask once they are
stopped; a stream enabled outside the bank is left to the capture.
- dart-cio-owner: the bank size is read by apple_dart_cio_bank() and
prepare() calls apple_dart_cio_check(); both are pasted, the
allocator-size mutation follows the helper, and an unsupported
layout is 0x205. Prepare now reads, and still writes nothing. New
cases: a v2.5 DART, or one without the TrustZone lock, refuses at
prepare with nothing stopped or left behind; the check with the
requesters stopped refuses a busy DART with nothing written and
leaves the snapshot to off(); a v2.4 DART's error interrupt enables
are put back after its restore, before it opens, when it reports
errors.
- cio-native: pcie-apple-cio.c has the T6050 PCIe-C stop beside the
generic one, and apple_nhi_cio_wake() a second
apple_pcie_tunnel_cio_lost(); four mutations matched both and are
anchored on the generic path. The T6050 code compiles against stubs;
the NHI's T6050 sleep is not modelled. New case: J714s's PCIe-C
refuses the sleep with its port untouched when its DART cannot be
saved.
- tb-cio-sleep: the model has the host's CIO quirks (from nhi.h), the
paths' and tunnels' sleep_lost and stubs for the J714s reports, which
stay off. New cases: a link that does not take its PM roles refuses
prepare; QUIRK_CIO_NO_ROUTER_STATE saves nothing and wakes as from
cold; QUIRK_CIO_WAKE_GIVES_UP goes on when the saved state is not
taken back, and waits 2 rounds, not 30, for a dock that is gone;
QUIRK_CIO_MACOS_FRAMES leaves the hops as they are for the sleep,
writes them after it, and finds them as they were after a refused one.
- apple-dcp: dwc3_usb_role_switch_set() keeps a role asked for during
the router's sleep in sleep_tunnel_role ("usb: dwc3: apple: J714s:
keep a host on a USB4 router's tunnel through the router's sleep").
The dwc3-teardown model struct has the two members, and a case checks
that such a role waits for the sleep's end.
Each new property has a negative control. No production code changes.
Signed-off-by: Diljit Singh <[email protected]>
… PHY "arm64: dts: apple: j714s: bindings for the right USB4 router's sleep in place" gives T6050 an "apple,t6050-ps-prot" syscon and the right port's ACIO an "apple,cio-phy" phandle. Neither was in a binding, and dt-checks reported three new CHECK_DTBS warnings for t6050-j714s.dtb. Add the compatible to syscon.yaml beside T8132's, and the property to the ACIO binding. Signed-off-by: Diljit Singh <[email protected]>
DjDeveloperr
force-pushed
the
j714s/usb4-dock-sleep
branch
from
November 16, 2026 08:38
39c2b0b to
3bd96fa
Compare
DjDeveloperr
added a commit
that referenced
this pull request
Nov 16, 2026
thunderbolt: apple: T6050: J714s: the dock's USB4 link trains in place after a deep sleep (follow-up to #2046)
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.
What this does
Based on 3b2bee19, the merge of #2029, #2030 (merged) and #2031 (open,
j714s/resume-tail): it depends on #2031.On the M5 Pro (J714s, T6050) a deep sleep with a USB4/Thunderbolt dock on the right port was refused: the displays behind
the dock's DP tunnels could not be released for the sleep while the dock's router stayed up, and a given-up sleep left
the dock's USB dead. This series lets the dock's router sleep in place across the deep sleep, in the order macOS uses,
and makes sure the dock comes back afterwards:
iommu/apple-dart: the NHI and tunnelled-PCIe DARTs (layout v2.4) can be snapshotted; a DART that could not besaved refuses the sleep before the router is told to sleep; a removed port DART drops its clock protection first.
PCI: apple: the tunnelled PCIe port goes down to L2 (PME_Turn_Off through +0x8c) before the routers sleep; a tunnelgone with its dock does not fail the resume.
phy: apple: atc-t6050: the combo PHY's CIO mode is stopped after the router and started from cold before it; callsfor a USB host kept on the router's USB3 tunnel (keep / park the PIPE / result).
usb: dwc3: apple: a host on the router's USB3 tunnel stays up (xHCI in U3) through the router's sleep; one that wasparked or lost is restarted from a work afterwards, as after a cable's return. Ported onto the work-based glue of
a667121.
thunderbolt: apple: displays behind every port released first; PM roles, CL cycle and no retimer scan on theselinks; the dock's and host router's sleep words, the firmware sleep request and state save; at the wake the state
back, the two wake operations and the cable word. If the dock is not back in place, the wake gives it up inside
the resume, retires its tunnels as after an unplug and restarts the port from cold: the dock re-enumerates.
arm64: dts: apple: j714s: the right router's bindings for the sleep in place.New hardware paths are J714s/T6050-gated (the DART CIO early check is read-only and applies to every CIO DART owner,
J713 included). Shared code changes (thunderbolt core: switch.c, ctl.c, clx.c, retimer.c, tb.c, tunnel.c, domain.c,
path-sleep.c; dwc3-apple; apple-dart-cio; tb-cio-sleep), so before merge: Neo (T8140) dwc3/USB sleep-resume rows and
a J713 docked-sleep row. A J714s port without the bindings (the left one) is powered off for the sleep and restarted
after it (
thunderbolt_apple.t6050_sleep_teardown, default on).thunderbolt.cio_framesadds an off-by-defaultcontrol-frame recorder. Many log lines are still verbose test lines.
Works (measured on the M5, private builds of this code on the panel-wake series, dock: TB5 dock on the right port)
both dock displays (DP-2, DP-3) were back by the end of the pass, about 14 s after the wake.
Does not work yet
"SBX disconnected!" after 1 s), so every wake is the slow re-enumeration path. Work continues.
its hardware run is pending (same code as the private test builds, with the dwc3 part adapted to the new glue and the
disk walk below the tunnel rewritten without unexported symbols).
🤖 Generated with Claude Code