Skip to content

dmaengine: apple-sio / pmdomain: apple: keep the SIO's domain up until a deep sleep's commit - #1961

Merged
RyanTheTide merged 4 commits into
aurora-silicon:integration/aurorafrom
IronsideXXVI:j604-sio-hold-sleep
Nov 21, 2026
Merged

RyanTheTide merged 4 commits into
aurora-silicon:integration/aurorafrom
IronsideXXVI:j604-sio-hold-sleep

Conversation

@IronsideXXVI

@IronsideXXVI IronsideXXVI commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

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 no GENPD_FLAG_ACTIVE_WAKEUP and 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_path in sio_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 gets GENPD_FLAG_ACTIVE_WAKEUP only when its node has apple,sleep-wakeup-path; every other domain keeps the flags it had. Without this the first commit is not enough: measured under pm_test=core, sio_cpu still 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 on ps_sio_cpu in t8132-pmgr.dtsi. The J713 disables sio_cpu.

Measured on the J604:

  • pm_test=core (devices + noirq + syscore, no sleep): the sio_cpu power word at syscore reads off with neither change and with the wakeup path alone, and on (0x0f0002ff) with both.
  • With both, emulated by a probe module on our 1.920 and then native in our 1.921 (genpd flags 0xa on 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; on sio_cpu both 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/aurora 5b596e6:

  • checkpatch --strict: 0 errors, 0 warnings, 0 checks on all four commits.
  • drivers/dma/apple-sio.o, drivers/pmdomain/apple/pmgr-pwrstate.o and t8132-j604.dtb build with W=1, no warnings.
  • KUnit 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 flags apple,sleep-wakeup-path on power-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)

@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.

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.dtsi that makes pmgr-pwrstate set GENPD_FLAG_ACTIVE_WAKEUP on 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.

@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

Thanks. I'll limit GENPD_FLAG_ACTIVE_WAKEUP to the SIO's domain with a boolean on its power-controller node in t8132.dtsi plus a binding entry, rebase onto current integration/aurora, and keep the first-wake cold reset linked here.

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]>
@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

Pushed 9af6f6f, rebased onto 5b596e6. The pmgr-pwrstate change is now three commits:

  • a binding entry for apple,sleep-wakeup-path, for a domain whose consumer is stopped by the sleep's commit after the noirq phase;
  • the driver sets GENPD_FLAG_ACTIVE_WAKEUP on a domain found off at probe only when its node has that property; every other domain keeps the flags it had;
  • the property on ps_sio_cpu, which lives in t8132-pmgr.dtsi (the J713 disables that node).

W=1 is clean for apple-sio.o, pmgr-pwrstate.o and the J604 DTB, checkpatch --strict is clean on all four commits, and KUnit apple-pmgr-pwrstate passes 18 of 18. The first-wake cold reset stays linked in the description. This version hasn't run on the J604 yet.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 1.

The narrowed version reads right. The flag now comes only from apple,sleep-wakeup-path on the domain node (drivers/pmdomain/apple/pmgr-pwrstate.c:953). The new branch at :1028-1034 can only be reached for a domain that is off at probe and neither always-on, firmware-owned nor inherited-on, so a domain that is on at probe keeps DEFER_OFF | ACTIVE_WAKEUP from :1027 as before. Only ps_sio_cpu in t8132-pmgr.dtsi carries the property, so no other domain or SoC changes. device_set_wakeup_path() in sio_suspend_late() (drivers/dma/apple-sio.c:2232) runs only on the commit-stop path and is cleared by the PM core at the next prepare. With the active-wakeup flag, genpd's noirq suspend skips the power-off for that device, so the domain and its parents stay up until the commit.

  1. All four commits (b5e9151, a287d97, 453a472, 9af6f6f) carry an Assisted-by: LLM trailer. Please drop it from the commit messages and keep only the Signed-off-by; agent help goes on the PR body's last line as Assisted-by: LLM (<Vendor>:<Model>), which the body doesn't have yet.

Nit: please add a make dt_binding_check DT_SCHEMA_FILES=apple,pmgr-pwrstate.yaml / dtbs_check result for t8132-j604.dtb to the test list. The build and checkpatch results don't cover the new property in the schema.

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 sio_cpu read 0xa in /sys/kernel/debug/pm_genpd/ and the power word is on at syscore under pm_test=core; 3 RTC-alarm deep sleeps on one boot wake alive with no reset; then a J713 boot on the same kernel shows its suspend unchanged (the sio_cpu node disabled, no new genpd flags); 0 AVC, 0 failed units, 0 new kernel errors on both.

Assisted-by: LLM (Claude:Opus 5.5)

@IronsideXXVI

Copy link
Copy Markdown
Contributor Author
  1. The trailers are gone from all four commits (now 0a055bd, c914e87, cc013c0, bcb174a, same trees), and the description ends with the Assisted-by line. I've left the vendor/model part off for now and will come back on that separately.

The dt checks are in the test list now, on 5b596e6 with dtschema 2026.9:

  • make dt_binding_check DT_SCHEMA_FILES=apple,pmgr-pwrstate.yaml: nothing reported for the binding. It has no example, so that run only checks the schema itself.
  • make CHECK_DTBS=y DT_SCHEMA_FILES=apple,pmgr-pwrstate.yaml apple/t8132-j604.dtb: no warnings.

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 'apple,sleep-wakeup-path' does not match any of the regexes on power-controller@268, and with = <1> in the dtsi it reports 1 is not of type 'boolean'.

The J604 half of the HW row is queued on this head: the genpd flags on sio_cpu, the power word at syscore under pm_test=core, three RTC-alarm deep sleeps on one boot, and the AVC, failed-unit and kernel-error counts. I'll post it here. I don't have a J713, so the boot that shows its suspend unchanged needs someone who does.

@RyanTheTide
RyanTheTide merged commit 739c670 into aurora-silicon:integration/aurora Nov 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants