Skip to content

soc: apple: suspend-to-RAM on M3 (T8122, J613/J615) - #3140

Merged
DjDeveloperr merged 13 commits into
mainfrom
soc-apple/t8122-s2r
Nov 25, 2026
Merged

DjDeveloperr merged 13 commits into
mainfrom
soc-apple/t8122-s2r

Conversation

@satchlj

@satchlj satchlj commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

What: Firmware-driven suspend-to-RAM (deep) for Apple M3 (T8122, MacBook Air 13" J613 and 15" J615) on the shared Apple system sleep framework (apple,t8122-sleep), covering AOP sleep endpoints, PMP SRAM backup (0x36000 / 0x47000, with DT apple,sram-keep override), two-cluster MCC SLC write-back (memory-controller@220000000), ANS warm sleep/restart (with dry-run cold-shutdown and refused-sleep cold-reset fallback), conventional PCIe host domain hold across firmware suspend_noirq, T8122 ACIO router deep-sleep teardown ahead of DWC3's PM notifier (apple_cio_t8122_hw), iomfb 26.6 power-down callbacks and cold-stop, T8122 deep-WFI entry/wake (HID4/EHID4 cache clean, APCIE power-down/restore, CYC_OVRD, wake mask), DT bindings, and shared t8122.dtsi / t8122-j613-j615.dtsi nodes (including sep@29e400000 power domains for commit-time SEP sleep staging). Zero board-specific gating so J613 and J615 share the same path.

Tested:

  • J613 M3 MacBook Air 13" (25G83 firmware) at 12900893333d50d: PASS — d1 dry-run + 3/3 consecutive real deep S2R cycles with pcie-apple 580000000.pcie probed live (Link up on /soc/pcie@580000000/pci@0,0, unmodified compiled t8122-j613-25g83.dtb, wdt=0, alarm=15, zero sleep dev cmdline params):
    • d1 dry-run hard gate PASS (d1-20261125T132948Z): 580000000.pcie probed live and held intact across suspend_noirq, apple-mcc 2 planes enabled, apple_pmp bound, dry run: every check passed, nvme-apple took the clean cold shutdown + cold PMGR reset path (nvme_io=OK), zero SErrors/panics.
    • 3/3 consecutive real deep S2R cycles PASS (e-20261125T133223Z, j613.cycles=3, apple-pmu-rtc rtc0 wakealarm, 580000000.pcie probed live): boot object resumes 0 -> 1 -> 2 -> 3, wake source: NUB.SPMI0.SW3 x3, ANS: on 414/413/401 ms after the run bit with nvme_io=OK, clean apple_pmp wake (zero -62), clean 2-plane apple-mcc wake, 29e400000.sep bound, 156 of 224 AP pins restored on every wake, zero SErrors/warnings/panics.
  • Local build, DT, host, and KUnit checks at 12900893333d50d:
    • ARM64 LLVM=1 C + Rust (asahi.config / trial config with CONFIG_USB4_APPLE_SOC=y) build of drivers/thunderbolt/apple.o (W=1), Image, t8122-j613-25g83.dtb, and t8122-j615.dtb: 0 errors, 0 new warnings.
    • tools/asahi/pciec-policy-tests.py: PASS (including T8122 ACIO matching, deep-sleep vs s2idle/freeze gating, DWC3 PM notifier order, and negative controls t8122-drop-match, t8122-drop-sleep-removes-domains, t8122-drop-phy-shared).
    • tools/asahi/tb-cio-sleep-tests.py (41 cases + 27 negative controls) and tools/asahi/apple-router-sleep-tests.py (84 cases + 9 negative controls): PASS.
    • ARM64 QEMU KUnit (drivers/thunderbolt/.kunitconfig.apple-dpin): thunderbolt (73/73), apple-dpin-lifecycle (36/36), apple_mbox_g17_stall (3/3, 1 skipped) — 112/112 passed.
    • Previously verified at 7e581f1e409cf79 (unchanged files): dt_binding_check / CHECK_DTBS=y on t8122-j613*.dtb & t8122-j615*.dtb, aop-bootargs-tests, aop (8/8), brcmf-pcie-dma-tests.py (58/58), mcc (6/6), pmp (22/22), test-j613-dcp-power, sleep/DCP host tests (33/33), and KUnit apple-sleep-soc-data (16/16), dcp-fabric (117/117), dcp-topology (202/202).

Risk: two-way · t8122_sleep_soc keeps .untested = true (matching t8142_sleep_soc), so default s2idle behavior is unchanged and real deep sleep remains opt-in (apple_sleep.deep=1 apple_sleep.untested_commit=1) until J615 hardware validation completes. Shared sleep-core, NVMe warm-sleep, PCIe conventional host domain hold, T8122 ACIO deep-sleep teardown (s2idle/freeze preserved), PMP, MCC, and iomfb 26.6 hooks are scoped to T8122 / per-SoC flags.

Not yet: J615 (M3 MacBook Air 15") default-cmdline Phase 1 re-test at 12900893333d50d and live deep S2R validation; J615 27.2 DCP sleep support (tracked separately); live S2R with Borealis GPU actively bound.

Details

12 atomic commits + forward merge of main (9cb3dc6a7f2843e):

  1. soc: apple: aop: add T8122 sleep endpoints
  2. soc: apple: pmp: add T8122 SRAM backup config
  3. soc: apple: mcc: support T8122 two-cluster SLC write-back for deep sleep
  4. nvme: apple: support T8122 ANS warm sleep and restart
  5. drm/apple: iomfb 26.6: answer power-down callbacks (matches drm/apple: iomfb 26.6: answer the display power-down callbacks #2558's iomfb_v26_6.c hunk verbatim for conflict-free coordination)
  6. dt-bindings: soc: apple: sleep: add apple,t8122-sleep
  7. soc: apple: sleep: add T8122 deep sleep and resume
  8. drm/apple: iomfb 26.6: cold-stop DCP for firmware-driven sleep
  9. arm64: dts: apple: t8122: describe sleep controller and two-cluster MCC (also wires sep@29e400000 power-domains = <&ps_sep>, <&ps_gpio>; for commit-time SEP sleep staging)
  10. nvme: apple: skip T8122 warm sleep on dry runs and fall back on refused sleeps
  11. PCI: apple: hold conventional host domains across noirq suspend for firmware sleep
  12. Merge branch 'main' into soc-apple/t8122-s2r (keeps T6030/T6031 on HW_CFG_T6030 separate from HW_CFG_T8122)
  13. thunderbolt: apple: tear down T8122 ACIO routers for deep sleep

Supersedes draft PRs #2572 and #2746.

Stop T8122's twelve AFK endpoints before deep sleep and restart them on
resume, both when the bootloader provides firmware memory regions and on
the fallback without them.

Signed-off-by: Satya Benson <[email protected]>
Match "apple,t8122-pmp-v2" with T8122's SRAM __DATA backup window
(offset 0x36000, size 0x47000), allowing a device-tree apple,sram-keep
property to override it when supplied by the bootloader.

Signed-off-by: Satya Benson <[email protected]>
Match "apple,t8122-mcc" with the retained two-plane path so T8122
disables SLC allocation on suspend and restores it after deep sleep
wake.

Signed-off-by: Satya Benson <[email protected]>
Add an apple_nvme_t8122_hw profile matched on "apple,t8122-nvme-ans2" with
warm_sleep enabled. On firmware-driven suspend-to-RAM, warm-idle ANS via
apple_rtkit_idle() and clear CPU_CONTROL instead of tearing down RTKit.
On resume, restore GPIO pins, replay SART entries, and warm-restart ANS
via apple_rtkit_sleep_return_start() before disabling any retained
controller state and rebuilding the NVMe queues. Also replay SART after
a pre-M4 PMGR reset deassert where ANS and SART share a reset line.

Signed-off-by: Satya Benson <[email protected]>
Answer the callbacks the 26.6 DCP firmware sends when the display is
powered down during suspend-to-RAM: D(2) (will_power_off_signal) and
D(592) (swap_complete_intent_gated) as no-ops, D(572) (powerUpDART)
via dcp_s2r_dart_power() with success, and D(209) (get_calendar_time_ms).

Signed-off-by: Satya Benson <[email protected]>
Document the apple,t8122-sleep compatible and its 21 named register
windows covering PMGR power state, CPU powergate/cluster controls,
sleep commit, watchdog, SPMI, wake sources, MCC channels, and APCIE
shared/port0 blocks.

Signed-off-by: Satya Benson <[email protected]>
Add the apple,t8122-sleep profile and SoC callbacks to the shared Apple
system sleep driver, guarded behind apple_sleep.deep=1 and
apple_sleep.untested_commit=1 while untested across all T8122 boards:

- Extend the shared sleep core with per-SoC el1_wfi, no_wd2,
  debug_cut_after_stops, no_pmu_notes, display_no_restart, wake_required,
  and dry-run support (apple_sleep_dry_run()) for early_context SoCs.
- Implement T8122 entry/wake in sleep-t8122.h: map all 21 register
  windows from DT (including MCC channels and APCIE blocks), clear
  HID4/EHID4 DISABLE_DC_MVA and DISABLE_DC_SW_L2 around the full
  PoP/PoC and L1/L2 cache clean, power down and restore APCIE PHY/port0,
  step down MCC channels, and arm CYC_OVRD WFI mode 3 and
  DEEP_SLEEP_ENABLE before dropping to EL1 deep WFI.
- Register apple,t8122-sleep in sleep-test.c KUnit coverage.

Signed-off-by: Satya Benson <[email protected]>
When firmware-driven deep sleep will cut display power on an internal
26.6 DCP session (and the sleep is not a dry run), send the firmware's
panel-off and sleep-entry RPC sequences, request RTKit AP/IOP idle, and
halt the coprocessor so display power domains can turn off cleanly.
Ignore further flushes and resume calls while cold-stopped.

Signed-off-by: Satya Benson <[email protected]>
Update the T8122 memory-controller node to memory-controller@220000000
with its two SLC cluster multicast apertures, add the disabled
apple,t8122-sleep node with all 21 register windows to t8122.dtsi, and
enable both nodes in the shared t8122-j613-j615.dtsi board description.

Signed-off-by: Satya Benson <[email protected]>
@satchlj
satchlj requested review from a team as code owners November 25, 2026 08:49
@satchlj
satchlj requested review from Acelogic and maralcbr November 25, 2026 08:49
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m3 Macs affected, 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) needs-template PR body lacks Tested or Risk (bot) labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Merge readiness at 12900893: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at 12900893
Conflicts ok none
PR text ok Risk: two-way · t8122sleepsoc keeps .untested = true (matching t8142sleepsoc), so default s2idle behavior is unchanged and real deep sleep remains opt-in (applesleep.deep=1 applesleep.untestedcommit=1) until J615 hardware validation completes. Shared sleep-core, NVMe warm-sleep, PCIe conventional host domain hold, T8122 ACIO deep-sleep teardown (s2idle/freeze preserved), PMP, MCC, and iomfb 26.6 hooks are scoped to T8122 / per-SoC flags.

Areas: area:display, area:gpu, area:platform, area:usb

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

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) and removed needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 25, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

9bf498ce08d78ec J615 (M3 Air 15", macOS 27.2 fw, exact head + compiled t8122-j615.dtb via one-shot aura-try, apple_sleep.deep=1, apple_sleep.untested_commit=N) FAIL (Phase 1 dry-run hang):

  • Boot PASS (boot_id=16d8d8b6, Enforcing, failed=0, mem_sleep=[s2idle] deep, rtc0=apple-pmu-rtc, 2d0700000.sleep-controller probed: sleep data derived for this SoC, untested: deep sleep is offered (apple_sleep.deep=1), and a sleep stops before the commit (dry run) / boot object resumes 0, apple-t8122-display enabled 27.2 internal 28ec00000.dcp + external 31ac00000.dcp, card1-eDP-1: connected enabled, apple_aop ready, apple_sep 12 eps + Touch ID restored). Note: rtkit-helper 2fa400000.mtp logged a boot crash (apple-sleep: 2fa400000.mtp crashed: later sleeps take the deep path).
  • Phase 1 dry run FAIL (echo deep > /sys/power/mem_sleep, untested_commit=N, rtcwake -d rtc0 -m mem -s 15): entered mem suspend at 09:56:01 UTC, stopped flushing journald, dropped off Wi-Fi (No route to host, 0 ARP), and stayed wedged >8 min with no recovery (.no_wd2 = true, .no_pmu_notes = true, /sys/fs/pstore empty) until VDM reboot from M1 Pro (USB-C Left Back) at 10:04 UTC.
  • Observations in 9bf498ce08d78ec that may be relevant on 27.2 J615:
    1. drivers/nvme/host/apple.c: apple_nvme_suspend() warm-idles and stops ANS (writel(0, CPU_CONTROL)) whenever pm_suspend_via_firmware() is true, without checking !apple_sleep_dry_run(). After a dry-run refusal (-EAGAIN), pm_resume_via_firmware() is false, so apple_nvme_t8122_warm_resume() attempts apple_rtkit_warm_restart() + CPU_CONTROL_RUN without PMGR reset/power-cycle; if ANS fails to come back in apple_nvme_sleep_wait_on(), it holds all NVMe I/O indefinitely (blocking journald/rootfs).
    2. J615 runs macOS 27.2 DCP (28ec00000.dcp + 31ac00000.dcp), which does not match dcp_sleep_owned() (DCP_FIRMWARE_V_26_6) or dcp_v27_sleep_selected() (apple,t6050-dcp*).
  • Restored J615 to saved 7.3.0-aurora-fleet85 (boot_id=10e106f5, untouched stage2.bin, Enforcing, failed=0, next_entry empty).

…ed sleeps

Do not warm-idle ANS when apple_sleep_dry_run() is active; take the
standard apple_rtkit_shutdown() and cold PMGR reset path instead,
matching suspend-to-idle.

If a non-dry-run firmware sleep is refused before the commit
(!pm_resume_via_firmware()), fall back to the cold PMGR reset path in
apple_nvme_reset_work_impl() rather than attempting a warm restart
without a power cycle or locking sleep_failed.

Signed-off-by: Satya Benson <[email protected]>
…irmware sleep

Conventional Apple PCIe hosts that use apple_pcie_s2r_reinit() currently
only call apple_pcie_hold_domains() during suspend-to-idle. On SoCs
whose host power domain is not marked always-on (such as T8122
ps_apcie_gp/ps_apcie), genpd gates the host during suspend_noirq even
for firmware-driven sleeps. If the sleep is a dry run or is refused
before the commit (!pm_resume_via_firmware()), neither the SoC wake
sequence nor apple_pcie_hib_restore_noirq()/apple_pcie_resume() runs,
leaving the controller unprogrammed behind a down link.

Hold the host's attached power domains across genpd suspend_noirq for
firmware-driven sleeps as well, releasing them in
apple_pcie_resume_noirq(). On an abandoned or dry-run sleep the
controller and link stay intact; on a real committed sleep the SoC
commit powers the block down and the wake path retrains it.

Signed-off-by: Satya Benson <[email protected]>
@satchlj

satchlj commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Thanks @RyanTheTide — that J615 dry-run report nailed two real bugs on the dry-run / refused-sleep unwind path. Pushed two follow-up commits at 05eb659c4a23e0b:

  1. 038447c6a96c45c (drivers/nvme/host/apple.c): Guard the T8122 warm_sleep branch with !apple_sleep_dry_run() so dry runs take the standard apple_rtkit_shutdown() + cold PMGR reset path (matching s2idle). Also, if a non-dry-run firmware sleep is refused before the commit (!pm_resume_via_firmware()), return early from apple_nvme_t8122_warm_resume() so apple_nvme_reset_work_impl() performs a cold PMGR reset instead of attempting apple_rtkit_warm_restart() without a power cycle and locking sleep_failed (which held all NVMe I/O indefinitely).
  2. 05eb659c4a23e0b (drivers/pci/controller/pcie-apple.c): Hold conventional host power domains across genpd suspend_noirq for apple_pcie_s2r_reinit() && pm_suspend_via_firmware() as well as s2idle. T8122's pcie0 (580000000.pcie, Wi-Fi/BT) uses ps_apcie_gp -> ps_apcie, neither of which is apple,always-on; without holding the domain, genpd powered off the controller during suspend_noirq even on a dry run or refused sleep where neither t8122_sleep_wake() nor apple_pcie_hib_restore_noirq()/apple_pcie_resume() runs, leaving the controller unprogrammed behind a down link on resume. On a real committed sleep, the SoC commit still powers APCIE down and the wake path retrains it.

Exact-head J613 (25G83) verification at 05eb659c4a23e0b (with CONFIG_GPIO_MACSMC=y so 580000000.pcie probed live, Link up on /soc/pcie@580000000/pci@0,0 in 3 ms):

  • Phase 1 dry-run (d1, untested_commit=N): PASS — 580000000.pcie stayed intact across suspend_noirq, nvme-apple took the clean cold shutdown + cold PMGR reset path, dry run: every check passed, nvme_io=OK, zero SErrors/panics.
  • 3/3 consecutive real deep S2R cycles (untested_commit=1, wdt=0, alarm=15): PASS — boot object resumes 0 -> 1 -> 2 -> 3, wake source: NUB.SPMI0.SW3 x3, ANS: on 424/409/416 ms after the run bit, nvme_io=OK, clean apple_pmp and 2-plane apple-mcc wake, 156 of 224 AP pins restored x3, zero SErrors/panics.

Ready for a J615 Phase 1 dry-run re-test at 05eb659c4a23e0b (adding no_console_suspend + netconsole is still helpful if anything else surfaces on 27.2). Note on 27.2 DCP: Phase 1 dry-run should now complete cleanly and return; Phase 2 (untested_commit=1) on 27.2 DCP is expected to refuse cleanly at apple_sleep_refuse() (refused: a bound display coprocessor is still running) since dcp_sleep_owned() currently targets 26.6 firmware, and with both fixes above that refusal should also unwind cleanly without wedging NVMe or PCIe.

Resolve drivers/soc/apple/aop.rs conflict with commit 701e320
("soc: apple: aop: use region-aware startup on T6030 and T6031"):
keep T6030/T6031 on a separate HW_CFG_T6030 without T8122 sleep
endpoints, while keeping HW_CFG_T8122 (and HW_CFG_T8122_NO_FW_REGIONS)
for apple,t8122-aop.

Signed-off-by: Satya Benson <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor

05eb659c4a23 J615 (M3 Air 15", T8122, macOS 27.2 fw) FAIL in Phase 1 dry run — bisected cleanly via /sys/power/pm_test to platform (between dpm_suspend and TEST_PLATFORM, before processors/core/apple_sleep_enter_early()):

  • Run 1 — Phase 1 dry run (7.3.0-aurora-pr2899-aurora-pr3140v2, boot_id=f30b2133-3cf9-42b7-b942-efd15bbffdee, #3140 t8122-j615.dtb via one-shot aura-try, apple_sleep.deep=1 no_console_suspend, untested_commit=N, mem_sleep=deep, rtcwake -d rtc0 -m mem -s 15):
    • Booted cleanly (Enforcing, 0 failed, mem_sleep=[s2idle] deep, rtc0=apple-pmu-rtc). Note: netconsole registered on wld0 (printk: console [netcon0] enabled), but brcmfmac emitted 0 UDP packets.
    • Hung on rtcwake -d rtc0 -m mem -s 15 before userspace thawed (zero journal lines written after 11:39:39); recovered via m1pro USB-C Left Back VDM reset and verified restored 7.3.0-aurora-fleet85 (294be63b-d442-4292-8bca-0314d1d6904d).
  • Run 2 — /sys/power/pm_test bisect at exact 05eb659c4a23 (boot_id=0dbfb081-b4a8-46ce-84e7-f98fb9e0aa2f, apple_sleep.deep=1 no_console_suspend initcall_debug, pm_print_times=1, mem_sleep=deep):
    • freezer: PASS (RC=0, 5.33 s).
    • devices: PASS (RC=0, 6.12 s) — 038447c6a96c fixed nvme-apple dry-run cold shutdown/restart cleanly (nvme-apple returned boot mode normal, PM: resume devices took 0.079 seconds, Wi-Fi and NVMe intact).
    • platform: HANG — never returned from echo mem > /sys/power/state; recovered via m1pro Left Back VDM and verified restored 7.3.0-aurora-fleet85 (449218bf-917b-43a5-a56d-f81d753a7615, stage2.bin untouched dd01f13c, Enforcing, 0 failed, next_entry empty).
  • Narrowed hang window & J615-vs-J613 differences inside TEST_PLATFORM:
    • The hang happens strictly in apple_sleep_prepare -> dpm_suspend_late -> apple_sleep_late_scope_begin -> dpm_suspend_noirq / dpm_resume_noirq -> dpm_resume_early (never reaches CPU hotplug, syscore_suspend, or apple_sleep_enter_early()).
    • Key callbacks active on J615 (27.2 fw + USB4 VDM cable to m1pro) inside that window when pm_suspend_via_firmware() == true and pm_resume_via_firmware() == false:
      1. apple_dart_sys_suspend_noirq() (drivers/iommu/apple-dart.c:7734) runs pm_runtime_force_suspend() on all DARTs during suspend_noirq (including 28d304000.iommu / 28d30c000.iommu / 319304000.iommu while both 27.2 DCPs 28ec00000.dcp and 31ac00000.dcp keep firmware running via dcp->sleep_fw_runs = true, plus b01ac0000.cio and 2fa400000.mtp DARTs).
      2. aop_suspend_late() (drivers/soc/apple/aop.rs:3310) calls sleep_enter() on 27.2 AOP.
      3. apple_nhi_suspend_noirq() / apple_nhi_resume_noirq() on J615's live USB4 host-to-host link (b01ac0000.cio, thunderbolt 0-1).
      4. apple_pcie_suspend_noirq() / apple_pcie_resume_noirq() (580000000.pcie, apple_pcie_hib_save + apple_pcie_hold_domains).
    • Additional J615 boot observations from -b -1: 220000000.memory-controller (apple-mcc) still returned -EPROBE_DEFER (517) after devices resume; 2fa400000.mtp (rtkit-helper) crashed at boot on 27.2 (probe failed -62), logging apple-sleep: 2fa400000.mtp crashed: later sleeps take the deep path.
    • Phase 2 (untested_commit=1) was not reached because Phase 1 dry run still hangs at pm_test=platform.

@satchlj

satchlj commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Thanks @RyanTheTide — that /sys/power/pm_test bisection (freezer PASS, devices PASS, platform HANG) is super helpful: it confirms 038447c6a96c (nvme-apple dry-run unwind) works cleanly on J615 and pins the hang strictly to dpm_suspend_late / dpm_suspend_noirq / dpm_resume_noirq / dpm_resume_early (which is also where apple-dart noirq suspend/resume and genpd noirq power-off run when mem_sleep=deep).

Auditing every late/noirq callback against J613 (M3 Air 13", macOS 26.6 fw — which passes full dry-run and real deep S2R at exact head 7e581f1e409cf79), there are three concrete J615-only differences in pm_test=platform:

  1. dcpext enabled on 27.2 fw (31ac00000.dcp, ps_dispext_cpu, dcpext_dart 31930c000.iommu, dispext0_dart 319304000.iommu):
    • Confirmed bug: ps_dispext_cpu (arch/arm64/boot/dts/apple/t8122-pmgr.dtsi) is off at boot and lacks apple,sleep-wakeup-path;, so GENPD_FLAG_ACTIVE_WAKEUP is not set even though 31ac00000.dcp calls device_set_wakeup_path().
    • In addition, unlike the locked internal dcp_dart/disp0_dart, dcpext_dart and dispext0_dart are unlocked DARTs whose apple_dart_sys_suspend_noirq() / apple_dart_sys_resume_noirq() (including apple_dart_invalidate_each_stream()) run while 31ac00000.dcp firmware is still live.
  2. J615 PCIe &port00 { supports-clkreq; } (t8122-j615.dts) + &wifi0 { wakeup-source; }:
    • Enables ASPM/PCI-PM L1.1/L1.2 + Clock PM on J615 only. Under pm_test=platform, pci_pm_suspend_noirq() drops 01:00.0/01:00.1/00:00.0 to D3hot/L1.2 before 580000000.pcie (apple_pcie_hib_save()) and 594000000.iommu (pcie0_dart) access MMIO in noirq.
  3. Live USB4 XDomain on b01ac0000.cio / b01f00000.nhi / b01a80000.iommu (usb4_1_dart):
    • Under mem_sleep=deep, tb_domain_retain_noirq_control() is false, so apple_nhi_suspend_noirq()/resume_noirq() runs tb_ctl_stop() + usb4_1_dart noirq + tb_ctl_start() + tb_switch_resume() on the live host-to-host link.

Before we push a speculative fix, could you run a quick isolation pass on pm_test=platform (at 7e581f1e409cf79 or 05eb659c4a23)?

  • If you can capture console lines during platform: initcall_debug no_console_suspend plus echo 0 > /sys/power/pm_async && echo 1 > /sys/power/pm_print_times will print the exact calling <dev> line where it stalls.
  • Otherwise (without UART, ~10 s each): these three toggles isolate the suspects directly:
    1. Boot with apple_t8122_display.dcpext=0 (isolates dcpext / ps_dispext_cpu / dcpext_dart / dispext0_dart).
    2. Boot with pcie_aspm=off (isolates port00 supports-clkreq L1.2 + 580000000.pcie / pcie0_dart).
    3. Run echo 1 > /sys/module/thunderbolt_apple/parameters/s2idle_teardown before pm_test=platform (tears down b01ac0000.cio at PM_SUSPEND_PREPARE without physically unplugging, and restores it on wake — isolates the live USB4 XDomain noirq path).

Once we know which of those triggers the hang, I'll fold that fix together with the ps_dispext_cpu/dcpext fix into a clean commit, verify on J613, and push for a re-run.

@RyanTheTide

Copy link
Copy Markdown
Contributor

7e581f1e409c J615 (M3 Air 15", T8122, macOS 27.2 fw) pm_test re-test FAIL at platform (same hang boundary as 05eb659c4a23):

  • Boot: exact 7e581f1e409cf79 (7.3.0-aurora-pr2899-aurora-pr3140v3, boot_id=b87b1c31-ae2f-477d-bd72-f041135b565f, #3140 t8122-j615.dtb via one-shot aura-try, apple_sleep.deep=1 no_console_suspend initcall_debug, pm_print_times=1, pm_debug_messages=1, mem_sleep=[deep], Enforcing, failed=0).
  • Results:
    • #1985 PMP floor is present (apple-pmp-report 2d03c0000.pmp_report: memory floor 0x2004000200000000: waiting for the PMP before admission); 220000000.memory-controller (apple-mcc) remains -EPROBE_DEFER (517).
    • 2fa400000.mtp still crashes at boot (0.588s, PC=0x10379d0 FAR=0x39686d08aa0003f3) because J615's saved stage2.bin (dd01f13c) does not yet have aura#519's M3 MTP DMA window fix.
    • pm_test=freezer: PASS (5.14 s); pm_test=devices: returned -EBUSY (0.04 s, transient hci0 Opcode 0x0c24 wakeup); pm_test=platform: HANGS HARD (never reaches processors/core/apple_sleep_enter_early()). Note: brcmfmac (wld0) emits 0 UDP netconsole packets (no netpoll TX), so no kernel lines streamed past dpm_suspend_noirq over Wi-Fi.
  • Recovery & restore: Recovered via m1pro Left Back VDM (Target acknowledged VDM (reply header 0x05ac8052)), verified J615 restored to saved 7.3.0-aurora-fleet85 (a90e2472-dc1e-4365-ab97-a466d3dc9e2e, stage2.bin untouched dd01f13c, RESTORED_DTB_CLEAN=1, Enforcing, failed=0, next_entry empty).

@satchlj

satchlj commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Saw our comments crossed in flight — thanks for re-testing 7e581f1e409cf79 and confirming brcmfmac has no netpoll TX.

I just spotted a fourth, much stronger dcpext mechanism in dpm_suspend_late() that directly explains the hard hang on J615 (27.2 fw) vs J613 (26.6 fw):

  • In dpm_suspend_late() (only entered in pm_test=platform with mem_sleep=deep), apple_pmp_suspend_late() calls apple_pmp_report_sleep(2d0100000.pmp, at_commit=true), which withdraws every known PMP request not in commit_owned — on J615 (27.2 fw), that withdraws pmp_report_dispext (bit 8) while 31ac00000.dcp (dcpext) is still live, and before dpm_suspend_noirq() runs apple_dart_sys_suspend_noirq() / apple_dart_sys_resume_noirq() MMIO accesses on the unlocked 31930c000.iommu (dcpext_dart) and 319304000.iommu (dispext0_dart) (plus genpd attempting to power off ps_dispext_cpu).
  • On J613 (26.6 fw), dcpext, pmp_report_dispext, dcpext_dart, and dispext0_dart are all disabled (and internal dcp_dart/disp0_dart are locked so apple-dart never touches their MMIO).

Since 7e581f1e409cf79 is already built, could you test apple_t8122_display.dcpext=0 first on pm_test=platform?

  • If pm_test=platform passes with apple_t8122_display.dcpext=0, that confirms the dcpext / pmp_report_dispext / dcpext_dart path in one shot (no VDM recovery needed!).
  • If it still hangs with apple_t8122_display.dcpext=0, then testing apple_t8122_display.dcpext=0 pcie_aspm=off thunderbolt_apple.s2idle_teardown=1 together will split the remaining two suspects (port00 supports-clkreq vs live USB4 XDomain) in one boot.

@RyanTheTide

Copy link
Copy Markdown
Contributor

7e581f1e409cf79 J615 (M3 Air 15", T8122, macOS 27.2 fw) 4-leg pm_test=platform isolation (100% isolated to live USB4 XDomain b01ac0000.cio when thunderbolt_apple.s2idle_teardown=0; all boots apple_sleep.deep=1 initcall_debug no_console_suspend, pm_async=0, pm_print_times=1, mem_sleep=deep, #3140 t8122-j615.dtb via one-shot aura-try):

  • Leg A (apple_t8122_display.dcpext=0 alone, default ASPM, s2idle_teardown=0, boot_id=6f294bc4): pm_test=platform HANGS HARD (VDM-recovered via m1pro Left Back). Rules out dcpext as the sole cause.
  • Leg B (apple_t8122_display.dcpext=0 pcie_aspm=off + s2idle_teardown=1, boot_id=8abbaa66): pm_test=platform PASS (rc=0, 6456 ms).
  • Leg C (apple_t8122_display.dcpext=0 + s2idle_teardown=1, default PCIe ASPM, boot_id=1f010474): pm_test=platform PASS (rc=0, 6521 ms). Eliminates pcie_aspm.
  • Leg D (thunderbolt_apple.s2idle_teardown=1 ALONE — default 27.2 dcpext ENABLED with both 28ec00000.dcp and 31ac00000.dcp active + requests 0x21800 + default PCIe ASPM, boot_id=fb2affa4):
    • pm_test=platform: PASS (rc=0, 6543 ms, 319304000.iommu / 31930c000.iommu / 31ac00000.dcp / b01ac0000.cio all resumed cleanly)
    • pm_test=processors: PASS (rc=0, 6408 ms)
    • pm_test=core: PASS (rc=0, 6331 ms)
    • Phase 1 dry-run (pm_test=none, untested_commit=N): PASS (rtcwake: write error, 1387 ms, PM: resume of devices complete after 77.490 msecs, b01ac0000.cio: restarting port after system sleep, no hang).
  • Restore: J615 verified back on saved 7.3.0-aurora-fleet85 (b054aed6, stage2.bin untouched dd01f13c, RESTORED_DTB_CLEAN=1, Enforcing, failed=0, next_entry empty).

T8122 (M3) advertises "apple,t8122-usb4-acio", "apple,t8103-usb4-acio" in
device tree, but had no match entry of its own in apple_acio_match[] and
fell back to apple_cio_t8103_hw.

Unlike T8103, T8122 deep sleep removes the CIO power domains and shares
the ATC PHY with DWC3. Leaving a live USB4 router (such as a host-to-host
XDomain) powered through noirq suspend with mem_sleep=deep hung the system
in pm_test=platform before sleep entry on J615, while tearing the port down
in PM_SUSPEND_PREPARE allowed platform, processors, core, and Phase 1
dry-run suspend/resume to complete cleanly.

Add apple_cio_t8122_hw with sleep_removes_domains, restart_on_wake, and
phy_shared_with_dwc3 alongside apple_dpin_m1, matching the T8142 flag
design: mem_sleep=deep + mem tears down a connected router ahead of DWC3's
PM notifier and requests fresh cable state immediately on wake, while
default s2idle and freeze leave the port up unchanged.

Extend tools/asahi/pciec-policy-tests.py to cover T8122 ACIO matching,
deep-sleep vs s2idle/freeze gating, DWC3 notifier ordering, and negative
controls.

Signed-off-by: Satya Benson <[email protected]>
@satchlj

satchlj commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

@RyanTheTide Huge thanks for that 4-leg pm_test=platform matrix — isolating it cleanly to b01ac0000.cio with s2idle_teardown=0 while confirming default 27.2 dcpext and PCIe ASPM both pass Phase 1 dry run nailed the exact missing piece.

Pushed 12900893333d50d (thunderbolt: apple: tear down T8122 ACIO routers for deep sleep):

  • Adds apple_cio_t8122_hw (.sleep_removes_domains = true, .restart_on_wake = true, .phy_shared_with_dwc3 = true, .dp = &apple_dpin_m1) and "apple,t8122-usb4-acio" to apple_acio_match[] in drivers/thunderbolt/apple.c (previously T8122 fell back to apple_cio_t8103_hw).
  • mem_sleep=deep + mem now tears down connected routers in PM_SUSPEND_PREPARE ahead of DWC3's PM notifier and requests fresh cable state immediately on wake, while default s2idle and freeze keep the port up unchanged.
  • Extends tools/asahi/pciec-policy-tests.py with T8122 ACIO matching, deep vs s2idle/freeze gating, DWC3 notifier ordering, and 3 negative controls.

Verified at exact head 12900893333d50d:

  • J613 (25G83 fw): d1 Phase 1 dry-run PASS (nvme_io=OK) + 3/3 consecutive real deep S2R cycles PASS (boot object resumes 0 -> 1 -> 2 -> 3, wake source: NUB.SPMI0.SW3 x3, ANS: on 414/413/401 ms, nvme_io=OK).
  • Host tests (pciec-policy-tests.py, tb-cio-sleep-tests.py, apple-router-sleep-tests.py) and arm64 KUnit (thunderbolt 73/73 + apple-dpin-lifecycle 36/36) all PASS.

Ready for a J615 Phase 1 dry-run re-test at 12900893333d50d with default cmdline (s2idle_teardown=0, default 27.2 dcpext, default PCIe ASPM, and live USB4 XDomain connected).

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) labels Nov 25, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

12900893333d50d J615 (M3 Air 15", T8122, macOS 27.2 fw, exact head 7.3.0-aurora-pr3140v4+ + #3140 t8122-j615.dtb via one-shot aura-try, boot_id=60fc1ee1, apple_sleep.deep=1, default tb_s2idle_teardown=N, default 27.2 dcpext enabled with 28ec00000.dcp + 31ac00000.dcp active, default PCIe ASPM, live USB4 XDomain 0-1 connected):

  • Phase 1 dry-run (untested_commit=N, mem_sleep=deep, rtcwake -d rtc0 -m mem -s 15) — PASS:
    • b01ac0000.cio automatically tore down the live USB4 XDomain at PM_SUSPEND_PREPARE (powering off port for system sleep (cable info 0x3), thunderbolt 0-1: host disconnected) without any s2idle_teardown param.
    • nvme-apple saved context (654 ms), apple-sleep reached dry run: every check passed; refusing before the first stop and the commit, and resumed devices in 0.076 s.
    • Post-Phase-1 health: b01ac0000.cio restarted cleanly (T6050 sleep: the dock is back after the port's restart (0 more restart(s)), tb_devs_post_p1=0-0 0-0:1.1 0-1 0-1.0 domain0), NVME_IO=OK (8 MiB dd+fsync), Wi-Fi ping 3/3 (0% loss, 3.530 ms), Enforcing, failed=0.
  • Phase 2 (untested_commit=Y, rtcwake -d rtc0 -m mem -s 15) — DID NOT WAKE:
    • Note from Phase 1 dry-run log: apple-sleep reported dry run: the display coprocessor is left running; a sleep that commits stops it cold, until a reboot, pmp isn't bound, gpu isn't bound, going ahead with 2 problems (so it proceeded to commit rather than refusing on J615's 27.2 fw / saved stage2.bin dd01f13c) and did not wake on rtc0.
  • Recovery & restore: Recovered cleanly via m1pro Left Back VDM (Target acknowledged VDM (reply header 0x05ac8052)), verified J615 restored to saved 7.3.0-aurora-fleet85 (8c084130, stage2.bin untouched dd01f13c, RESTORED_DTB_CLEAN=1, Enforcing, failed=0, next_entry empty).

@satchlj

satchlj commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

@RyanTheTide Awesome — thank you for running that default-cmdline verification at 12900893333d50d on J615!

Really glad to see Phase 1 dry run pass cleanly with default tb_s2idle_teardown=N, live USB4 XDomain 0-1 tearing down automatically at PM_SUSPEND_PREPARE and coming back on the first restart (0 more restart(s)), and NVME_IO=OK / Wi-Fi 3/3 / failed=0.

And the Phase 2 result on macOS 27.2 fw lines up with what's still out of scope for this PR: dcp_sleep_owned() currently only covers DCP_FIRMWARE_V_26_6 (not DCP_FIRMWARE_V_27_0), and t8122_sleep_display_off() / t8122_gate_coprocs[] don't yet handle the external 31ac00000.dcp (DISPEXT_CPU/FE/SYS) that 27.2 boots fresh. That's a clean follow-up once this PR lands.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Audited all 13 signed-off commits and full 19-file diff at 1290089: clean T8122 (M3) deep-sleep integration across AOP (splitting HW_CFG_T6030 from HW_CFG_T8122), PMP SRAM backup, two-cluster retained MCC, ANS warm-sleep with dry-run skip and cold-reset SART replay fallback, PCIe conventional host domain hold across noirq suspend, T8122 ACIO router teardown ahead of DWC3 on deep sleep while preserving s2idle/freeze, 26.6 internal DCP power-down callbacks and cold-stop, and T8122 sleep core (opt-in untested flag preserving default s2idle, latched dry_run, wake_required validation, HID4/EHID4 cache-clean sequence, and cntvct_el0 HPM wait). Verified 26/26 CI checks green alongside J613 3/3 real deep S2R PASS and J615 default-cmdline Phase-1 dry-run PASS.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Nov 25, 2026
@DjDeveloperr
DjDeveloperr merged commit 7c9d9ad into main Nov 25, 2026
30 of 32 checks passed
@RyanTheTide
RyanTheTide deleted the soc-apple/t8122-s2r branch November 27, 2026 13:21
satchlj added a commit to satchlj/linux that referenced this pull request Nov 28, 2026
Merge aurora-silicon/linux main (f558935) and resolve semantic
conflicts:
- drivers/thunderbolt/apple.c: unify apple_cio_t8122_hw with the
  deep-sleep teardown fields from aurora-silicon#3140 and drop the duplicate match
  entry and duplicate pmgr-pwrstate.h include; pass the awake mode to
  apple_cio_stop() in TYPEC_THUNDERBOLT_SWITCH_SLEEP and
  apple_cio_shutdown(), and handle the switch default.
- drivers/pci/controller/pcie-apple.c: keep apple_t6030_msi_slice_valid()
  for the T8132/T8142/T8152 PCIe-C branch.
- tools/asahi/pciec-policy-tests.py: extend the T8122_SLEEP_FIXTURE
  apple_cio_hw stub and add apple_cio_power_down() to CIO_STOP_FIXTURE.
- Align the T8122 USB4 DT/binding files with aurora-silicon#3516 and drop the stale
  t8122-j613.dts thermal-zone duplication.

Signed-off-by: Satya Benson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants