Repository navigation
soc: apple: suspend-to-RAM on M3 (T8122, J613/J615) - #3140
Conversation
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]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
|
…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]>
|
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
Exact-head J613 (25G83) verification at
Ready for a J615 Phase 1 dry-run re-test at |
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]>
|
|
|
Thanks @RyanTheTide — that Auditing every
Before we push a speculative fix, could you run a quick isolation pass on
Once we know which of those triggers the hang, I'll fold that fix together with the |
|
|
|
Saw our comments crossed in flight — thanks for re-testing I just spotted a fourth, much stronger
Since
|
|
|
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]>
|
@RyanTheTide Huge thanks for that 4-leg Pushed
Verified at exact head
Ready for a J615 Phase 1 dry-run re-test at |
|
|
|
@RyanTheTide Awesome — thank you for running that default-cmdline verification at Really glad to see Phase 1 dry run pass cleanly with default And the Phase 2 result on macOS 27.2 fw lines up with what's still out of scope for this PR: |
DjDeveloperr
left a comment
There was a problem hiding this comment.
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.
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]>
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 DTapple,sram-keepoverride), 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 firmwaresuspend_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/EHID4cache clean, APCIE power-down/restore,CYC_OVRD, wake mask), DT bindings, and sharedt8122.dtsi/t8122-j613-j615.dtsinodes (includingsep@29e400000power domains for commit-time SEP sleep staging). Zero board-specific gating so J613 and J615 share the same path.Tested:
12900893333d50d: PASS —d1dry-run + 3/3 consecutive realdeepS2R cycles withpcie-apple 580000000.pcieprobed live (Link upon/soc/pcie@580000000/pci@0,0, unmodified compiledt8122-j613-25g83.dtb,wdt=0,alarm=15, zero sleep dev cmdline params):d1dry-run hard gate PASS (d1-20261125T132948Z):580000000.pcieprobed live and held intact acrosssuspend_noirq,apple-mcc2 planes enabled,apple_pmpbound,dry run: every check passed,nvme-appletook the clean cold shutdown + cold PMGR reset path (nvme_io=OK), zero SErrors/panics.deepS2R cycles PASS (e-20261125T133223Z,j613.cycles=3,apple-pmu-rtcrtc0wakealarm,580000000.pcieprobed live):boot object resumes 0 -> 1 -> 2 -> 3,wake source: NUB.SPMI0.SW3x3,ANS: on 414/413/401 ms after the run bitwithnvme_io=OK, cleanapple_pmpwake (zero-62), clean 2-planeapple-mccwake,29e400000.sepbound,156 of 224 AP pinsrestored on every wake, zero SErrors/warnings/panics.12900893333d50d:LLVM=1C + Rust (asahi.config/ trial config withCONFIG_USB4_APPLE_SOC=y) build ofdrivers/thunderbolt/apple.o(W=1),Image,t8122-j613-25g83.dtb, andt8122-j615.dtb: 0 errors, 0 new warnings.tools/asahi/pciec-policy-tests.py: PASS (including T8122 ACIO matching, deep-sleep vss2idle/freezegating, DWC3 PM notifier order, and negative controlst8122-drop-match,t8122-drop-sleep-removes-domains,t8122-drop-phy-shared).tools/asahi/tb-cio-sleep-tests.py(41 cases + 27 negative controls) andtools/asahi/apple-router-sleep-tests.py(84 cases + 9 negative controls): PASS.drivers/thunderbolt/.kunitconfig.apple-dpin):thunderbolt(73/73),apple-dpin-lifecycle(36/36),apple_mbox_g17_stall(3/3, 1 skipped) — 112/112 passed.7e581f1e409cf79(unchanged files):dt_binding_check/CHECK_DTBS=yont8122-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 KUnitapple-sleep-soc-data(16/16),dcp-fabric(117/117),dcp-topology(202/202).Risk: two-way ·
t8122_sleep_sockeeps.untested = true(matchingt8142_sleep_soc), so defaults2idlebehavior is unchanged and realdeepsleep 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/freezepreserved), 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
12900893333d50dand 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):soc: apple: aop: add T8122 sleep endpointssoc: apple: pmp: add T8122 SRAM backup configsoc: apple: mcc: support T8122 two-cluster SLC write-back for deep sleepnvme: apple: support T8122 ANS warm sleep and restartdrm/apple: iomfb 26.6: answer power-down callbacks(matches drm/apple: iomfb 26.6: answer the display power-down callbacks #2558'siomfb_v26_6.chunk verbatim for conflict-free coordination)dt-bindings: soc: apple: sleep: add apple,t8122-sleepsoc: apple: sleep: add T8122 deep sleep and resumedrm/apple: iomfb 26.6: cold-stop DCP for firmware-driven sleeparm64: dts: apple: t8122: describe sleep controller and two-cluster MCC(also wiressep@29e400000power-domains = <&ps_sep>, <&ps_gpio>;for commit-time SEP sleep staging)nvme: apple: skip T8122 warm sleep on dry runs and fall back on refused sleepsPCI: apple: hold conventional host domains across noirq suspend for firmware sleepMerge branch 'main' into soc-apple/t8122-s2r(keeps T6030/T6031 onHW_CFG_T6030separate fromHW_CFG_T8122)thunderbolt: apple: tear down T8122 ACIO routers for deep sleepSupersedes draft PRs #2572 and #2746.