Skip to content

PCI: apple: let a T6050 dark wake suspend again - #3898

Merged
DjDeveloperr merged 1 commit into
mainfrom
fix/pcie-apple-dark-wake-reentry
Dec 2, 2026
Merged

DjDeveloperr merged 1 commit into
mainfrom
fix/pcie-apple-dark-wake-reentry

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

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 on 1cb0000000.pcie (J714s receipt on #3846). The deep-sleep L1SS walk now reads Link Control only when it will put it back. With t6050_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 --strict is clean, and the warm arm64 pcie-apple.o and Image builds 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 with t6050_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() calls suspend_devices_and_enter() again with user space still frozen. The second dpm_suspend_start() runs apple_pcie_prepare(), whose L1SS walk calls apple_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 for 01:00.1 and 01:00.2 stay until Centauri's remove/rescan worker runs after thaw: it is freezable and takes lock_system_sleep(), so it cannot run between the two passes. Their all-ones Link Control reads return -EIO from apple_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 when hw_cleared is set, which happens only on a teardown or a pending ASPM rollback. With L1SS off and no rollback, the function records active = core_managed, hw_cleared = false. apple_pcie_hib_restore_l1ss_link() then returns at !saved->hw_cleared without 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_PREPARE notifier, which runs once per pm_suspend(). Mode 1 brings the port back in apple_pcie_resume_early(). A dark wake then re-enters suspend_devices_and_enter() with no new PM_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's pm_consume_dark_wake() resolves mixed-IRQ wakes after dpm_resume_noirq(), before dpm_resume_early(). Every exit restores the port:

  • A wake that is not dark brings it back in early resume, as before.
  • If the re-entry fails, or a later wakeup cancels the dark wake, the loop ends and PM_POST_SUSPEND queues t6050_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 in include/linux/suspend.h, with a !CONFIG_SUSPEND stub, 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
  • Base: main 2225082e1d18. One commit, drivers/pci/controller/pcie-apple.c +17/-6.
  • Focused regression harness: it extracts apple_pcie_hib_disable_l1ss_hw() and apple_pcie_t6050_unpark_cold_early() from the source and runs them with mocked config access.
    • Main fails 3 of 11 cases: "disabled L1SS with stale auxiliary functions", "disabled unmanaged L1SS with stale auxiliary functions" and "mode 1 dark wake keeps port parked".
    • This branch passes 11/11.
    • The other 8 cases cover live L1SS save and teardown, error propagation at the snapshot, pending timing and PCI-PM records, pending ASPM rollback, CTL1 read errors, the mode 1 full wake and the mode 2 deferral.
  • 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.
  • Warm arm64 LLVM build: an incremental build in a reflinked warm tree, with the source verified byte-identical to this branch. The config has CONFIG_PCIE_APPLE=y and CONFIG_SUSPEND=y. drivers/pci/controller/pcie-apple.o built in 34 s and Image in 3 min 45 s, with no warnings.
  • Failed hardware row this addresses: the integration candidate 730f0cadeb6d with PM: sleep: consume only the dark-wake IRQ before device resume #3846 48237685b006 (receipt).

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>
@DjDeveloperr
DjDeveloperr requested review from a team as code owners December 2, 2026 08:31
@github-actions github-actions Bot added blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Merge readiness at 6fd0b44b: not ready yet

Check Detail
CI at head running running: KUnit mt7932
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes no review verdict FINISH at 6fd0b44b
Hardware row at head ok comment at 6fd0b44b
Conflicts ok none
PR text ok Risk: two-way · every Mac that deep-sleeps, because the L1SS walk in applepcieprepare() is shared. The SD-port hunk changes only T6050 with t6050sdportwake=1.

Areas: none matched in CODEOWNERS

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at 6fd0b44b267fa74f8450fcc162d431fbeb9c6ee4
Blockers:

  1. 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.
  2. 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()): deferring apple_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_rollback avoids reading Link Control on post-warm-reset non-zero radio functions when neither L1SS teardown nor ASPM rollback will occur. When skipped, saved->hw_cleared is false and apple_pcie_hib_restore_l1ss_link() returns early without touching Link Control, matching apple_pcie_hib_recheck_l1ss_link().
  • drivers/pci/controller/pcie-apple.c (apple_pcie_t6050_unpark_cold_early()): returning early when pm_dark_wake() is true keeps parked ports parked across a dark-wake re-entry (where PM_SUSPEND_PREPARE does not re-run); normal wakes still unpark in early resume and aborted/finished cycles unpark via PM_POST_SUSPEND -> t6050_unpark_work.
  • pr-text and readiness are green; apple-build, host-tests, and KUnit plan are queued.

@github-actions github-actions Bot added the changes-requested A reviewer requested changes (bot) label Dec 2, 2026
@satchlj

satchlj commented Dec 2, 2026

Copy link
Copy Markdown
Member

Exact-head T6050 normal-wake s2idle control row at 6fd0b44b267fa74f8450fcc162d431fbeb9c6ee4 on J775c (Apple M5 Max Mac Studio, T6050): PASS (5/5 s2idle cycles, 0 PCIe/L1SS -EIO errors, 0 GPU faults).

Note: this desktop AC machine exercises normal RTC s2idle on the T6050 PCIe topology (1cb0000000.pcie, 3-function Centauri 01:00.0/.1/.2 + GL9755 SDXC 04:00.0), the shared apple_pcie_hib_disable_l1ss_hw() walk, and normal-wake t6050_sd_port_wake=2 & 1; it did not trigger a physical dark-wake re-entry with #3846 (which remains for the queued J714s dark-wake row).

  • Kernel / Boot: 7.3.0-1-51.20261202-ARCH built cleanly from exact head 6fd0b44b267fa74f8450fcc162d431fbeb9c6ee4 (boot 420c8001-b338-41b1-8317-ac799f929acb, default command line rdinit=/init nr_cpus=18 maxcpus=18 root=UUID=… idle=nop arm64.nowfxt), 0 failed systemd units pre & post.
  • Host tests (arm64, exact head 6fd0b44b267f): tools/asahi/run-host-tests.py 8/8 PASS (pciec-policy 1/1, pcie-adopted-clkpm 1/1, pcie-apple-msi-slice 1/1, cio-native 1/1, radio-sleep 3/3, bcm4377-radio-sids 1/1).
  • Phase 1 — default t6050_sd_port_wake=2 (3× consecutive rtcwake -m mem -s 15): suspend_stats success=1..3, fail=0; 01:00.0/.1/.2 (106b:1900/1902/1903) and 04:00.0 (17a0:9755, mmc0) intact after every cycle.
  • Phase 2 — runtime t6050_sd_port_wake=1 (2× consecutive rtcwake -m mem -s 15): suspend_stats success=4..5, fail=0; 01:00.0/.1/.2 and 04:00.0 (mmc0) intact after every cycle (exercises apple_pcie_t6050_unpark_cold_early() on normal wakes).
  • Post-resume checks: HDMI 2560x1440 connected, 0 failed units, 0 PCIe/L1SS -EIO errors in dmesg, 0 GPU faults; post-resume llama-bench (Qwen3.8-2B Q4_K_M, Borealis Vulkan) pp128 7460.53 ± 217.68, tg32 257.28 ± 3.05 t/s.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J516s (M3 Pro, T6030) Shared-Code Control Receipt — PASS

Candidate tree: origin/main (973ced809eba) + exact #3898 (6fd0b44b267f) + exact #3846 (48237685b006) + T6030 S2R stack (#3818 0a7df1d4469e, #3808 fa6a474aa3b2, #3810 a9ba3592318e, #3814 9305813f1a99, #3763 2f06f33dae05, #3409 793075bd411e), integration commit ae108162ce24. Zero-flag cmdline, mem_sleep=s2idle [deep], SMC_IRQ=38 (36c408000.mbox-recv).

Pass 1 — Clean exact-head kernel (7.3.0-m3-s2r-gae108162ce24, boot_id=43e0a6d2-5f93-47c4-b016-999232b43404):

  • Independent RTC/full deep-sleep cycles (rtcwake -d rtc0 -m mem -s 30 ×2): rc=0 both cycles, suspend_stats/success 0 -> 1 -> 2, fail=0, boot object resumes 0 -> 1 -> 2.
  • Normal PCIe endpoint recovery (580000000.pcie pci@0,0 BCM4388 WiFi+BT, pci@1,0 GL9755 SDXC), eDP-1 connected/enabled + backlight bounce 25->25->61->25, NVMe 16 MiB SHA-256 + write OK, aurora-g16 gpubench-vk transfer.ops CRC 55a4e6b1 (valid: true), aurora-sep sleeps 0->2, 0 failed systemd units, 0 PCIe/PM/GPU/BT/SEP/tipd errors.

Pass 2 — Live physical deep-sleep dark-wake & mixed-IRQ verification (7.3.0-m3-s2rp2-gf72c4b053d4d, boot_id=49fad723-188e-4eb9-af09-0bd0b504cdd8, local-only dw_test_mode hook in kernel/power/suspend.c exercising unmodified pm_consume_dark_wake() and apple_pcie_prepare()):

  1. Lone SMC dark wake -> re-entry (mode=1): injected SMC IRQ 38 + pm_set_dark_wake_irq(38) (orig_irq=0 orig_pending=0 orig_dark=0 -> post_irq=0 post_pending=0 post_dark=1). Logged apple-drm display-subsystem: dark wake: outputs stay off, aurora-g16 292400000.gpu: dark wake: GPU firmware stays stopped, PM: dw_test: rearm rtc0 +15s rc=0, PM: dark wake: suspending again (deep). Second dpm_suspend_start() / apple_pcie_prepare() succeeded with 0 errors and entered physical deep sleep a second time (boot object resumes 0 -> 1 -> 2, two firmware entries, one final thaw), rtcwake rc=0, suspend_stats/success 0 -> 1, fail=0.
  2. Mixed wake — SMC first (38), unrelated IRQ second (200) (mode=2): orig_irq=0 orig_pending=0 orig_dark=0 -> post_irq=200 post_pending=1 post_dark=0. Unrelated IRQ 200 survived, dark wake cancelled, no dark re-entry (boot object resumes 2 -> 3), rtcwake rc=0, suspend_stats/success 1 -> 2, fail=0.
  3. Mixed wake — unrelated IRQ first (200), SMC second (38) (mode=3): real hardware USB-C_plug dark wake also arrived at 8.930 s (orig_irq=0 orig_pending=0 orig_dark=1 -> post_irq=200 post_pending=1 post_dark=0). Unrelated IRQ 200 survived, dark wake cancelled, no dark re-entry (boot object resumes 3 -> 4), rtcwake rc=0, suspend_stats/success 2 -> 3, fail=0.
  • After every wake: 01:00.0 (BCM4388 WiFi, wld0 connected), 01:00.1 (BCM4388 BT, bootstage 2->0, BD_ADDR 60:3e:5f:4a:e8:c8 restored), 02:00.0 (GL9755 SDXC), card1-eDP-1 connected/enabled, post-Pass-2 gpubench-vk transfer.ops CRC 55a4e6b1 (valid: true), aurora-sep keystore=open, xart=enabled, 0 failed systemd units, 0 new PCIe/PM/GPU/BT/SEP/tipd errors. (Stock handback and m3hw lease release will follow after remaining G16 control rows on this lease.)

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at 6fd0b44b267fa74f8450fcc162d431fbeb9c6ee4
Blockers:

  1. Hosted apple-build and KUnit plan CI checks are still queued (host-tests and pr-text are now green).
  2. The target J714s (T6050) physical dark-wake re-entry row with #3846 listed under Not yet (directly exercising the warm-reset auxiliary-function -EIO path and t6050_sd_port_wake=1 dark-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-wake s2idle cycles across t6050_sd_port_wake=2 and 1, 0 PCIe/L1SS -EIO errors, 8/8 local arm64 host tests pass.
  • Verified exact-head J516s (T6030) shared-code control paired with #3846 48237685b006 (#issuecomment-7343839336): 2/2 clean RTC physical deep-sleep cycles plus lone-SMC dark-wake re-entry (second apple_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-tests and pr-text passed; apple-build and KUnit plan remain queued.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J714s (M5 Pro, T6050) exact-head row at 6fd0b44b267fa74f8450fcc162d431fbeb9c6ee4 (+ #3846 48237685b006): PARTIAL (clean dark-wake retry queued next)

  • Candidate: origin/main (2225082e1d18) + exact #3846 (48237685b006ac3d455f143d197e2c2303d9de6f) + exact #3898 (6fd0b44b267fa74f8450fcc162d431fbeb9c6ee4) in b0ccb5fce773 (7.3.0-m5-pr3898-b0ccb5fc), boots 63bd561e-b30d-4ad1-942c-b4205ce9f924 (Run 1) and 40c311c4-ea02-4fa3-97b9-9b6327464b5a (Run 2), /sys/power/mem_sleep = s2idle [deep], /dev/rtc1 (apple-pmu-rtc), SLC on (16 planes).
  • Row (1) Mode 2 (t6050_sd_port_wake=2) RTC control — PASS (2/2 boots): rtcwake -d /dev/rtc1 -m mem -s 60 returned rc 0 (60.128 s / 60.822 s), boot object resumes 0 -> 1, success 0 -> 1, fail 0 -> 0, RTC wake source, one thaw; 410000000.iommu + 411000000.iommu, port 0 + port 1, mmcblk0, wlp1s0f0, hci0, and eDP-1 all recovered with 0 faults.
  • Row (2) Mode 2 USB-C dark wake then RTC — PARTIAL (pcie-apple -EIO fixed): Unlike 730f0cadeb6d (where apple_pcie_prepare() returned -5 on 1cb0000000.pcie), apple_pcie_prepare() succeeded with 0 PCIe/L1SS errors on both dark-wake re-entry passes in Run 1 Cycle 2: dark wake 1 (USB-C_plug at 19.663 s) logged PM: dark wake: suspending again (deep), kept SD port 1 parked, and entered a second physical deep sleep cleanly (boot object resumes 1 -> 2 -> 3). However, the disconnect trigger's automatic replug 1.999 s later caused dark wake 2, whose 3rd sleep entry hit apple-sleep: refused at .prepare_late: SMC scope: -16 during active USB-C reconnect (rtcwake rc=1, fail 0 -> 1, clean rollback, 0 PCIe/DART faults).
  • Row (3) Mode 1 (t6050_sd_port_wake=1) — PARTIAL: Early-resume SD port restore verified (port 1: link up again after the sleep in 268 ms, status 0xdb001001, in the early resume, its root port restored, mmcblk0/wlp1s0f0/hci0 clean, 0 faults), but sn201202x 2-0c fired USB2_plug at 0.59 s in Cycles 2–5, preempting Mode 1 dark wake and 60 s RTC control.
  • Next: Retrying Row (2) and Row (3) on J714s using a dark-wake trigger that does not replug and with 2-0c kept quiet. Clean stock 7.3.0-m5-pr67 handback (hw released ok).

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Local CI receipt for the queued apple-build and KUnit plan jobs (hosted CI override, run on pc).

Merge: head 6fd0b44b267f onto main 8a42aee5a0a7 gives tree 7938a1b051ca (local merge commit 64d4d42afe7c). The merge applies exactly this PR's diff. Since the CI base 2225082e, no main commit touches drivers/pci/controller/. The nearest change is #3894 in drivers/pci/setup-bus.c (BAR resize), which this PR does not use.

Check Command Result
apple-build: the workflow's config (arm64 defconfig + asahi.config, LLVM=1, Rust) and its full directory list, plus W=1, warm O= make LLVM=1 W=1 modules_prepare drivers/accel/ane/ ... drivers/pci/controller/ ... mm/vma_exec.o 0 errors. pcie-apple.o has 0 warnings at W=1, the same as on main. The remaining W=1 warnings are all in files this PR does not touch: nvme apple.c thread-safety, display-gate.c, isp-drv.c, and asahi Rust dead-code lints.
Host tests (host-tests.yml image, --network=none) run-host-tests.py --jobs 8 952/952, including the four tests that read pcie-apple.c: cio-native, pcie-adopted-clkpm, pciec-policy and radio-sleep-snapshot
KUnit plan apple-kunit.py picks the mt7932 suite for pcie-apple.c Not run: the suite needs arm64 QEMU, which our build hosts do not have. pcie-apple.c and the mt7932 driver both compile in the apple-build run above.

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 d3cc6aec with this head had 950/952 host tests. In both failures, a mutant compile was killed under host load (qspi-nvram-tests, and t6030-pmp-graph-tests --mutations with build_rc -15). Both passed on rerun, and neither reads pcie-apple.c.

Still open from the review: the J714s physical dark-wake re-entry row.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J714s (M5 Pro, T6050) exact-head Rev 2 row — #3898 (6fd0b44b267fa74f8450fcc162d431fbeb9c6ee4) + #3846 (48237685b006ac3d455f143d197e2c2303d9de6f): 3/4 PASS (Mode 2 RTC PASS, Mode 1 RTC PASS, Mode 1 isolated physical dark-wake re-entry PASS; Mode 2 dark wake hit clean .enter SMC -125 cancelled-retry recovery)

  • Candidate: ac127c4d6e08bad0193d517919e56c7fe2444cc0 (7.3.0-m5-pr3898-ac127c4d) = origin/main (9177b2d474f8) + exact #3846 (48237685b006ac3d455f143d197e2c2303d9de6f) + exact #3898 (6fd0b44b267fa74f8450fcc162d431fbeb9c6ee4), candidate boot_id d4564e32-be38-4637-8813-1f6d9366665f, stock return c09c3aca-0d6b-4c10-8e74-682e89361a71, /sys/power/mem_sleep = s2idle [deep], /dev/rtc1 (apple-pmu-rtc), SLC on (16 planes).
  • Single-edge trigger & Type-C role hygiene: minihw spmi=1-0a disc-hold 35 calibrated (detach_latency=0.588 s, back_after_disc=36.908 s) and J714s tipd replug kept usb_wake_armed_on: null on all 4 cycles (0 USB2_plug preemptions).
  • Cycle 1 — Row (1) Mode 2 (t6050_sd_port_wake=2 -> 2) 60 s RTC control: PASS
    • rtcwake rc=0, BOOTTIME-MONOTONIC = 60.642 s, suspend_stats success 0 -> 1, fail 0 -> 0, boot object resumes 0 -> 1, wake NUB.SPMI0Sw3IRQ nub-spmi0.0x02 rtc, post-thaw SD port 1 link up in 271 ms (0xdb001001) + rescan (sdhci-pci 0000:02:00.0, mmcblk0, Wi-Fi, BT, eDP-1 all up), 0 faults.
  • Cycle 2 — Row (3) Mode 1 (t6050_sd_port_wake=1 -> 1) 60 s RTC control: PASS
    • rtcwake rc=0, BOOTTIME-MONOTONIC = 60.653 s, suspend_stats success 1 -> 2, fail 0 -> 0, boot object resumes 1 -> 2, wake NUB.SPMI0Sw3IRQ nub-spmi0.0x02 rtc, early-resume SD port 1 restore (link up again after the sleep in 271 ms, status 0xdb001001, in the early resume, its root port restored) + post-thaw rescan, all subsystems up, 0 faults.
  • Cycle 4 — Row (3) Mode 1 (t6050_sd_port_wake=1 -> 1) isolated USB-C_plug dark wake then 60 s RTC: PASS
    • rtcwake rc=0, BOOTTIME-MONOTONIC = 59.448 s, suspend_stats success 2 -> 3, fail 1 -> 1.
    • Dark wake 1 (boot object resumes 3 -> 4): SMC.OutboxNotEmpty, MBSE 0x10050, MBSW ... 04 00 00: USB-C_plug, woken for USB-C_plug alone after 41.502 s asleep: dark wake 1, apple-drm: dark wake: outputs stay off, PM: dark wake: suspending again (deep), 0 apple_pcie_prepare() / L1SS errors, SD port 1 and DART 411000000.iommu stayed parked across the dark wake, 2nd physical deep sleep committed cleanly.
    • Final programmed RTC wake (boot object resumes 4 -> 5, +2 firmware resumes in one rtcwake request): NUB.SPMI0Sw3IRQ nub-spmi0.0x02 rtc, single final thaw, early-resume SD port 1 restore (269 ms, status 0xdb001001, in the early resume, its root port restored) + single post-thaw its functions found again, Wi-Fi/BT/SD/eDP-1 all up, 0 PCIe/DART/GPU faults.
  • Cycle 3 — Row (2) Mode 2 (t6050_sd_port_wake=2 -> 2) isolated USB-C_plug dark wake: cancelled-retry recovery (.enter: final check: -125), 0 PCIe/L1SS/DART faults
    • Dark wake 1 at 41.296 s (USB-C_plug, boot object resumes 2 -> 3), SD port 1 stayed parked, PM: dark wake: suspending again (deep), apple_pcie_prepare() passed with 0 errors, then macsmc logged Elec: Elec Cause 0x8000000 (trailing USB-C detach electrical event) and apple-sleep refused at .enter: final check: -125 (-ECANCELED, rtcwake rc=1, success 2 -> 2, fail 0 -> 1). Clean rollback: apple_pmp/aurora sleep refused before the commit, single PM: suspend exit, SD port 1 link up (270 ms) + rescan, Wi-Fi/BT/SD/eDP-1 all recovered with 0 faults.
    • Combined with the prior b0ccb5fc Run 1 Cycle 2 (where Mode 2 dark wake 1 passed .enter and entered physical deep sleep 1 -> 2 -> 3 with SD port 1 parked and 0 PCIe -EIO), #3898's shared apple_pcie_prepare() L1SS fix and t6050_sd_port_wake=1 dark-wake park guard + #3846's dark-wake IRQ consumption and full two-entry physical deep sleep (rc=0, +2 firmware resumes, success +1 / fail +0) are all verified on J714s hardware.
  • GPU sanity & handback: GPUBench rt.scene b541b83e PASS pre-sleep (403.3 FPS), post-resume (403.0 FPS), and stock PR67 (403.5 FPS); pacman -Qkk mesa 0 altered; 13/13 boot slot hashes & 83/83 ICD hashes identical; XWayland 0x200005; all 18 deadman units inactive; hw lease released ok (827 s).

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J714s (M5 Pro, T6050) exact-head Mode 2 dark-wake repeat — #3898 (6fd0b44b267fa74f8450fcc162d431fbeb9c6ee4) + #3846 (48237685b006ac3d455f143d197e2c2303d9de6f): PASS (all 4 line-181 rows now PASS)

  • Candidate: ac127c4d6e08bad0193d517919e56c7fe2444cc0 (7.3.0-m5-pr3898-ac127c4d) = origin/main (9177b2d474f8) + exact #3846 (48237685b006ac3d455f143d197e2c2303d9de6f) + exact #3898 (6fd0b44b267fa74f8450fcc162d431fbeb9c6ee4), candidate boot_id f5a4ef32-c32e-40c9-86c9-d82c8ac70472, stock return b9c51db5-6ffd-462f-a6df-271156080696, /sys/power/mem_sleep = s2idle [deep], /dev/rtc1 (apple-pmu-rtc), SLC on (16 planes).
  • Row (2) Mode 2 (t6050_sd_port_wake=2, read back 2 -> 2) isolated USB-C_plug dark wake then 60 s RTC: PASS
    • Counters: rtcwake rc=0, BOOTTIME-MONOTONIC = 59.741 s, suspend_stats success 0 -> 1, fail 0 -> 0, boot object resumes 0 -> 1 (dark wake) then 1 -> 2 (programmed RTC wake), single PM: suspend exit / single final thaw, refusals: [], usb_wake_armed_on: null.
    • Single-edge trigger (minihw spmi=1-0a disc-hold 35): t_disc=1796219862.876, detach_latency=0.599 s, reattach back_after_disc=36.82 s (13:58:19Z, after Cycle 1 finished at 13:58:17Z).
    • Wake & macsmc sequence (kernel-cycle.log):
      • Entry 1 (158.556 s): port 1: parked for the sleep, its functions removed, its DART saved and gated; USBw 0x9: -1 on 1-0a and 2-0c; 14 coprocessors stopped.
      • Dark wake 1 (161.325 s): AP 127 SMC.OutboxNotEmpty, MBSE 0x10050, MBSW 00 00 00 00 00 04 00 00: USB-C_plug, boot object resumes 0 -> 1, woken for USB-C_plug alone after 41.310 s asleep: dark wake 1 (at most 128 in a row), 0 Elec: Elec Cause lines during sleep/re-entry.
      • Re-entry (161.348 s): PM: dark wake: suspending again (deep), 0 apple_pcie_prepare() / L1SS errors, SD port 1 and DART 411000000.iommu stayed parked, 14 coprocessors stopped -> 2nd physical deep sleep committed cleanly.
      • Final RTC wake (161.356 s): AP 76 NUB.SPMI0Sw3IRQ, MBSE 0x10650, MBSW 00 00 00 00 00 00 00 00, wake events: NUB.SPMI0Sw3IRQ nub-spmi0.0x02 rtc, boot object resumes 1 -> 2, PM: suspend exit, post-thaw apple-dart 411000000.iommu: restored after its host came back, port 1: link up again after the sleep in 275 ms, status 0xdb001001, port 1: its functions found again after the sleep (sdhci-pci 0000:02:00.0, mmcblk0 LX64G, Wi-Fi, BT, eDP-1 all up), 0 PCIe/DART/GPU faults.
  • Combined line-181 summary on ac127c4d (with Rev 2 d4564e32):
    • Row (1) Mode 2 RTC control: PASS (rc=0, 60.642 s, resumes 0 -> 1, success +1 / fail +0)
    • Row (2) Mode 2 isolated USB-C_plug dark wake -> 2nd physical deep sleep -> 60 s RTC: PASS (rc=0, 59.741 s, resumes 0 -> 1 -> 2, success +1 / fail +0)
    • Row (3) Mode 1 RTC control: PASS (rc=0, 60.653 s, resumes 1 -> 2, success +1 / fail +0, early-resume SD restore)
    • Row (3) Mode 1 isolated USB-C_plug dark wake -> 2nd physical deep sleep -> 60 s RTC: PASS (rc=0, 59.448 s, resumes 3 -> 4 -> 5, success +1 / fail +0, SD parked across dark wake + early-resume restore)
  • GPU sanity & handback: GPUBench rt.scene b541b83e PASS pre-sleep (403.4 FPS), post-resume (403.3 FPS), and stock PR67 (403.5 FPS); pacman -Qkk mesa 0 altered; 13/13 boot slot hashes & 83/83 ICD hashes identical; XWayland 0x200005; all deadman units inactive; hw lease released ok (441 s).

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@DjDeveloperr
DjDeveloperr merged commit bf72c9c into main Dec 2, 2026
11 of 13 checks passed
@DjDeveloperr
DjDeveloperr deleted the fix/pcie-apple-dark-wake-reentry branch December 2, 2026 14:20
@RyanTheTide

Copy link
Copy Markdown
Contributor

K114s (14-inch M5 Pro, T6050) PMU RTC wake re-run on main 1ab453e8b404 (includes #3898 bf72c9cd and #2007 52cf96e4):

  • Kernel: 7.3.0-b7rtc+ built from main 1ab453e8b404, K114s config, default cmdline.
  • Stage 2: one-shot aura-try (aura 1.0.0b18 + main t6050-k114s.dtb 6bfb1db5, so arm64: dts: apple: t6050: wire the PMIC RTC alarm interrupt #2007's nub_spmi0 AIC 726 + smc_rtc <&nub_spmi0 2> wiring is live).
  • RTC selection by name: grep -l apple-pmu /sys/class/rtc/rtc*/name -> rtc1 (apple-pmu-rtc 28a014000.spmi:pmic@e:rtc); rtc0 = macsmc-rtc (owns IRQ 99: apple_spmi 2 Edge).
  • mem_sleep: [s2idle] (state=freeze mem; t6050-k114s.dts does not yet carry an apple,t6050-sleep node, so -m mem enters s2idle).
Device Mode Cycles Result suspend_stats IRQ 99 (apple_spmi 2)
rtc1 (apple-pmu-rtc) freeze (s2idle) 3 x 15 s 3/3 PASS 0 -> 3, fail=0 0 -> 3
rtc1 (apple-pmu-rtc) mem ([s2idle]) 3 x 15 s 3/3 PASS 3 -> 6, fail=0 3 -> 6
rtc0 (macsmc-rtc) freeze (s2idle) 1 x 15 s 1/1 PASS 6 -> 7, fail=0 6 -> 7
rtc0 (macsmc-rtc) mem ([s2idle]) 1 x 15 s 1/1 PASS 7 -> 8, fail=0 7 -> 8

Total 8/8 PASS, Enforcing, failed=0, 0 WARN/BUG/Oops; internal panel, external 1920x1080@180 Hz display, Centauri Wi-Fi, MTP input, and H17 ANE returned cleanly after every wake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blast:all Macs affected, from Merge risk (bot) changes-requested A reviewer requested changes (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants