Repository navigation
phy: apple: t6040: keep a running coprocessor's domains on through s2idle - #2855
Conversation
…idle
In suspend-to-idle the Type-C link stays up: the USB4/Thunderbolt
router holds its own power domains out of the system transition while
a cable is set up, and nothing stops a running PHY coprocessor. genpd
still powered off this PHY's domain (common_dp, and phymxwrap above it)
in its noirq phase, under the running coprocessor. The link died
shortly after resume ("SBX disconnected"), and the detach that followed
found a coprocessor that no longer answered:
RTKit: AP idle not acknowledged: -62
USB3: PHY coprocessor idle failed: -62
...
RTKit: endpoint discovery failed: -62
sn201202x 1-0c: failed to configure Type-C connection: -62
From then on every start failed the same way until a reboot, hard
recoveries included, although a hard recovery brings back a port that
never slept.
Hold the PHY device out of the whole suspend-to-idle transition, from
before its prepare to after its complete, while its coprocessor runs,
so genpd leaves its domains on. Sleeps the platform firmware takes part
in are left as they were (pm_suspend_no_platform() is false there).
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Review at a9454a5. The diagnosis looks right and the hold/release pairing is balanced, but the check happens once at the wrong time, and the cost of holding the domains on hasn't been measured.
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial pre-PR checklist (§1–§6) review at a9454a5477b4c3be07c6b962e5f61fbfcb9731a7 (host-tests: SUCCESS).
Verdict: REQUEST CHANGES — the root-cause diagnosis is solid and matches the T6050 #2664 class of bug, and the commit/PR hygiene (§4, §6) is clean, but the PM_SUSPEND_PREPARE + dev_pm_syscore_device() mechanism has real suspend/resume state-machine gaps and key §1/§5 hardware evidence is still owed.
Blocking findings
-
Late-attach and dark-wake sampling gap (
drivers/phy/apple/t6040-usb2.c:2145-2171):t6040_pm_notify()samplestphy->rtk && apple_rtkit_is_running(tphy->rtk)only once atPM_SUSPEND_PREPARE(before task freezing and beforedpm_prepare()/dpm_suspend()).- Two live paths can start the PHY coprocessor after
PM_SUSPEND_PREPAREwhiles2idle_heldremainsfalse:- A Type-C / USB4 / USB3 attach between
PM_SUSPEND_PREPAREanddpm_suspend_noirq(). - A dock/partner attach during a dark wake:
enter_state()(kernel/power/suspend.c) loopswhile (!error && pm_dark_wake()) suspend_devices_and_enter(state);without re-invokingPM_SUSPEND_PREPARE, so the notifier never runs again before the nextdpm_suspend_noirq().
- A Type-C / USB4 / USB3 attach between
- In both cases genpd cuts
atc*_common_dpandatc*_phymxwrapunder a running coprocessor, reproducing the original unrecoverableAP idle -62wedge. The reviewer note claiming hard recovery covers post-PREPARE starts contradicts the PR's own data (hard recovery fails 16/16 when power is cut under a running coprocessor; it only recovers when the coprocessor was stopped beforehand).
-
Runtime PM stays active through
suspend_late/noirqunderdev_pm_syscore_device()(drivers/phy/apple/t6040-usb2.c:2155):- Unlike
#2664(which holds domains insuspend_lateand freezes mode/gate transitions underdp->lock),dev_pm_syscore_device(tphy->dev, true)skipsdpm_prepare()anddpm_suspend_late()fortphy->dev, so the PM core never takes its prepare runtime-PM reference or callspm_runtime_disable(). - Because
sn201202xkeeps its event IRQ live (IRQF_NO_SUSPEND), a cable pull or recovery path during sleep can invokepm_runtime_put(tphy->dev)(viat6040_cio_down_locked()/t6040_usb2_reset_assert()) orpm_runtime_force_suspend(tphy->dev)(viat6040_usb3_hard_recover()) mid-sleep, droppingcommon_dp/phymxwrapin the noirq window or leavings2idle_helddesynchronized from actual coprocessor state. - Recommended fix: align with Ryan's comment and the existing in-tree mechanism — evaluate
tphy->rtk && apple_rtkit_is_running(tphy->rtk)in a.suspendcallback (whenpm_suspend_no_platform()is true) and calldevice_set_awake_path(dev)(asdrivers/iommu/apple-dart.c:7196does), paired withapple,sleep-wakeup-pathonps_atc*_common_dp/ps_atc*_phymxwrapsopmgr-pwrstate.c:1028-1035setsGENPD_FLAG_ACTIVE_WAKEUP. That evaluates live on every suspend entry (including late attaches and dark wakes), keeps PM core runtime-PM disablement intact, and removes the PM notifier anddev_pm_syscore_device()flag.
- Unlike
-
Plain USB3 and DP pin D behavior across s2idle:
apple_rtkit_is_running(tphy->rtk)is true not only for CIO (USB4/TB), but also for plain USB3 host mode (t6040_usb3_up_locked()) and 2-lane DP pin D (t6040_dp_power_on()). Plain USB3 has no USB4 router keeping sibling domains awake; it needs an explicit decision (hold vs. cleant6040_usb3_firmware_power_down()before sleep) and a test row either way.
-
Missing §1 / §5 hardware evidence and power-drain measurement:
- No before/after long-sleep s2idle power-drain row on J616s with the USB4 partner attached to quantify keeping
common_dp+phymxwrap+ coprocessor powered through s2idle. - Missing functional rows for: plain USB3 across s2idle, cable pull during sleep, and attach during sleep / dark wake.
apple,t6040-atcphyalso binds on T6041 (J575c,t6041-j575c-atc3.dtsi) andJ773s(t6040-j773s-usb-front.dtsi), plusJ614s; s2idle coverage on the other T6040/T6041 boards is still owed per §1 / §5.
- No before/after long-sleep s2idle power-drain row on J616s with the USB4 partner attached to quantify keeping
§1–§6 Checklist Summary
- §1 No model gating: Pass on code (no chip/board/firmware gates;
pm_suspend_no_platform()leaves firmware sleep untouched); broader T6040/T6041 hardware verification owed. - §2 Production-ready: Blocked —
PM_SUSPEND_PREPAREsampling gap anddev_pm_syscore_device()runtime-PM bypass need rework. - §3 Safety: Blocked — runtime-PM /
pm_runtime_force_suspend()hazard during noirq on cable-pull-in-sleep. - §4 Clean-room & attribution: Pass (human author/committer + human
Signed-off-by:only, zero AI trailers in commits,Assisted-by:in PR body). - §5 Evidence: Partial — strong J616s USB4 before/after +
pm_test=devices+ fault-injection + 0 errors/denials/failed units, but missing drain row, plain-USB3, cable-pull/attach-in-sleep, and J575c/J773s rows. - §6 Naming: Pass.
Assisted-by: LLM (Gemini 4 Neon)
|
Executed review at a9454a5: a model of 1. A coprocessor started during a dark wake is not held, and its domain goes off under it (confirmed). 2. Runtime PM during the transition is not a hole in this tree. 3. Checked and fine: Suggested direction, as in the review above: decide in a Probe results and methodPR tree + a local-only probe (not part of any branch), x86_64 tiny config (PM core is arch-independent; ACPI off so s2idle has no platform ops), KVM. Two fake Side observation, not about this PR and seen in the model only: if the wake that ends the first pass leaves Probe source (rw5_probe.c, local only)// SPDX-License-Identifier: GPL-2.0
/*
* REVIEW-WAVE-5 local probe (never committed): models linux#2855 a9454a54
* t6040_pm_notify() (dev_pm_syscore_device hold sampled at PM_SUSPEND_PREPARE)
* against the awake-path alternative (device_set_awake_path from .suspend +
* GENPD_FLAG_ACTIVE_WAKEUP), on fake genpd domains, through real s2idle cycles
* incl. enter_state()'s dark-wake loop.
* phy0 in pd_a: PR notifier logic (copied). phy1 in pd_b: awake-path.
* helper (no domain): sets dark wake in resume_noirq (as macsmc does), does the
* scenario's "attach"/"detach", arms the wake hrtimer in suspend_noirq.
*/
#include <linux/hrtimer.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
#include <linux/pm_runtime.h>
#include <linux/pm_wakeup.h>
#include <linux/suspend.h>
static struct generic_pm_domain pd[2];
static struct platform_device *phy[2], *helper;
static bool running[2]; /* "coprocessor running" */
static int offs[2], off_running[2], ons[2];
static bool held; /* PR's s2idle_held */
static int scenario, cycle, dark_left;
static bool cancel_abort; /* model a re-entry the pending wake does not abort */
static int r_main_put, r_noirq_suspend, st_main, st_noirq;
static struct hrtimer wake_timer;
static int pd_off(struct generic_pm_domain *g)
{
int i = g == &pd[1];
offs[i]++;
if (running[i])
off_running[i]++;
pr_info("rw5: %s OFF (cycle %d, coprocessor %s)%s\n", g->name, cycle,
running[i] ? "RUNNING" : "stopped", running[i] ? " <== BUG" : "");
return 0;
}
static int pd_on(struct generic_pm_domain *g)
{
ons[g == &pd[1]]++;
pr_info("rw5: %s ON (cycle %d)\n", g->name, cycle);
return 0;
}
/* --- PR logic, copied from t6040_pm_notify() (mutex dropped: single-threaded probe) --- */
static int pr_notify(struct notifier_block *nb, unsigned long action, void *data)
{
switch (action) {
case PM_SUSPEND_PREPARE:
if (!pm_suspend_no_platform())
break;
if (running[0]) {
dev_pm_syscore_device(&phy[0]->dev, true);
held = true;
pr_info("rw5: PREPARE: phy0 held (syscore)\n");
} else {
pr_info("rw5: PREPARE: phy0 not running, not held\n");
}
break;
case PM_POST_SUSPEND:
if (held) {
dev_pm_syscore_device(&phy[0]->dev, false);
held = false;
pr_info("rw5: POST_SUSPEND: phy0 released\n");
}
break;
}
return NOTIFY_DONE;
}
static struct notifier_block pr_nb = { .notifier_call = pr_notify };
static enum hrtimer_restart wake_fn(struct hrtimer *t)
{
pm_system_wakeup();
return HRTIMER_NORESTART;
}
static int phy_suspend(struct device *dev)
{
if (dev == &phy[1]->dev && running[1])
device_set_awake_path(dev);
return 0;
}
static int helper_suspend(struct device *dev)
{
cycle++;
if (scenario == 2) { /* detach while phy0 is held, main suspend phase */
running[0] = false;
r_main_put = pm_runtime_put_sync(&phy[0]->dev);
st_main = pm_runtime_status_suspended(&phy[0]->dev);
}
return 0;
}
static int helper_suspend_noirq(struct device *dev)
{
if (scenario == 2) {
r_noirq_suspend = pm_runtime_suspend(&phy[0]->dev);
st_noirq = pm_runtime_status_suspended(&phy[0]->dev);
}
hrtimer_start(&wake_timer, ms_to_ktime(400), HRTIMER_MODE_REL);
return 0;
}
static int helper_resume_noirq(struct device *dev)
{
if (dark_left > 0) {
dark_left--;
pm_set_dark_wake();
if (cancel_abort)
pm_system_cancel_wakeup();
pr_info("rw5: resume_noirq: dark wake set (cycle %d)%s\n", cycle,
cancel_abort ? ", pending wake cancelled" : "");
}
return 0;
}
static int helper_resume(struct device *dev)
{
if ((scenario == 3 || scenario == 5) && pm_dark_wake()) { /* attach during the dark wake */
running[0] = running[1] = true;
pr_info("rw5: dark wake: attach, coprocessors started\n");
}
return 0;
}
static int rpm_cb(struct device *dev) { return 0; }
static const struct dev_pm_ops phy_pm = {
.suspend = phy_suspend,
RUNTIME_PM_OPS(rpm_cb, rpm_cb, NULL)
};
static const struct dev_pm_ops helper_pm = {
.suspend = helper_suspend,
.resume = helper_resume,
.suspend_noirq = helper_suspend_noirq,
.resume_noirq = helper_resume_noirq,
};
static struct platform_driver phy_drv = { .driver = { .name = "rw5phy", .pm = &phy_pm } };
static struct platform_driver helper_drv = { .driver = { .name = "rw5helper", .pm = &helper_pm } };
static void run(int sc, bool run0, bool run1, int dark, const char *what)
{
int i, ret;
scenario = sc;
running[0] = run0;
running[1] = run1;
dark_left = dark;
cycle = 0;
for (i = 0; i < 2; i++)
offs[i] = off_running[i] = ons[i] = 0;
pr_info("rw5: === S%d: %s ===\n", sc, what);
ret = pm_suspend(PM_SUSPEND_TO_IDLE);
pr_info("rw5: S%d RESULT pm_suspend=%d cycles=%d | PR(pd_a): off=%d off_while_running=%d on=%d | awake-path(pd_b): off=%d off_while_running=%d on=%d\n",
sc, ret, cycle, offs[0], off_running[0], ons[0], offs[1], off_running[1], ons[1]);
}
static void reset_rpm(void)
{
int i;
for (i = 0; i < 2; i++)
if (pm_runtime_status_suspended(&phy[i]->dev) ||
atomic_read(&phy[i]->dev.power.usage_count) == 0)
pm_runtime_get_sync(&phy[i]->dev);
}
static int __init rw5_probe_init(void)
{
int i;
hrtimer_setup(&wake_timer, wake_fn, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
pd[0].name = "pd_a_common_dp_PR";
pd[1].name = "pd_b_common_dp_awake";
pd[1].flags = GENPD_FLAG_ACTIVE_WAKEUP; /* what apple,sleep-wakeup-path sets */
for (i = 0; i < 2; i++) {
pd[i].power_off = pd_off;
pd[i].power_on = pd_on;
pm_genpd_init(&pd[i], NULL, false);
phy[i] = platform_device_register_simple("rw5phy", i, NULL, 0);
pm_genpd_add_device(&pd[i], &phy[i]->dev);
}
helper = platform_device_register_simple("rw5helper", -1, NULL, 0);
platform_driver_register(&phy_drv);
platform_driver_register(&helper_drv);
for (i = 0; i < 2; i++) {
pm_runtime_enable(&phy[i]->dev);
pm_runtime_get_sync(&phy[i]->dev);
}
register_pm_notifier(&pr_nb);
run(1, true, true, 0, "coprocessor running at PREPARE, plain s2idle");
reset_rpm();
run(2, true, true, 0, "running at PREPARE, detach (runtime put) during the transition");
pr_info("rw5: S2 detail: main-phase pm_runtime_put_sync=%d phy0_suspended=%d | noirq pm_runtime_suspend=%d phy0_suspended=%d\n",
r_main_put, st_main, r_noirq_suspend, st_noirq);
pr_info("rw5: S2 after POST: phy0 rpm suspended=%d usage=%d\n",
pm_runtime_status_suspended(&phy[0]->dev), atomic_read(&phy[0]->dev.power.usage_count));
reset_rpm();
run(3, false, false, 1, "not running at PREPARE, attach during a dark wake, sleep again");
reset_rpm();
run(4, true, true, 1, "running at PREPARE, dark wake, sleep again");
cancel_abort = true;
reset_rpm();
run(5, false, false, 1, "as S3, re-entry not aborted: attach during a dark wake, sleep again");
reset_rpm();
run(6, true, true, 1, "as S4, re-entry not aborted: running at PREPARE, dark wake, sleep again");
pr_info("rw5: DONE\n");
return 0;
}
late_initcall_sync(rw5_probe_init); |
|
A follow-up on the direction suggested in the reviews above ( Deciding the awake path in
Suggestion: make the decision in How it was runPR tree a9454a5 plus the earlier pass's local probe (never committed), extended with S7/S8. x86_64 allnoconfig with SUSPEND/PM_SLEEP/PM_GENERIC_DOMAINS, booted with |
…unning consumer apple,sleep-wakeup-path was written for a consumer that the sleep's final commit stops after the noirq phase. A consumer that keeps running through the whole sleep while it is on the wakeup path needs the same thing from the OS: keep the domain on through system sleep, also when it was off when the power controller probed. Say so in the description. No change in meaning for existing users. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…-path The Type-C PHY coprocessor under atcN_common_dp keeps running through suspend-to-idle while a link is up. Mark the four common_dp domains apple,sleep-wakeup-path so that genpd keeps one on while the PHY puts itself on the awake path, also when the domain was off when the power controller probed (no cable at boot). phymxwrap above it stays on through its subdomain count. Nothing changes for a PHY that is not on the awake path. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
… path The PM notifier sampled "coprocessor running" once, at PM_SUSPEND_PREPARE. A coprocessor started later was not held: an attach between PREPARE and the device's suspend, or an attach during a dark wake, where enter_state() runs suspend_devices_and_enter() again without the notifiers (a cable or charger plugged into a closed, sleeping machine). genpd then powered common_dp off under it in noirq, which is the original bug. dev_pm_syscore_device() also kept the device out of the PM core's prepare/late handling altogether. Decide in the device's own .suspend instead, on every suspend pass, and put the device on the awake path with device_set_awake_path() while its coprocessor runs; common_dp carries apple,sleep-wakeup-path, so genpd keeps it (and phymxwrap above it) on. Decide again in .suspend_noirq, which genpd runs before its own awake-path check, for a coprocessor started after .suspend. In noirq a caller holding the PHY lock may be waiting for a coprocessor reply that cannot arrive; the outcome is then unknown, so the domains stay on for that sleep rather than block. The notifier, the syscore flag and the held state go away. Sleeps the platform firmware takes part in are left as they were (pm_suspend_no_platform() is false there). Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Reworked as suggested, in three new commits on top (no force push), head e1b79fc:
Still owed and listed in the body: a with-property sleep while the USB3 coprocessor runs, a hardware late attach (the J616s controllers refuse Assisted-by: LLM (Claude:Opus 5.5) |
|
Review at e1b79fc. Three commits were added on top of a9454a5: the binding text (73dea0d), Our points:
No new issues in the code. Nit: the series still adds the notifier in a9454a5 and removes it in e1b79fc. Please squash it into one commit before merge (or squash-merge), so the history does not carry a mechanism the tree never ships. There are no gates or parameters, the domain choice comes from DT, and there are no agent trailers. Verdict: NITS. The code is ready. Before merge (RyanTheTide/lab on J616s):
Wanted, but not blocking:
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial pre-PR checklist (§1–§6) re-review at e1b79fc07d8e86e9db631754c573a3b894e49238 (CI: host-tests and dt-checks green; MERGEABLE / CLEAN), following up on my prior CHANGES_REQUESTED review at a9454a5477.
Verdict: REQUEST CHANGES — all code and architecture blockers from a9454a5477 are RESOLVED, and the code is ready to ship. The sole remaining blocker for merge is the §5 J616s hardware verification row for the exact path added by commit c1c5e672 (apple,sleep-wakeup-path keeping a port that was off at pmgr probe — plain USB3 host mode — alive through s2idle).
Status of prior a9454a5477 blockers
- Late-attach & dark-wake
PM_SUSPEND_PREPAREsampling gap — RESOLVED:e1b79fc0removes the PM notifier anddev_pm_syscore_device().t6040_usb2_suspend()andt6040_usb2_suspend_noirq()callt6040_keep_running_cpu_awake(), re-evaluatingtphy->rtk && apple_rtkit_is_running(tphy->rtk)undertphy->lockon every suspend pass (including dark wakes) and again innoirq(failing safe todevice_set_awake_path()ifmutex_trylock()is contended sonoirqnever blocks on an in-flight coprocessor reply).- Paired with
apple,sleep-wakeup-pathonps_atc0..3_common_dp(c1c5e672) and updated dt-bindings (73dea0df),pmgr-pwrstate.c:1028-1035setsGENPD_FLAG_ACTIVE_WAKEUPeven when the domain was off at probe. Verified against T604x DTS files: activeatcphy0..2and J575catcphy3(viat604x-extdisp.dtsi) all sit inps_atcN_common_dpas subdomains ofps_atcN_phymxwrap(t6040-j773s-usb-front.dtsi'satcphy3is currentlystatus = "disabled").
dev_pm_syscore_device()runtime-PM bypass — RESOLVED:- Flag removed; standard PM core prepare/late/noirq runtime-PM handling applies.
- Plain USB3 host mode decision — ADDRESSED IN CODE, HARDWARE ROW STILL OWED:
- The J616s before-row now confirms plain USB3 suffers the exact same
AP idle -62/ permanent USB2 fallback wedge acrosss2idle, and the without-DT-property row confirms whyc1c5e672is needed when a port's domain was off atpmgrprobe.
- The J616s before-row now confirms plain USB3 suffers the exact same
Remaining blocking finding
- Missing §5 hardware row for the with-DT-property plain-USB3 path (
Still to run):- In the
Testingtable, the with-DT-property trial exercised CIO (atc0), while the USB3 partner did not present a USB device during that slot — leaving the exact scenario commitc1c5e672fixes (a domain that was off atpmgrprobe staying powered acrosss2idlewithapple,sleep-wakeup-pathwhile the plain-USB3 coprocessor runs) unverified on hardware. - Before merge, run on J616s with the DT property: (a)
s2idlecycle while the plain-USB3 coprocessor is running (confirmingcommon_dp/phymxwrapstay on, 0x-62, USB3 stays alive post-resume, and idle ports still power off), and (b) cable-pull / attach while asleep if reproducible on J616s, with 0 new kernel errors / 0 SELinux denials / 0 failed units.
- In the
Non-blocking notes
- Squash on merge (nit): Commit 1 (
a9454a54) adds the PM notifier +dev_pm_syscore_device()and Commit 4 (e1b79fc0) removes them; please squash-merge (or squash before merge) sointegration/auroradoes not carry dead intermediate commits. - Deferred follow-up rows (non-blocking given documented lab constraints): battery-only
s2idlepower-drain measurement (J616s is AC-only and charges ins2idle), DP pin D (no DP partner in lab), and J575c/J773s/J614s coverage (boards not in lab; inherit viat604x-pmgr.dtsi).
§1–§6 Checklist Summary
- §1 No model gating: Pass on code (no chip/board/firmware gates; DT-driven via
apple,sleep-wakeup-path;pm_suspend_no_platform()preserves firmware sleep). - §2 Production-ready: Pass on code (notifier/syscore rework is clean; default cmdline; no params/hacks).
- §3 Safety: Pass (
mutex_trylockfail-safe innoirq, standard PM core runtime-PM disablement restored). - §4 Clean-room & attribution: Pass (all 4 commits carry human author/committer + human
Signed-off-by:only, zero AI trailers in commits,Assisted-by:in PR body). - §5 Evidence: Blocked on one remaining J616s row (with-DT-property plain-USB3
s2idle+ sleep cable-pull/attach). - §6 Naming: Pass.
Assisted-by: LLM (Gemini 4 Neon)
|
New J616s rows at e1b79fc (no code change). I've updated the PR body; it also corrects an earlier claim.
To get the USB3 condition, the Air has to be the USB device. Data-role swaps were refused on both sides, but the side that attaches later takes the device role, so one plain reboot of the Air while the J616s was up was enough. Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal adversarial pre-PR checklist (§1–§6) re-review at e1b79fc07d8e86e9db631754c573a3b894e49238 (CI: Host tests and Device tree checks both SUCCESS; MERGEABLE / CLEAN).
Verdict: APPROVE (ready for MERGETRAIN-LINUX4)
The sole remaining §5 blocker from my prior review at e1b79fc0 (the J616s with-DT-property plain-USB3 s2idle row) is now resolved, and Ryan's 03:24:26Z correction + updated PR body cleanly explain the underlying PMGR behavior:
- J616s with-DT-property plain-USB3 + CIO
s2idlerow (done):- 3 sleeps (2 x 15 s RTC +
pm_test=devices) with both CIO (phy@382a90000inatc0_common_dp) and plain USB3 (phy@38aa90000inatc1_common_dp) coprocessors running:0off transitions onatc0/atc1,0 x -62,0Type-C config failures, idle ports (atc2/atc3) still power off inside each sleep, 0 SELinux denials, 0 failed units, 0 new kernel errors.
- 3 sleeps (2 x 15 s RTC +
- Why production DTB also held — and why commit
c1c5e672(apple,sleep-wakeup-path) is still genuinely needed:- Checked
drivers/pmdomain/apple/pmgr-pwrstate.c:1026-1035: on J616s warm reboots, the boot loader leavesatc0..2_common_dppowered on (active == true) atpmgrprobe, so the existingelse if (active ...)branch already setsGENPD_FLAG_ACTIVE_WAKEUP. (The earlier misread came from reading idleatc2instead ofatc1.) - Commit
c1c5e672(apple,sleep-wakeup-pathonps_atc0..3_common_dp) +73dea0dfremain essential whenever the boot loader leaves a port'scommon_dpoff at probe (e.g., cold boot with no cable attached, oratc3on J575c): without it,pmgr-pwrstate.c:1028-1035never setsGENPD_FLAG_ACTIVE_WAKEUP, so a coprocessor started post-probe would still havecommon_dpcut innoirqdespitedevice_set_awake_path(). Idle domains still power off cleanly with the property set, so there is zero idle cost.
- Checked
- T6040 / T6041 shared topology check:
- Verified
t6041.dtsi->t604x.dtsi->t604x-pmgr.dtsishares the property across all T6040 (J614s,J616s,J773s) and T6041 (J614c,J616c,J575c) boards. - Checked
ps_atc3_common_dpspecifically: onJ575c(t6041-j575c.dts),t604x-extdisp.dtsi:322-323wirespower-domains = <&ps_atc3_phymxwrap>;beforet6041-j575c-atc3.dtsienables it (and onJ773s,atcphy3staysstatus = "disabled"). Every activeapple,t6040-atcphyon T6040/T6041 has the exact samecommon_dp->phymxwrapsubdomain relationship, with no T6041-specific risk. - Per policy, J616s (T6040) + the KVM PM-core model (S1–S8 covering dark-wake and
.suspend-to-noirqattaches) stand in cleanly without parking on unowned T6040/T6041 boards, AC-only drain limits, or unavailable DP partners (all plainly documented under Still to run).
- Verified
Non-blocking Note
- Squash on merge (nit): Commit 1 (
a9454a54) adds the PM notifier +dev_pm_syscore_device()and Commit 4 (e1b79fc0) removes them; squash-merge (or squash before merge) sointegration/auroradoes not carry the superseded mechanism.
§1–§6 Checklist Summary
- §1 No model gating: Pass (DT-driven
apple,sleep-wakeup-path,pm_suspend_no_platform()preserves firmware sleep). - §2 Production-ready: Pass (default cmdline, no hacks/params).
- §3 Safety: Pass (
mutex_trylockfail-safe innoirq, normal PM core runtime-PM handling). - §4 Clean-room & attribution: Pass (all 4 commits carry human identity +
Signed-off-by:, 0 AI commit trailers,Assisted-by:in PR body). - §5 Evidence & CI: Pass (J616s before/after CIO + plain-USB3 + with/without DT property + idle-off + 0/0/0, KVM S1–S8 model,
host-tests&dt-checksgreen). - §6 Naming: Pass.
Assisted-by: LLM (Gemini 4 Neon)
Problem
On the 16" MacBook Pro M4 Pro (T6040), a Type-C port with a running PHY coprocessor loses its link for good after a suspend-to-idle. This happens in USB4/Thunderbolt (CIO) mode and in plain USB3 host mode. On the first renegotiation after the sleep the coprocessor no longer answers, and every later start fails until a reboot:
Nothing stops a running PHY coprocessor for s2idle, but genpd powers off its domain (
atcN_common_dp, andatcN_phymxwrapabove it) in the noirq phase, under the running coprocessor. With PMGR debug on, both domains go to state 0 inside every sleep. #2664 deals with the same class of bug on T6050.Change
.suspendand.suspend_noirqwhether its coprocessor is running, on every suspend pass (dark wakes included). If it is, it callsdevice_set_awake_path(), as apple-dart and btcentauri already do.atcN_common_dpdomains getapple,sleep-wakeup-path, so pmgr setsGENPD_FLAG_ACTIVE_WAKEUPon them even when the boot loader left them off at pmgr probe. Today the flag is only set for domains that were on at probe. genpd then keeps the domain, andphymxwrapabove it, on for a device on the awake path. Domains whose PHY is not on the awake path still power off.apple,sleep-wakeup-pathnow also covers a consumer that keeps running through the whole sleep.dev_pm_syscore_device()are removed by the last commit. The PM core's normal prepare/late/noirq handling, including disabling runtime PM, now applies to the device.Sleeps that the platform firmware takes part in behave as before (
pm_suspend_no_platform()). Nothing is gated on chip, board or firmware, there are no parameters, and the default command line is enough.Testing
J616s, default fleet command line. Before = fleet kernel
7.3.0-aurora-fleet81. After = the same tree plus this PR's four commits (the driver, DT, pmgr and genpd sources are identical to this branch). Each row: 15 s RTCs2idlecycles plus onepm_test=devicescycle, then a port watch. CIO port =phy@382a90000inatc0_common_dp, USB4 link to a Mac mini M2. Plain-USB3 port =phy@38aa90000inatc1_common_dp, linked to a MacBook Air M4 in USB device role (the J616s is USB host, and its USB3 coprocessor runs).atc0andatc10 off transitions)atc0andatc10 off transitions)atc2,atc3: no consumer in this DT) still power off and on inside each sleep, so the hold has no idle cost.atc0..2_common_dpon at pmgr probe (a boot with pmgr dynamic debug shows their first transition is to off), so pmgr's existing "active at probe" branch already sets the flag. The property covers the case where the loader leaves a consumer's domain off. I could not produce that case on this J616s from software.checkpatch --strict: clean on all four commits. No SELinux denials, no failed units on the test boots.dwc3-apple ...: genpd_prepare returns -11, which the fleet kernel logs the same way.Still to run
atc3is off at probe, and nothing in its DT uses it. Producing the case on a PHY domain needs a boot where the loader leaves it off, for example a cold boot. That needs a power cycle, which I can't do from software here..suspendand noirq, on hardware. The J616s Type-C controllers refuse theDISCcommand, and a PD data-role swap is refused too, so I can't trigger a late attach from software. The REVIEW-WAVE-6 KVM model covers the.suspend_noirqdecision (S7/S8).t604x-pmgr.dtsi.Details for reviewers
Commits:
dev_pm_syscore_device(). The last commit removes it.apple,sleep-wakeup-pathdescription also covers a consumer that runs through the sleep. No change in meaning for the existing user (T8132sio_cpu).apple,sleep-wakeup-pathonps_atc0..3_common_dpint604x-pmgr.dtsi..suspendand.suspend_noirqdecide..suspendtakes the PHY lock..suspend_noirqusesmutex_trylock(): a caller holding the lock may be waiting for a coprocessor reply that cannot arrive in noirq, so if the lock is busy the device goes on the awake path for that sleep instead of blocking. genpd'sgenpd_finish_suspend()runs the driver's noirq callback before it checksdevice_awake_path(), so a coprocessor started after.suspendis still caught.power.wakeup_pathis cleared indevice_prepare()on every pass, so nothing needs undoing at resume.Review items at a9454a5:
suspend_devices_and_enter()pass, and again in noirq.dev_pm_syscore_device()skipped the PM core's handling: removed. The REVIEW-WAVE-5 probe had already shown that noirqpm_runtime_suspendreturns -EACCES in this tree, so this was not an active hole, but the flag is gone either way.Per-row domain transitions inside sleeps (
PS atcN_*lines betweenPM: suspend entryandPM: suspend exit; one off + one on per sleep that reaches noirq;pm_test=devicesstops before noirq):phy@382a90000->atc0_common_dp(phandle 0xb6),phy@38aa90000->atc1_common_dp(0xc0), dwc338a280000.usb->atc1_usb. An earlier revision of this text read theatc2lines as the USB3 port and said the DT commit was needed for it. That was wrong:atc2is an idle port.The DT trial was an aura-try boot of the production Stage 2 with only its two DTBs changed: four
apple,sleep-wakeup-path;lines each, and a dts diff shows nothing else. The trial was never committed; afterwards the production Stage 2 hash was verified unchanged.Assisted-by: LLM (Claude:Opus 5.5)