Skip to content

T6050: a "freeze" with mem_sleep at deep is a suspend-to-idle (no dock teardown, no -67) - #2510

Merged
DjDeveloperr merged 4 commits into
aurora-silicon:integration/aurorafrom
Isaac-Duarte:j714s/freeze-under-deep
Nov 20, 2026
Merged

DjDeveloperr merged 4 commits into
aurora-silicon:integration/aurorafrom
Isaac-Duarte:j714s/freeze-under-deep

Conversation

@Isaac-Duarte

@Isaac-Duarte Isaac-Duarte commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

With mem_sleep at deep, writing freeze to /sys/power/state (rtcwake -m freeze) on a T6050 with a sleep profile got the whole firmware-sleep preparation and was then refused with -67. On my J714s it also cost the dock its USB4 link. Now a freeze is treated as the suspend-to-idle it is, whatever mem stands for.

Why

The drivers that prepare a firmware sleep before the freezer do it in their PM_SUSPEND_PREPARE notifiers: the USB hosts are stopped (dwc3-apple), a USB4 port without a router sleep in place is powered off (thunderbolt), the SD card reader's port is parked (pcie-apple). They decide with pm_suspend_default_s2idle(), which says what mem stands for, not which state was written. pm_suspend_target_state and PM_SUSPEND_FLAG_NO_PLATFORM are set in suspend_devices_and_enter(), after the notifiers, so a notifier cannot tell a freeze from a platform sleep.

So a freeze under deep was prepared as a deep sleep and entered as s2idle, where the PCIe host's adopted-link check found the parked port's link down:

thunderbolt-apple-acio 2a9ac0000.acio: powering off port for system sleep (cable info 0x801)
pcie-apple 1cb0000000.pcie: port 1: parked for the sleep, its functions removed, its DART saved and gated
pcie-apple 1cb0000000.pcie: PM: dpm_run_callback(): apple_pcie_suspend_noirq returns -67
pcieport 0000:00:01.0: Unable to change power state from D3hot to D0, device inaccessible

axboe saw the same refusal on the K116s, 3 of 3 (his row on #2441). On the J714s, with a TB5 dock on the left-front port, the port's cold restart after the refused freeze did not get the USB4 link back (Timeout for at_rt command response, register 12, no thunderbolt 0-1: new device found): the dock was a USB2 hub from then on. A USB camera on the right port stopped answering control requests after it too.

What

Four commits:

  1. PM: suspend: enter_state() sets PM_SUSPEND_FLAG_NO_PLATFORM for a suspend-to-idle right after the flags are cleared, before the notifiers (kernel/power/suspend.c, +3). The later set in suspend_devices_and_enter() stays for the callers that skip enter_state(). A comment in the T8140 bootstrap that described the flag as unset in its notifier is brought up to date; that notifier vetoes nothing either way.
  2. thunderbolt: apple: the two decisions made at PM_SUSPEND_PREPARE, the port's power-off (apple_cio_sleep_tears_down()) and the displays' release ahead of it (apple_cio_sleep_dp_entry()), are "no" for a suspend-to-idle: the port stays up with its tunnels.
  3. usb: dwc3: apple: sleep_deep is false for a suspend-to-idle: the hosts stay.
  4. PCI: apple: the T6050 notifier does not park a port for a suspend-to-idle.

Each driver change is a test of pm_suspend_no_platform() at the notifier's decision. A deep sleep (mem under deep) and an s2idle under mem_sleep=s2idle take the same branches as before.

The thunderbolt test is not in apple_cio_t6050_sleep() itself: the power-off also runs from a work, for a sleep given up with the displays released, and reads that predicate several times on the way, so a freeze written while the work runs would change the answer under it.

One refusal is new: a suspend-to-idle written while such an undo is still owed (the sleep was given up, its work has not started) gets -EBUSY ahead of the freezer, and the work brings the displays back. A firmware sleep takes the undo over, since it powers the port off and restarts it; a suspend-to-idle cannot. Before, an s2idle there dropped the undo and the displays stayed off until a replug.

Tested

J714s (14-inch M5 Pro), kernel 0abc2f3 plus my carried PRs, these four commits, #2144 and #1996.

before with this
freeze under deep, nothing on the ports refused, -67 slept, woken by a key; the SD port not parked, no -67
freeze under deep, TB5 dock on left-front (three tunnelled displays, tunnelled PCIe, Ethernet) port powered off, xHCI hosts removed, -67, the dock's USB4 link lost no port power-off, no xHCI removal, no parking. Then refused at noirq by the NHI's DP tunnel check (-16), as a plain s2idle with a docked display is; the three displays, Ethernet and the USB tree were back 3 s later, the USB tree identical
deep sleep (mem under deep), five in one boot as before: the dock's port powered off, the SD port parked each time, each sleep and wake fine
s2idle (mem under s2idle) after those as before

The runs above had the thunderbolt test inside apple_cio_t6050_sleep(); it moved to the two PM_SUSPEND_PREPARE decisions in review. The dock row was run again with this PR's head (the same dock, three displays, tunnelled PCIe and Ethernet on left-front): the same result, no port power-off, no xHCI removal, no parking, the NHI's refusal, and the displays, Ethernet and an identical USB tree back 4 s after the entry. The new refusal has not been exercised: no sleep was given up with the displays released.

Host tests pass (tools/asahi/run-host-tests.py, the whole set, merged onto 1473d15).

Not changed

  • The PHY's notifier (combo_pm_notify), the display's (dcp_s2r_pm_notify) and the T8140 PCIe notifier (apple_pcie_neo_pm_notify) still ask pm_suspend_default_s2idle() alone. No failure was seen from them here: the PHY's keeps the always-on domain for the transition, which an s2idle keeps anyway.
  • A plain s2idle with a display on the dock is still refused by the NHI (-16, by design).

PM_SUSPEND_PREPARE notifiers run before suspend_devices_and_enter() sets
pm_suspend_target_state and PM_SUSPEND_FLAG_NO_PLATFORM, so a notifier
cannot tell a "freeze" from a platform sleep. The Apple drivers that
prepare a firmware sleep in their notifier (USB hosts stopped, a USB4
port powered off, a PCIe port parked) ask pm_suspend_default_s2idle()
instead, which only says what "mem" stands for: with mem_sleep at deep,
a "freeze" gets the whole firmware-sleep preparation.

Set the flag in enter_state(), right after the flags are cleared and
before the notifiers. Nothing reads it in between today: every other
reader is a device or platform callback, which runs after the later set.
That set stays for the callers of suspend_devices_and_enter() that skip
enter_state().

The T8140 bootstrap's notifier had a comment on the flag being unset
there; it vetoes nothing in the notifier either way.

Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com>
…the default

The PM notifiers take a sleep for a firmware sleep from mem_sleep alone.
With mem_sleep at deep a "freeze" is still a suspend-to-idle, but the
notifiers released the displays behind the port, removed the tunnelled
PCIe functions and powered the port off for it. On a J714s with a dock
on the left front port (acio1, which has no sleep in place) that cost
the dock's USB4 link for a sleep that never needed it:

  thunderbolt-apple-acio 2a9ac0000.acio: T6050 sleep: 3 display request(s) behind this port ended in 214 ms
  thunderbolt-apple-acio 2a9ac0000.acio: powering off port for system sleep (cable info 0x801)
  thunderbolt 0-1: device disconnected
  thunderbolt-apple-acio 2a9ac0000.acio: restarting port after system sleep
  thunderbolt-apple-acio 2a9ac0000.acio: T6050 sleep: router firmware reports lane init action 0 (a cold start)
  ... Timeout for at_rt command response expired!!!. register=12

The suspend core's flag now says at the notifiers that the sleep is a
suspend-to-idle. Ask it in the two decisions made at PM_SUSPEND_PREPARE,
the port's power-off and the displays' release ahead of it: the port
then stays up with its tunnels, as it does with mem_sleep at s2idle.

apple_cio_t6050_sleep() itself is left alone. The power-off also runs
from a work, for a sleep given up with the displays released, and reads
it several times on the way: a "freeze" written while that work runs
would change the answer under it.

A suspend-to-idle written before that work has started is refused
(-EBUSY) ahead of the freezer, and the work is left to bring the
displays back: unlike a firmware sleep it does not power the port off
and restart it, so it cannot take the owed undo over.

Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com>
The PM notifier takes the sleep for a firmware sleep whenever mem_sleep
is at deep, and stops the running hosts it does not keep in place for
it. A "freeze" with mem_sleep at deep is a suspend-to-idle: the
controllers keep their power, and their hosts were removed and every
device enumerated again for nothing. On a J714s a webcam that had just
been through that (046d:0943 on the right port) stopped answering
control requests 0.3 s after its new enumeration.

Ask the suspend flag too, which now says at the notifiers that the
sleep is a suspend-to-idle: the host then stays, as it does with
mem_sleep at s2idle.

Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com>
The PM notifier parks the SD card reader's port ahead of a firmware
sleep whenever "mem" stands for deep. A "freeze" entered with that
default is a suspend-to-idle all the same: the host's noirq callback
then runs the adopted link's s2idle check, finds the parked port's link
down and refuses the suspend:

  pcie-apple 1cb0000000.pcie: PM: dpm_run_callback(): apple_pcie_suspend_noirq returns -67
  pcieport 0000:00:01.0: Unable to change power state from D3hot to D0, device inaccessible

Seen on a J714s with mem_sleep at deep and "rtcwake -m freeze", and on
a K116s tree that describes the sleep (the K116s row on aurora-silicon#2441). The
suspend core now marks a suspend-to-idle before the notifiers run:
leave the port alone then, as with mem_sleep at s2idle.

Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com>
@DjDeveloperr
DjDeveloperr merged commit 61295c2 into aurora-silicon:integration/aurora Nov 20, 2026
7 checks passed
@DjDeveloperr

DjDeveloperr commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Merged as 61295c26102d (head fb7f226acba6, unchanged), for the M5 ship candidate.

Review (independent, code only): no blocking issue.

  • mem under deep: sets no flag before the notifiers, and every changed decision takes its old branch. mem under s2idle still short-circuits on pm_suspend_default_s2idle().
  • Earlier flag readers: nothing outside the three new checks reads PM_SUSPEND_FLAG_NO_PLATFORM between enter_state() and suspend_devices_and_enter(). ACPI EC, intel-hid, pci-driver, mt7932 and cfg80211 all read it from device callbacks, so other platforms see no change.
  • New -EBUSY: it can't wedge sleep, because the undo work clears sleep_dp_undo under acio->lock.

CI is green, including kunit, rust-build and the DWC3/ATC configs.

Notes for a follow-up (none blocking):

  1. The new refusal is silent. A dev_info would say who refused the freeze.
  2. The refusal is wider than its comment. The sleep_dp_undo && !apple_cio_sleep_tears_down() refusal also catches a deep sleep if the NHI sets sleep_in_place, or t6050_sleep_teardown is cleared, between a given-up sleep and its undo work. That is arguably better than before, but "deep is unchanged" isn't literally true there. Reword the comment or gate the check on pm_suspend_no_platform().
  3. The dwc3 change reaches every dwc3-apple SoC. On the Neo (T8140), a freeze under deep now keeps the hosts, while apple_pcie_neo_pm_notify still prepares a deep sleep. That mix is untested off the J714s. Real deep sleep is unaffected.
  4. s2idle_teardown=1 gives a mixed path. With that debug parameter, a freeze skips the paused display release but still gets the T6050 teardown.

Update 00:45: the local object compile has now passed. All touched objects built with the M5 asahi config at W=1 with no compiler warnings, on integration 449c6a19 merged with all three PRs (and #2515). The integration tip de2c29696952 has byte-identical sources for these files.

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.

2 participants