Skip to content

t8140-sleep: take the deep path when an SLP_DDR wake would stall (camera ran, AOP crashed) - #1358

Closed
DjDeveloperr wants to merge 7 commits into
feat/apple-soc-sleep-genericfrom
fix/t8140-slpddr-coproc-crash
Closed

DjDeveloperr wants to merge 7 commits into
feat/apple-soc-sleep-genericfrom
fix/t8140-slpddr-coproc-crash

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Stacked on #1310 (fix/t8140-debug-port-select). Two ways a sleep that keeps DRAM up (SLP_DDR) never came back on the Neo: the SoC reset 5 s after the alarm, inside the sleep engine's D->M wake, before aura or Linux ran. A deep sleep returns in both cases, so each now takes the deep path when it would stall.

After the camera ran. A capture since the last deep wake made the next SLP_DDR sleep stall 6 of 6 times: right after the capture, ~50 s after it, and whether the ISP firmware was stopped at the sleep or at the end of the stream. A failed camera start counts too. SLP_DDR wakes without camera use returned 70+ of 70+. The ISP's firmware start now clears the same flag the first deep wake sets, so the next sleep goes deep and SLP_DDR applies again from its wake. It costs one USB hub reset after a camera session.

After a coprocessor that runs through a sleep crashed. The AOP firmware sometimes crashes during a sleep (RTKit: Message to undiscovered endpoint 0x01, co-processor has crashed: crash log buffer ... not mapped). After one during a deep sleep, the next, DRAM-kept sleep stalled. SLP_DDR keeps DRAM up for the AOP, and nothing restarts it short of a reboot, so after such a crash every later sleep takes the deep path. RTKit now reports each firmware crash to the sleep controller. Coprocessors the controller stops and restarts around each sleep (DCP, ANS, GPU) are left alone.

Tested on the Neo (J700), #1310 + #1313 + this, stage2-14, production policy (first sleep deep), 30 s PMU RTC sleeps:

  • Camera start before sleeps 2, 4, 6 and 8, none before 3, 5, 7 and 9: 9 of 9 returned. The rule fired before 2 and 4 (both deep), and 3 and 5 kept DRAM. The starts before 6 and 8 failed without reaching the ISP, see below, so 6 to 9 all kept DRAM and returned.
  • The crash rule fired on hardware: an AOP crash during sleep 1 logged 310c00000.aop crashed: later sleeps take the deep path, and sleeps 2 and 3 went deep and returned.
  • Without either rule, the same kernel: camera then SLP_DDR stalled 3 of 3, and the AOP crash then SLP_DDR stalled 1 of 1.

Not fixed here:

  • The first sleep of a boot still has to go deep: a forced first SLP_DDR sleep still stalls, ISP off or not.
  • The camera fails to start again (STREAMON ... Timer expired, then -EIO until reboot) after a capture, a deep sleep and a DRAM-kept sleep.
  • The AOP crash itself.
  • Stage2-15 (aura main + iMac · M3 family #117 + Moved · J414C · MacBook Pro 14-inch (M2 Max / T6021) #112's rewrite) stalled 2 of 2 SLP_DDR wakes on the same kernel, which returned 5 of 5 on stage2-14. Those two kits' first cycles also ran the camera, so this may be the same trigger: re-test before blaming aura.

🤖 Generated with Claude Code

…ugh sleep crashed

The AOP keeps running through a sleep, and SLP_DDR is the state that
keeps DRAM up for it. After its firmware crashed during a deep sleep,
the next sleep, which kept DRAM up, never came back: the SoC reset 5 s
after the alarm, inside the sleep engine's own wake, before any core
ran. The deep path doesn't need the AOP and returns.

Nothing restarts a crashed AOP short of a reboot, so from its crash on
the sleep DDR word stays clear and every sleep takes the deep path.
RTKit now reports every firmware crash to the sleep controller. One it
stops and restarts around each sleep doesn't run through it and is left
alone.

Signed-off-by: Diljit Singh <hey@djdev.me>
… the camera ran

After a camera capture, the next sleep that kept DRAM up (SLP_DDR) never
came back: the SoC reset 5 s after the alarm, inside the sleep engine's
own wake, before any core ran. It did so 6 of 6 times, with the capture
seconds or about 50 s before the sleep, and whether the ISP firmware was
stopped at the sleep or long before it. Without a capture, SLP_DDR wakes
returned 70 of 70 on the same kits. A deep sleep rebuilds whatever the
ISP leaves, as it does the state a boot leaves, and every SLP_DDR sleep
after it returns.

So the ISP's firmware start clears the same flag the first deep wake
sets: the next sleep goes deep, and SLP_DDR applies again from its wake.
It costs one USB hub reset after a camera session.

Signed-off-by: Diljit Singh <hey@djdev.me>
…roc-crash

Moves the deep-path rules onto the generic sleep driver, with the stack
below it and integration/aurora 15f88e1. The three conflicts in sleep.c
take this branch's code as written; the next commit moves it to the new
names. RTKit's crash report also lands in integration's new crash path.

Signed-off-by: Diljit Singh <hey@djdev.me>
The rules that send a sleep deep after a coprocessor crash or a camera
start were written against t8140-sleep.c. Move them to the renamed
driver's names: apple_sleep, apple_sleep_coproc_find(), and the
sleep_slp_ddr_* state and lock.

No functional change against the rules on the old driver.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr
DjDeveloperr changed the base branch from fix/t8140-debug-port-select to feat/apple-soc-sleep-generic November 9, 2026 18:17
…roc-crash

Brings in #1208's aop-bootargs host test fix. No conflicts.

Signed-off-by: Diljit Singh <hey@djdev.me>
…roc-crash

Brings in integration/aurora ac11649 (#1311, PCIe multi power domain
support) through #1208. No conflicts.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Superseded by #1445 (merged as 2b05915); its changes are in integration/aurora. apple_sleep_coproc_crashed() still sends later sleeps deep after a coprocessor crash. The ISP rule was replaced by #1393's DART restore.

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.

1 participant