Skip to content

T6050 sleep: select usb/phy/thunderbolt/pci/iommu/nvme handling by hardware, not board - #2441

Draft
RyanTheTide wants to merge 8 commits into
integration/aurorafrom
spec-m5neo/t6050-sleep-gates-io
Draft

RyanTheTide wants to merge 8 commits into
integration/aurorafrom
spec-m5neo/t6050-sleep-gates-io

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem: the T6050 (M5 Pro/Max) deep-sleep handling in dwc3-apple, the atc-t6050 PHY, thunderbolt, PCIe/PCIe-C, the DARTs and NVMe is switched on by board name (of_machine_is_compatible("apple,j714s") || ...("apple,j716c")), about 25 times. Adopted-link s2idle is switched on by another list of four boards.

Change: every J714s/J716c pair becomes apple_t6050_sleep_described(), which is true when the DT has an available apple,t6050-sleep node. Only the J714s and J716c trees have one, so on every board in the tree today nothing changes. Boards that gain the sleep description later (K116s #2201, K114c #2089) get the handling with no code edit. A separate last commit drops the board list from the adopted-link s2idle check, because that check validates the link itself. That commit does change behaviour on J714c, J716s and J775d, and can be dropped on its own.

This builds on the helper commit at the base of #2440 (same commit, so either PR can merge first).

Testing: W=1 compile of dwc3-apple.o, atc-t6050-dp.o (with atc-t6050-combo.h), thunderbolt apple.o (with apple-cio-sleep.c), switch.o, retimer.o, pcie-apple.o (with pcie-apple-cio.c), apple-dart.o (with apple-dart-cio.c and the v27 admission .inc) and nvme/host/apple.o (with apple-m5-sleep.h), release config, clang, at base and with this branch: all build, no code warnings before or after. DTB check as in #2440.

Still to run: @DjDeveloperr @erikwb, could you give a J714s and J716c row (deep sleep with a USB4 dock attached, and resume)? For the s2idle commit, a row from anyone with a J714c, J716s or J775d (echo freeze > /sys/power/state) would help. @Isaac-Duarte @axboe, you ran the J714s and K116s s2idle; could you rerun it? This is a draft until those rows are in.

Related: #2384 edits sleep.h next to the helper. It merges cleanly with this branch (git merge-tree with 8407d40).

Details: per-gate table, kept gates, rows to run
File:line (0abc2f3) Old New Before After
dwc3-apple.c:1091, 1475 j714s, j716c apple,t6050-sleep J714s, J716c J714s, J716c
atc-t6050-combo.h:131, atc-t6050-dp.c:1334 j714s, j716c same J714s, J716c J714s, J716c
apple-cio-sleep.c:326, 452, 900, 909, 956, 973 j714s, j716c same J714s, J716c J714s, J716c
thunderbolt apple.c:3991, switch.c:3822, 4105, 4144, retimer.c:510 j714s, j716c same J714s, J716c J714s, J716c
pcie-apple.c:4315, 5429, 7344; pcie-apple-cio.c:203, 391 j714s, j716c same J714s, J716c J714s, J716c
apple-dart-cio.c:400 j714s, j716c same J714s, J716c J714s, J716c
apple-dart-v27-admission.inc:13 j714s or (j716c and t6050) same J714s, J716c J714s, J716c
nvme apple-m5-sleep.h:172 t6050 and (j714s or j716c) t6050 and apple,t6050-sleep J714s, J716c J714s, J716c
pcie-apple.c:6777 (s2idle, separate commit) j716c, k114c, k116s, j714s any adopt_link host (the caller's condition) those 4 trees with the T6050 host enabled and an adopted port: J714c, J714s, J716c, J716s, J775d, K114c, K116s

The s2idle commit is safe because the check does not change: before the suspend, the root complex must run, every port's link must be up with no link-down pending, and every device must read back in D0 (or, below a kernel-trained port, be one the PCI core restores). The same is checked at the resume, and the ports are failed if the link was lost. If the checks fail, s2idle is refused as before.

Kept on purpose (J714s-only, not widened, because widening would change the J716c without a run there):

  • thunderbolt apple.c:3272, tb-cio-sleep.c:252, pcie-apple-cio.c:234/246: TEST logging for J714s trace runs. It reads router config and DART words in the sleep path.
  • apple-dart.c:5461 ISP DART restore after the sleep: the J716c ISP has its own description and has not run this restore. Once the J716c has a row, it can move to the helper.

Hardware rows (J714s/J716c with deep sleep): dock on a USB4 port, echo deep > /sys/power/mem_sleep; echo mem > /sys/power/state. Expect the same dmesg as the current tip: "T6050 sleep" lines from apple-cio-sleep, the PCIe-C suspend through apple_pcie_cio_suspend_t6050, the NVMe sleep attached, and the dock back after the resume. On boards without the node (all other T6050, T6040, T8140, T6000, T8112) these paths stay off, as before.

Original work: the T6050 sleep handling is DjDeveloperr's, the J716c extension Erik Bourget's, and the s2idle qualification is from Erik Bourget, Isaac Duarte, Jens Axboe and Joshua Warren.

Assisted-by: LLM (Claude:Opus 5.5)

Several drivers select their T6050 (M5 Pro and Max) deep-sleep handling
with a list of boards, the ones the sleep has run on (J714s, J716c). What
those boards have in common is in the device tree: an available
sleep-controller node, compatible "apple,t6050-sleep". No other board in
the tree has one; a board gains it with its sleep description.

Add apple_sleep_described(compatible), true when an available node with
that compatible exists, and apple_t6050_sleep_described() for
"apple,t6050-sleep". Both are static inline and independent of
CONFIG_APPLE_SOC_SLEEP, as the board checks they replace are.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…ption

The wait for a Type-C PHY after a T6050 deep sleep and the USB host kept
on a USB4 router's tunnel through the router's sleep were enabled on the
J714s and the J716c by board name. Both belong to the T6050 sleep, so
select them where the device tree describes it (apple,t6050-sleep): the
same two boards in the tree today, so nothing changes.

Fixes: 302cc4e ("usb: apple: follow the T6050 sleep rules on the J716c")
Fixes: 6b8fbf6 ("usb: dwc3: apple: J716c: keep the USB host's tunnel over a router's sleep in place")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…tion

The combo PHY's deep-sleep handling and the CIO USB keep step for a
router's sleep in place were enabled on the J714s and the J716c by board
name. Select them where the device tree describes the T6050 sleep
(apple,t6050-sleep): the same two boards in the tree today, so nothing
changes.

Fixes: 9e0722d ("phy: apple: atc-t6050: the combo PHY's deep-sleep rules on the J716c too")
Fixes: 3ea2343 ("phy: apple: atc-t6050: J716c: the CIO USB step for a router's sleep in place")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…ption

The USB4 router's sleep in place across a T6050 deep sleep (the owner
bind, the CIO USB bind, the LSTX hold, the router and tunnelled PCIe
domain steps, the dock's sleep spacing, the PM roles, the host router's
state and the skipped retimer scan) was enabled on the J714s and the
J716c by board name. Select it where the device tree describes the T6050
sleep (apple,t6050-sleep): the same two boards in the tree today, so
nothing changes.

The TEST-only logging that reads router and DART words on the J714s
(apple_cio_test_log_guards(), tb_cio_test_on()) is left as it is: it is
instrumentation for J714s trace runs, and widening it would add config
reads in the J716c sleep path.

Fixes: 8db5275 ("thunderbolt: apple: T6050: J716c: the USB4 router sleeps in place, as on the J714s")
Fixes: 1d2639d ("thunderbolt: apple: T6050: J716c: the router's domain step and LSTX hold as on the J714s")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The T6050 sleep handling in the PCIe and PCIe-C drivers (the router
sleep in place for the tunnel's port, the adopted host's firmware sleep,
the tunnel gone with its dock, the PCIe-C PME_Turn_Off register and
suspend path) was enabled on the J714s and the J716c by board name.
Select it where the device tree describes the T6050 sleep
(apple,t6050-sleep): the same two boards in the tree today, so nothing
changes.

The TEST-only logging in pcie-apple-cio.c stays on the J714s: it is
instrumentation for J714s trace runs.

Fixes: 28b371b ("PCI: apple: T6050: J716c: the tunnelled PCIe over a router's sleep in place")
Fixes: 008cad8 ("PCI: apple: T6050: the radio host's deep sleep on the J716c too")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…ption

The USB4 router's DARTs sleeping in place and the display DART leases
over a T6050 deep sleep were enabled on the J714s and the J716c by board
name. Select them where the device tree describes the T6050 sleep
(apple,t6050-sleep): the same two boards in the tree today, so nothing
changes.

The ISP DART's restore after the sleep stays on the J714s: the J716c's
ISP has its own description and this restore has not run there, so
widening it would change the J716c.

Fixes: 5a72f37 ("iommu/apple-dart: cio: the USB4 router's DARTs sleep in place on the J716c")
Fixes: 8741075 ("iommu/apple-dart: v27: the display DART leases on the J716c")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The ANS2 sleep attachment was made on a machine that is "apple,t6050"
and "apple,j714s" or "apple,j716c". Its own comment gives the reason:
T6050 ANS2's split NVMe/NVMMU layout and retained SART, which are the
SoC's. The attachment belongs to the T6050 sleep, so make it on a T6050
where the device tree describes that sleep (apple,t6050-sleep): the same
two boards in the tree today, so nothing changes. It still needs the
node's apple,sleep-wake-delay-ms, which only those two boards carry.

Fixes: aff6795 ("nvme: apple: the T6050 ANS2 sleep attachment on the J716c")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
A host that adopts the boot loader's link (hw->adopt_link) keeps its
running hierarchy through suspend-to-idle only on the J716c, K114c,
K116s and J714s; on another board it refuses the noirq suspend. The
mechanism does not depend on the board: before the suspend it checks
that the root complex runs, every port's link is up and every device
below it reads back in D0 (or, below a kernel-trained port, is one the
PCI core restores), and it checks the same again at the resume, failing
the ports if the link was lost.

Drop the board list. The boards that change are the other T6050 trees
with an adopted port and the host enabled: J714c, J716s and J775d. On
those, s2idle is now taken when the checks pass, instead of refused;
when they fail it is refused as before.

Fixes: d0c84b3 ("PCI: apple: Allow retained-link s2idle on J716c")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant