Repository navigation
M4 Max (T6041): suspend-to-RAM findings (SMC MBSE slpw/susp, iBoot resume is disk hibernation) #791
AxxzyWasTaken
started this conversation in
M4
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Notes from trying suspend-to-RAM ("deep", not s2idle) on M4 Max (T6041, J616C) with aura's EL2 monitor and a PSCI SYSTEM_SUSPEND. It doesn't work yet, but these findings may save someone time. Firmware: 26.6.2 (25G83) stub / iBoot mBoot-18000.161.10.
1. The SMC must be told about sleep
drivers/power/reset/macsmc-reboot.calready lists SMC keyMBSEvaluesslpw(sleep warning) andsusp(suspend). macOS's AppleSMC writesMBSE='slpw'inhandleSystemPowerStateChange. A separate path writessusp(orlpemon another branch). Linux never sends either. Without them nothing wakes the machine from a deep suspend: not the RTC alarm, lid, power button or trackpad.2.
MBSE='susp'turns the machine off; iBoot resume = disk hibernationWith
slpw+suspsent from a syscore suspend hook (atomic SMC writes) just before SYSTEM_SUSPEND, the machine powers down and the RTC alarm brings it back, but as a cold boot through iBoot. iBoot's resume path (lib/hibernation) is disk hibernation, not DRAM retention:hibernate_is_resume()depends on a PMGR status bit and a byte read over SPMI from the PMU.hibernate_load_imagegets a wrapped key from the SEP (sep_client_get_hibernate_key), sets it on the boot NVMe and reads the image back.IOHibernateImageHeader(public in xnuIOHibernatePrivate.h) with HMAC-SHA384 checks keyed by hardware key lines (KEY_WARM_BOOT,KEY_IBOOT; engine at ADT/hibernatehmac-reg-base).So
susplooks like the hibernate/off branch, and reusing iBoot's resume for Linux isn't practical.3. XNU's sleep bits alone don't put the SoC to sleep
XNU's per-CPU sleep for system sleep sets
S3_5_C15_C6_2 |= 1 | 1<<63and does WFI; the SIQ/ACNTHV masking is only its offline path. Doing exactly that on the last CPU (other CPUs parked in WFE at EL2) gives a dark screen but no real sleep. Battery drain, measured with forced restarts:slpwonly (nosusp)Working theory: the SoC won't enter sleep while any core is still powered. macOS takes every core down first. Here the secondaries stayed up in their WFE park, and the iBoot boot core on this machine never power-gates at all (a separate open problem: it reads "active" in CPU_STS even in WFI, while every core started by aura gates normally).
4. Useful registers
spmi-chapelL1-b, readable via/sys/bus/nvmem/devices/spmi_nvmem0/nvmem):info-off2wake_source@0x281c; names:fw_off_wakeup,gcb_off_wakeup,gcb_wakeup,rtc_alarm_wakeup,auto_wakeup, …info-pm_setting@0x2001info-leg_scrpad@0xf800 (boot-stage at 0xf801)info-scrpad@0x8000info-has_slpsmc= 1pmgrhasap-wake-sources,check-ps-b4-sleepanddevice-check-ps-b4-sleep.PSCI CPU_ON/CPU_OFF itself does work (details in aurora-silicon/aura#33). Happy to share the test module (MBSE handshake from syscore) or the drain-measurement scripts if they're useful.
All reactions