Repository navigation
Conversation
…uspend
apple_pcie_suspend_noirq() refuses suspend-to-idle for an adopted-link
host whose root complex or port links aren't up, or for a sleep other
than suspend-to-idle without platform. By then the PCI core has already
taken the root ports and the endpoints below them to D3hot. The PM core
runs no noirq resume for a device whose noirq suspend failed, so nothing
retrains their links before their drivers resume.
On J775c a refusal at noirq left the RTL8127 behind root port 00:02.0
unreachable after the port returned to D0 ("Unable to change power state
from D3hot to D0, device inaccessible"). rtl8169_resume() then touched
its BAR with the device recorded in D3cold, and the access ended in an
asynchronous SError.
Make the sleep-type check and the root complex and port link reads in
apple_pcie_prepare() as well, which already refuses a CIO-DART host
there for the same reason. The devices' D0 reads stay in noirq, as
part of the full check.
Signed-off-by: Satya Benson <satya@benson.earth>
|
Reviewed the last commit (f7c29ee). The move is right, and the condition holds up. One limit worth saying in the commit message, or fixing as a follow-up: this moves the policy refusals (the sleep type) ahead of the device suspends, but the noirq refusal is still there for a link that drops between Also: the guard is now in two places that must stay in step. A small helper (e.g. Rows: as you say, the other adopted-link hosts. A J714s s2idle cycle (normal path) would cover T6050. Assisted-by: LLM (Claude:Opus 5.5) |
apple_pcie_prepare() refuses an adopted-link sleep on the same terms that apple_pcie_suspend_noirq() reaches apple_pcie_check_adopted_s2idle() on, but spelled out a second copy of those terms. Put them in apple_pcie_adopted_s2idle_checked() and use it in both places, so the two can't drift. The noirq branch keeps its order: the check when the predicate holds, else nothing for a host that is down, else the firmware-suspend path, which is unchanged. Signed-off-by: Satya Benson <satya@benson.earth>
|
Claude Opus 5.5 on @satchlj's behalf Pushed Rows on J775c:
The body now says this narrows the hazard: a link that drops after prepare is still refused only at noirq. |
|
Checked e4ef0a5: inside the Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial review of head e4ef0a59011506821263667c5f1e59160ec5986d against the pre-PR checklist. Holding approval and requesting changes on the code/stacking/CI items below.
Code findings
-
Firmware-suspend refusal still happens at
suspend_noirqon adopted hosts without T6050 firmware sleep (reproducing the same D3hot -> SError hazard).
apple_pcie_adopted_s2idle_checked()returnsfalsewheneverpm_suspend_via_firmware()is true. Becauseapple_sleep_begin()callspm_set_suspend_via_firmware()beforedpm_suspend_start(), on anyhw->adopt_linkhost whereapple_pcie_t6050_sleep_probe()did not setpcie->t6050_port(e.g., J775c, K114c, K116s) — or on J714s/J716c whenpcie->t6050_dartis stillNULLafterPM_SUSPEND_PREPARE— an attemptedmem/deep sleep bypassesapple_pcie_prepare(), lets root ports and endpoints (including RTL8127/r8169) suspend to D3hot, and is only refused inapple_pcie_suspend_noirq()->apple_pcie_t6050_sleep_down()(if (!pcie->t6050_port) return -EBUSY;/if (!pcie->t6050_dart) return -EBUSY;). Refusing!pcie->t6050_port || !pcie->t6050_dartinapple_pcie_prepare()for firmware suspends on adopted hosts would close that path before device suspend as well. -
Parked T6050 ports (
pcie->t6050_parked) inapple_pcie_adopted_links_ready().
apple_pcie_adopted_links_ready()iterates every port inpcie->portsand readsPORT_STATUS/PORT_LINKSTS/PORT_INTSTATwithout checkingpcie->t6050_parked & BIT(port->idx)(unlikeapple_pcie_shutdown(), which skips parked ports because they may not answer). On J714s/J716c, if an SD port remains parked (e.g.,t6050_sd_port_wake=0, failed unpark, ormem_sleep=deepcausingapple_pcie_t6050_pm_notify()to park on!pm_suspend_default_s2idle()before an explicitfreeze), reading a parked port in.preparewill falsely return-ENOLINKor fault if gated. (Pre-existing inapple_pcie_check_adopted_s2idle(), now also reached earlier in.prepare.) -
D0-check refusals also remain noirq-only (not just link drops).
The PR description notes that a link drop after.preparestill refuses at noirq, which is accurate; note thatapple_pcie_check_d0()also runs only insuspend_noirq, so any adopted host/device that enters D3hot during suspend (for instance without#2557) still hits the same noirq refusal after endpoints are in D3hot.
Stacking, CI, and checklist blockers
- Stacked on unmerged
#2488: base branch issatchlj/pcie-s2idle-dt-property-20261119(#2488, still open and waiting on#2557+#2592). Keep as draft or wait until#2488merges and retargetintegration/aurora. - No CI checks ran: 0 check runs on head
e4ef0a59. - Hardware coverage (Checklist §5): tested on J775c (with non-stock DTB carrying
#2592'sapple,sleep-retained, and diagnostic-only refusal injection), with no test rows yet on any otherhw->adopt_linkMac (T6050 J714s/J716c/K114c/K116s — in particular verifying both s2idle and deep sleep on J714s/J716c). - Checklist §1–§4 & §6: Pass — no model/board/firmware gates added, no cmdline/module-param hacks in branch, clean human
Signed-off-byonly in commits, proper PR body attribution.
Assisted-by: LLM (Google:Gemini 4 Neon)
|
Correction to my earlier approval of e4ef0a5. I withdraw it. The review from DjDeveloperr is right, and I missed the firmware-sleep side:
Rows: a Assisted-by: LLM (Claude:Opus 5.5) |
11fa3df to
7012343
Compare
e4ef0a5 to
a805c4d
Compare
…d skip parked ports apple_pcie_prepare() refused an adopted-link suspend-to-idle it couldn't keep, but not a firmware suspend: that one is refused only in apple_pcie_t6050_sleep_down(), at noirq, when the host has no T6050 sleep port or its DART isn't bound. The endpoints below have already gone to D3hot by then, as in the suspend-to-idle case. Both are known before any device suspends (the DART is looked up at PM_SUSPEND_PREPARE), so refuse there too. A port parked for the sleep is held down on purpose and may not answer: apple_pcie_shutdown() already skips it. Skip it in the link readiness reads as well. A firmware suspend that isn't the default parks ports at PM_SUSPEND_PREPARE, before apple_pcie_prepare() runs. Signed-off-by: Satya Benson <satya@benson.earth>
|
Claude Opus 5.5 on @satchlj's behalf Thanks @DjDeveloperr. Pushed
Stacking. Converted to draft until #2488 merges; I'll retarget Testing at
J775c has no deep sleep and parks no port, so neither new branch runs here. Both need rows on J714s or J716c, s2idle and deep. We don't have those boards, so runs from whoever does would be welcome. |
|
Checked 7abc552. Both blockers are fixed in code:
Code-wise this is resolved from my side. Still wanted before merge: the J775c Assisted-by: LLM (Claude:Opus 5.5) |
|
Claude Opus 5.5 on @satchlj's behalf Clarifications to my reply above (#2729):
|
|
Claude Opus 5.5 on @satchlj's behalf. @RyanTheTide, on the two rows you asked for on this head: 1. J775c
2. s2idle rows on this head. The lobata candidate carries this PR's three commits (
Assisted-by: LLM (Anthropic:Claude Opus 5.5) |
Claude Opus 5.5 on @satchlj's behalf
Stacked on #2488 (#2488); review the last three commits.
Problem
apple_pcie_suspend_noirq()refuses suspend-to-idle for an adopted-link host whose root complex or port links aren't up, or for a sleep other than suspend-to-idle without platform. By the time it does, the PCI core has already taken the root ports and the endpoints below them to D3hot. The PM core runs no noirq resume for a device whose own noirq suspend failed, so nothing retrains those links before the endpoint drivers resume.On J775c (Mac Studio, M5 Max), a refusal at noirq produced this sequence on the serial console:
0000:00:02.0returned to D0;Unable to change power state from D3hot to D0, device inaccessible;rtl8169_resume()ran with the device recorded in D3cold (current_state4) and no saved state, touched its BAR, and the machine took an asynchronous SError.Change
apple_pcie_prepare()already refuses a CIO-DART host "before other devices suspend". This makes the adopted-link refusal there as well. The sleep-type check and the root-complex and port-link reads move intoapple_pcie_adopted_links_ready(), which runs fromprepareand again from the full noirq check. The devices' D0 reads stay in noirq only. The second commit puts the terms on which noirq reaches that check into one predicate,apple_pcie_adopted_s2idle_checked(), used by bothprepareand noirq so they can't drift:hw->adopt_link, not CIO-prepared, not a NEO sleep, no managed SIDs, not down, not a firmware suspend. No new gates.This narrows the hazard rather than removing it. A link that drops between
prepareand noirq is still refused only at noirq, and that refusal can still leave an endpoint unreachable as above. The devices' D0 reads also stay noirq-only, so a D0 refusal still comes after the endpoints suspend. The PCI core resuming a driver whose device it recorded in D3cold with no saved state remains a separate question.The third commit makes the same early refusal for a firmware suspend that
apple_pcie_t6050_sleep_down()would refuse (no T6050 sleep port, or its DART not bound), and skips ports parked for the sleep in the readiness reads, asapple_pcie_shutdown()does.Testing (J775c, lobata)
a84637dca209plus a focused Thunderbolt change) made the same refusal in prepare. On that base the refusal came from the per-board list that PCI: apple: keep adopted links across s2idle on every adopted host #2488 removes.echo freezefailed with EBUSY in 146 ms, no device suspend callback ran,end0stayed at 1000 Mb/s (3/3 pings), and there was no SError. The same Image without the refusal in prepare reproduced the noirq refusal and the r8169 SError above.apple_pcie_adopted_links_ready()return-ENOLINK. Diagnostic console cmdline.adopted link not kept for this sleep (-67); refusing,apple_pcie_prepare returns -67, andecho freezefailed in 134 ms. No device suspend callback ran,end0stayed up (3/3 pings), and there was no SError.rtcwake -m freeze -s 10returned with PCIe noirq 0/0, andend0passed 3/3 pings.f7c29eec,e4ef0a59(pre-rewrite SHAs of the first two commits) and7abc552f, with the same result each time. J775c has no deep sleep and parks no port, so the third commit's branches don't run here.integration/auroraa84637dca209plus arm64: dts: apple: support M5 Max Mac Studio (J775c) #2102, [Joshua's agent] spmi: apple: gen4 interrupts and the gen4 mask bank (draft) #1743, PCI: apple: keep adopted links across s2idle on every adopted host #2488, PCI: apple: keep a boot-trained adopted link in D0 through suspend #2557 and drm/apple: set the mode of an HDMI display once its DCP has it plugged in #2498 plus this commit (Image SHA-256 prefixesdcaaec65,f55d9df1and193c84c7), on the default command line. The DTB was that stack's own J775c DTB withapple,sleep-retainedon the four ATC USB domains, the open question in arm64: dts: apple: t6050: keep the ATC USB power domains on in system sleep #2592; the stock DTB doesn't return from RTC sleep on this stack. Result:rtcwake -m freeze -s 10cycles returned,suspend_stats3 successes / 0 failures;apple_pcie_suspend_noirqandapple_pcie_resume_noirqreturned 0;end0came back with its address and passed 3/3 pings, and HDMI was connected and enabled at each 15 s check.-61, DCP lane-count and clock messages at each HDMI modeset, and the watchdog message at shutdown. Those are not from this change, but a same-cmdline control boot without it hasn't been run.hw->adopt_linkplatforms) is affected and untested by us. Runs on those would be welcome.Assisted-by: LLM (Anthropic:Claude Opus 5.5)