Repository navigation
dmaengine: apple-sio / pmdomain: apple: keep the SIO's domain up until a deep sleep's commit - #1961
Conversation
DjDeveloperr
left a comment
There was a problem hiding this comment.
Thanks for the write-up and the pm_test=core measurements; they show clearly why both commits are needed on the J604.
The SIO commit is fine.
The pmgr-pwrstate commit is the problem, as you flagged yourself. It gives GENPD_FLAG_ACTIVE_WAKEUP to every non-firmware-owned domain on every Apple SoC this driver runs on. The PM core puts every wake-enabled device and its parents on the wakeup path, so any wake-enabled device under a domain that was off at probe would now hold that domain up through system sleep. On the Neo (T8140), the M5 machines and the J713, that's the deep-sleep path we ship. A domain left on there can raise sleep power or change what the commit sees, and none of those machines has been run with this.
To answer your question: yes, please limit it to the domain that needs it, selected from the device tree rather than by SoC. For example:
- a boolean on the SIO's power-controller node in
t8132.dtsithat makes pmgr-pwrstate setGENPD_FLAG_ACTIVE_WAKEUPon that domain; - a binding entry saying it's for a domain whose consumer is stopped by the sleep commit after the noirq phase.
That leaves every other chip exactly as it is, and the J713 question goes away with it.
Please also rebase. integration/aurora has moved a lot under this: apple-sio.c by +96/-13 since fc05050, and soc/apple/sleep.c by several thousand lines. CI should run against the current base.
The cold reset after the first wake on 1.922 doesn't have to be solved in this PR, but please keep it linked here.
|
Thanks. I'll limit |
With the stop deferred to the commit of a firmware-driven suspend, the SIO is still runtime-suspended when the noirq phase comes, so genpd powers its domain down. The commit then reads its ASC CPU control and polls its mailbox with nothing behind them: on T8132 both reads end in a synchronous external abort and an SError, and every deep sleep on the J604 stopped there, before the commit. Put it on the wakeup path when it hands its stop to the commit, as the display coprocessor does, so the domain (active-wakeup) stays up until the commit has stopped it. Signed-off-by: Dylan Ironside <[email protected]>
Some consumers are stopped by the system sleep's final commit, after the noirq phase, and stay on the wakeup path until then. On T8132 the SIO is one: its domain, sio_cpu, is off when the power controller probes and is powered up later by the SIO. Describe a boolean that marks such a domain, so the power controller keeps it on through system sleep while a device under it is on the wakeup path. No other domain changes. Signed-off-by: Dylan Ironside <[email protected]>
A domain found off when the PMGR driver probes gets no GENPD_FLAG_ACTIVE_WAKEUP, so genpd powers it off in the noirq phase of a system sleep even under a device on the wakeup path. On T8132 the SIO's domain, sio_cpu, is such a domain: with the SIO's stop handed to the sleep's commit and the SIO on the wakeup path, sio_cpu still went off before syscore (flags 0x2, power word target 0), and the commit then read a powered-down SIO. Give GENPD_FLAG_ACTIVE_WAKEUP to a domain off at probe only when its node has apple,sleep-wakeup-path. Every other domain, on every SoC this driver runs on, keeps the flags it had. With the flag, sio_cpu stays on through syscore (measured on the J604 under pm_test=core with the flag set at run time). Signed-off-by: Dylan Ironside <[email protected]>
… path The SIO stays on the wakeup path until the sleep's commit stops it, after the noirq phase, and its domain is off when the power controller probes. Mark sio_cpu with apple,sleep-wakeup-path so it stays on through system sleep until that stop. The J713 disables sio_cpu, so this acts only where the SIO runs. Signed-off-by: Dylan Ironside <[email protected]>
ad6ac3c to
9af6f6f
Compare
|
Pushed 9af6f6f, rebased onto 5b596e6. The pmgr-pwrstate change is now three commits:
W=1 is clean for |
|
Blockers: 1. The narrowed version reads right. The flag now comes only from
Nit: please add a HW row: J604 on the current integration/aurora build with exactly these four commits (the DT property, not the earlier version or a probe module): genpd flags on Assisted-by: LLM (Claude:Opus 5.5) |
9af6f6f to
bcb174a
Compare
The dt checks are in the test list now, on 5b596e6 with dtschema 2026.9:
To be sure the second one really looks at the new property I broke it both ways: with the property removed from the schema it reports The J604 half of the HW row is queued on this head: the genpd flags on |
739c670
into
aurora-silicon:integration/aurora
On the J604 (MacBook Pro 14" M4, T8132) the SIO hands its stop to the commit of a firmware-driven deep sleep. By then it is runtime-suspended, and its domain (
sio_cpu) was found off when the PMGR driver probed, so it has noGENPD_FLAG_ACTIVE_WAKEUPand genpd powers it off in the noirq phase. The commit then reads the SIO's ASC CPU control and polls its mailbox with nothing behind them: a synchronous external abort and an SError. Every deep sleep on the J604 stopped there.Four commits:
dmaengine: apple-sio: keep the domain up until the sleep's commit stop: when the SIO hands its stop to the commit, it puts itself on the wakeup path (device_set_wakeup_pathinsio_suspend_late), as the DCP does.dt-bindings: power: apple,pmgr-pwrstate: add apple,sleep-wakeup-path: a boolean for a domain whose consumer is stopped by the sleep's commit, after the noirq phase, and stays on the wakeup path until then.pmdomain: apple: pmgr-pwrstate: hold a marked domain for its wakeup path: a domain off at probe getsGENPD_FLAG_ACTIVE_WAKEUPonly when its node hasapple,sleep-wakeup-path; every other domain keeps the flags it had. Without this the first commit is not enough: measured underpm_test=core,sio_cpustill read off at syscore (genpd flags 0x2, power word target 0).arm64: dts: apple: t8132: hold sio_cpu while the SIO is on the wakeup path: the property onps_sio_cpuint8132-pmgr.dtsi. The J713 disablessio_cpu.Measured on the J604:
pm_test=core(devices + noirq + syscore, no sleep): thesio_cpupower word at syscore reads off with neither change and with the wakeup path alone, and on (0x0f0002ff) with both.sio_cpu), a deep sleep gets past the SIO stop, commits and wakes: the wake routine ran 89 s (1.920) and 81 s (1.921) after the entry, with the RTC alarm set at 90 s and the wake status bit on the RTC alarm's wake line. On 1.921 the first fault after the wake is no longer the SIO's: it is the DART of the Wi-Fi/Bluetooth PCIe port, whose port the commit had stopped (a separate series). On our 1.922, which also brings the J604's PCIe ports and their DARTs back after a wake (a separate series), the J604 did its first full deep sleep and wake: it slept, the SoC came back through its reset vector 90 s later on the RTC alarm, and the system resumed alive on the same boot with no reset, with the display, Wi-Fi, Bluetooth, audio and NVMe back and no failed units (measured 2026-11-15). Still open on our side and outside this series: the SD card reader across a sleep, and wake sources other than the RTC alarm.Scope: the flag is now limited to
sio_cpu, chosen in the device tree, so no other domain and no other SoC changes. The measured runs above had the earlier version, which set the flag on every domain found off at probe; onsio_cpuboth versions set the same flag. This version has not run on the J604 yet.Update, our 1.923: three deep sleeps in a row on one boot, the last for 10 minutes; each woke on the RTC alarm and came back alive with no reset (the USB-C host saw no cold reset), and after each wake the log has "apple-dart 490000000.iommu: restored after its host came back" and the same for 492000000, with no DART left gated (2026-11-15). A fourth sleep on the same boot, run with a test option of the DART driver changed, also came back alive with no reset.
Open item, honest state (updated 2026-11-15): on our 1.922, about 7 minutes after the first full wake (446 s), roughly 2 s after our test tooling began setting up a second cycle and before any second sleep, the resumed system cold-reset; the USB-C host watching it saw the reset and the Mac came back by itself. No panic text reached the disk. The same steps on a boot that had not slept did not reset, so something the wake left behind is involved. Two earlier guesses are ruled out: a protection on kernel text left armed by the wake (after that 1.922 wake the module reload wrote kernel text about 66 times and every write returned, and on our 1.923 a kprobe written into kernel text after four wakes on one boot did not reset it), and an execute bound on new module pages (module code had been running on the woken cores for minutes before the reset). On our 1.923 the tooling's steps of that minute, replayed one at a time on a resumed boot (a module load, a read of the PMU's nvmem, an SPMI read and the same PMU register write, the recorder's ioremaps, kprobes and kretprobes, and the exact module reload), all returned with no reset (2026-11-15). One clean replay does not prove it gone; we will call it gone after three clean replays on three resumed boots. Our guess, not proven: on 1.922 some blocks stayed unclocked after the wake and the recorder's init touched one of them, and three 1.923 changes to how the PCIe ports and DARTs come back after a wake would explain the difference; reverting them one at a time and replaying is the next test.
Also not proven yet: that the panel lights again when a key is pressed on the lock screen after a sleep that began with the panel already blanked by the lock screen.
For the J713 owners: have you seen a reset on a second suspend's setup after a first wake (for example a first access to a block the wake left unclocked, in the minutes after a resume), or anything left armed by the wake path that fires later?
Checked on top of
integration/aurora5b596e6:drivers/dma/apple-sio.o,drivers/pmdomain/apple/pmgr-pwrstate.oandt8132-j604.dtbbuild with W=1, no warnings.apple-pmgr-pwrstate(arm64, its.kunitconfig): 18 of 18 pass.make dt_binding_check DT_SCHEMA_FILES=apple,pmgr-pwrstate.yaml(dtschema 2026.9): no output for the binding. It has no example, so this checks the schema itself.make CHECK_DTBS=y DT_SCHEMA_FILES=apple,pmgr-pwrstate.yaml apple/t8132-j604.dtb: no warnings. With the property taken out of the schema the same run flagsapple,sleep-wakeup-pathonpower-controller@268, and with a value on it (= <1>) it flags the type, so the check does cover the new property.Tested on the J604 only: our linux-aurora 1.921, linux-aurora-next 1.922 and linux-aurora 1.923 carry the earlier version of both changes.
Assisted-by: LLM (Claude:Opus 5.5, Claude:Fable 5.2)