Repository navigation
PCI: apple: let a T6050 dark wake suspend again - #3898
Conversation
A dark wake resumes every device and then calls suspend_devices_and_enter() again with user space still frozen. On the J714s (T6050), after a USB-C dark wake, the second device prepare fails with -EIO on the radio's host. The system then stays awake and the sleep request returns an error. apple_pcie_hib_disable_l1ss_hw() reads Link Control on every function below an L1SS link before it knows whether it needs that snapshot. After the wake's warm reset, the radio answers only on function 0 until its other functions are probed again after thaw. The all-ones reads from functions 1 and 2 then fail the prepare. Link Control is put back only after an L1SS teardown or an ASPM rollback. Take the snapshot only when the effective L1SS enables are set or a rollback is pending. L1SS control read errors, a live L1SS teardown and a pending rollback behave as before. With t6050_sd_port_wake=1, apple_pcie_resume_early() brings the parked SD card reader port back. The PM_SUSPEND_PREPARE notifier that parks it does not run again before a dark-wake re-entry, so the port would go into the second sleep up, with its DART not saved and gated. Leave the port parked while pm_dark_wake() is set. A wake that is not dark still brings it back in the early resume. If the re-entry fails, the PM_POST_SUSPEND work brings it back after thaw. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
satchlj
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 6fd0b44b267fa74f8450fcc162d431fbeb9c6ee4
Blockers:
- Missing exact-head hardware rows (
needs-hw-row): host-only so far; needs the planned exact-head J714s dark-wake re-entry rows and a shared-code control row on another deep-sleeping Mac generation. - Queued CI checks (
apple-build,host-tests,KUnit plan) have not completed yet.
Code review is clean with no blocking findings; ready to flip to APPROVE once the hardware rows and CI land.
Checked: no Apple material, no inappropriate model gating, default command-line compatibility, pcie-apple.c L1SS save/restore and T6050 SD-port unpark paths, PR text
Evidence
drivers/pci/controller/pcie-apple.c(apple_pcie_hib_disable_l1ss_hw()): deferringapple_pcie_hib_save_lnkctl()until after pending timing / PCI-PM state is merged and gating it on((saved->pl_ctl1 | saved->cl_ctl1) & PCI_L1SS_CTL1_L1SS_MASK) || dhw->pend_rollbackavoids reading Link Control on post-warm-reset non-zero radio functions when neither L1SS teardown nor ASPM rollback will occur. When skipped,saved->hw_clearedisfalseandapple_pcie_hib_restore_l1ss_link()returns early without touching Link Control, matchingapple_pcie_hib_recheck_l1ss_link().drivers/pci/controller/pcie-apple.c(apple_pcie_t6050_unpark_cold_early()): returning early whenpm_dark_wake()is true keeps parked ports parked across a dark-wake re-entry (wherePM_SUSPEND_PREPAREdoes not re-run); normal wakes still unpark in early resume and aborted/finished cycles unpark viaPM_POST_SUSPEND->t6050_unpark_work.pr-textandreadinessare green;apple-build,host-tests, andKUnit planare queued.
|
Exact-head T6050 normal-wake Note: this desktop AC machine exercises normal RTC
|
J516s (M3 Pro, T6030) Shared-Code Control Receipt — PASSCandidate tree: Pass 1 — Clean exact-head kernel (
Pass 2 — Live physical deep-sleep dark-wake & mixed-IRQ verification (
|
satchlj
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge at 6fd0b44b267fa74f8450fcc162d431fbeb9c6ee4
Blockers:
- Hosted
apple-buildandKUnit planCI checks are still queued (host-testsandpr-textare now green). - The target J714s (
T6050) physical dark-wake re-entry row with#3846listed underNot yet(directly exercising the warm-reset auxiliary-function-EIOpath andt6050_sd_port_wake=1dark-wake park retention) has not landed yet.
Code remains clean with no blocking code findings, and both the J775c T6050 normal-wake s2idle control (#issuecomment-7343235747) and the J516s T6030 physical deep-sleep + dark-wake re-entry / mixed-IRQ shared-code control (#issuecomment-7343839336) are verified. Ready to flip to APPROVE as soon as queued CI clears and the target J714s dark-wake re-entry row lands.
Checked: pcie-apple.c L1SS save/restore and T6050 SD-port unpark paths, updated CI status, J775c and J516s exact-head hardware receipts
Evidence
- Verified exact-head J775c (
T6050) control (#issuecomment-7343235747): 5/5 normal-wakes2idlecycles acrosst6050_sd_port_wake=2and1, 0 PCIe/L1SS-EIOerrors, 8/8 local arm64 host tests pass. - Verified exact-head J516s (
T6030) shared-code control paired with#384648237685b006(#issuecomment-7343839336): 2/2 clean RTC physical deep-sleep cycles plus lone-SMC dark-wake re-entry (secondapple_pcie_prepare()succeeding cleanly across 2 firmware entries / 1 thaw) and mixed-IRQ cancellation, 0 PCIe/PM/GPU/BT/SEP/tipd errors. - CI status at
6fd0b44b267f:host-testsandpr-textpassed;apple-buildandKUnit planremain queued.
|
J714s (M5 Pro, T6050) exact-head row at
|
|
Local CI receipt for the queued Merge: head
Toolchain: clang 23.1.3 and rustc 1.100.1 on pc. The hosted job pins clang 18 and Rust 1.96. An earlier run on main Still open from the review: the J714s physical dark-wake re-entry row. |
|
J714s (M5 Pro, T6050) exact-head Rev 2 row —
|
|
J714s (M5 Pro, T6050) exact-head Mode 2 dark-wake repeat —
|
satchlj
left a comment
There was a problem hiding this comment.
Reviewed 6fd0b44b267f (drivers/pci/controller/pcie-apple.c, 48 lines): skipping apple_pcie_t6050_unpark_cold_early() under pm_dark_wake() and gating apple_pcie_hib_save_lnkctl() on ((saved->pl_ctl1 | saved->cl_ctl1) & PCI_L1SS_CTL1_L1SS_MASK) || dhw->pend_rollback is clean, minimal, and directly matches the dark-wake re-entry path.
Exact-head T6050 J714s dark-wake re-entry rows pass (including the Mode 2 repeat: boot object resumes 0 -> 1 -> 2, suspend_stats success 0 -> 1, fail 0, refusals: []). apple-build, host-tests, pr-text, readiness, and KUnit plan are green (remaining queued check is unrelated KUnit mt7932). LGTM.
|
K114s (14-inch M5 Pro, T6050) PMU RTC wake re-run on
Total 8/8 PASS, |
What: Lets a J714s (T6050) dark wake go back to sleep, which unblocks #3846. Today the re-entry fails in
apple_pcie_prepare()with -EIO on1cb0000000.pcie(J714s receipt on #3846). The deep-sleep L1SS walk now reads Link Control only when it will put it back. Witht6050_sd_port_wake=1, the SD reader port also stays parked through a dark wake.Tested: Host only so far. The focused regression harness passes 11/11, and current main fails its 3 targeted cases. The pcie-apple host tests pass,
checkpatch --strictis clean, and the warm arm64pcie-apple.oandImagebuilds pass with no warnings.Risk: two-way · every Mac that deep-sleeps, because the L1SS walk in
apple_pcie_prepare()is shared. The SD-port hunk changes only T6050 witht6050_sd_port_wake=1.Not yet: J714s rows on main + exact #3846 + this PR (mode 2 RTC control, mode 2 USB-C dark wake then RTC with two firmware entries, mode 1 repeat), and a J516s shared-code control with mixed-IRQ and lone-SMC re-entry. Both are requested in the merge-train row queue.
Details
Failure path. After a dark wake,
enter_state()callssuspend_devices_and_enter()again with user space still frozen. The seconddpm_suspend_start()runsapple_pcie_prepare(), whose L1SS walk callsapple_pcie_hib_disable_l1ss_hw(). That function read Link Control on every function below the link before it knew whether it needed the snapshot. After the wake's warm reset, the radio answers only on function 0. The PCI objects for01:00.1and01:00.2stay until Centauri's remove/rescan worker runs after thaw: it is freezable and takeslock_system_sleep(), so it cannot run between the two passes. Their all-ones Link Control reads return -EIO fromapple_pcie_lnkctl_read(), and the prepare fails.Why skipping the snapshot loses nothing. This snapshot is used only when L1SS is torn down (
apple_pcie_link_set_l1ss_hw()), and that happens only when the L1SS enable bits are set. It is also used on restore, but only whenhw_clearedis set, which happens only on a teardown or a pending ASPM rollback. With L1SS off and no rollback, the function recordsactive = core_managed,hw_cleared = false.apple_pcie_hib_restore_l1ss_link()then returns at!saved->hw_clearedwithout reading Link Control. The late recheck (apple_pcie_hib_recheck_l1ss_link()) already creates records like this with no Link Control snapshot, and it takes a fresh snapshot if L1SS turns up enabled later. The enable check runs on the merged CTL1 values, so a pending timing or PCI-PM restore still takes the snapshot. Behaviour is unchanged for L1SS control-register read errors, live L1SS teardown, and pending ASPM rollback.Why the SD port stays parked. The SD reader port is parked from the
PM_SUSPEND_PREPAREnotifier, which runs once perpm_suspend(). Mode 1 brings the port back inapple_pcie_resume_early(). A dark wake then re-enterssuspend_devices_and_enter()with no newPM_SUSPEND_PREPARE, so the port would go into the second sleep up, with its DART neither saved nor gated.pm_dark_wake()is settled by early resume: the SMC sets it in its noirq resume, and #3846'spm_consume_dark_wake()resolves mixed-IRQ wakes afterdpm_resume_noirq(), beforedpm_resume_early(). Every exit restores the port:PM_POST_SUSPENDqueuest6050_unpark_work.apple_pcie_t6050_unpark_cold()then brings the port back after thaw, the same path mode 2 uses.Modes 2 (the default) and 0 do not change.
Base.
pm_dark_wake()is already on main ininclude/linux/suspend.h, with a!CONFIG_SUSPENDstub, and #3846 leaves it unchanged. So this PR is not stacked on #3846. The two PRs share no files and merge cleanly together.If a row still fails here: capture the parent/child BDF, the return value and both live CTL1 words at L1SS prepare, then the BDF and read result at the Link Control snapshot. A failure on a live link should still propagate.
Evidence
2225082e1d18. One commit,drivers/pci/controller/pcie-apple.c+17/-6.apple_pcie_hib_disable_l1ss_hw()andapple_pcie_t6050_unpark_cold_early()from the source and runs them with mocked config access.python3 -I tools/asahi/run-host-tests.py --only <name>passed 8/8 jobs: pciec-policy 1/1 (its s2idle fixture compiles the L1SS walk), pcie-adopted-clkpm 1/1, pcie-apple-msi-slice 1/1, cio-native 1/1, radio-sleep 3/3, bcm4377-radio-sids 1/1.scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks.CONFIG_PCIE_APPLE=yandCONFIG_SUSPEND=y.drivers/pci/controller/pcie-apple.obuilt in 34 s andImagein 3 min 45 s, with no warnings.730f0cadeb6dwith PM: sleep: consume only the dark-wake IRQ before device resume #384648237685b006(receipt).