Skip to content

accel/ane: restart T8112 firmware only after a real power cycle on resume - #1680

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
fix/ane-t8112-sleep-abort
Nov 12, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
fix/ane-t8112-sleep-abort

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

ane_t6021 stops the T8112 (M2) ANE firmware in system suspend and cold-boots it in resume. It relied on genpd having powered the ANE domains off in between. That doesn't happen when a suspend aborts during the device phase (a wake event, or pm_test=devices), and resume still runs. The firmware then boots on a CPU that was only halted, the handshake times out, and the log shows boot: sequence error -110 AFTER CPU start and platform_pm_resume returns -110. After that every s2idle aborts with platform_pm_suspend returns -112 until reboot, because both sleep callbacks return -EHOSTDOWN in any state other than ACTIVE.

This doesn't depend on how many cycles have run. In the logs where we hit it, the failure always lined up with the one suspend that aborted, and no ANE job had run in that boot.

Changes:

  • Count ane_sys_cpu power-offs in the existing power-domains[0] genpd notifier. Every legacy-restart SoC now registers it; only T8112 also drives the power gate.
  • Suspend records the count once the ASC is proven stopped. If resume sees the same count, the CPU domain never went off, so the device stays SUSPENDED and the boot is deferred. A freezable work item, or the next client if it gets there first, power-cycles the domains through runtime PM, checks they are off, and then boots.
  • Suspending a device that is still SUSPENDED is a no-op that succeeds.
  • A FAILED device stays unavailable (wedged = 1, submissions refused), but it no longer blocks sleep. Suspend clears RUN and requires STOPPED (or finds the CPU unpowered). Only if that can't be proven is that single suspend refused. Resume of a FAILED device returns 0.
  • ane-h14-sleep KUnit: added cases for deferred restarts, sleeping while a restart is pending, a failed deferred restart, and a failed park. The suite no longer expects one failure to refuse every later sleep.

Tests:

  • KUnit (arm64 QEMU, ANE + PM + firmware suites): 267 passed, 1 skipped (needs UCLAMP_TASK). ane-h14-sleep 7/7.
  • run-host-tests: 287/287. checkpatch --strict: clean.
  • M2 (J413), production fleet67 without the fix: one pm_test=devices s2idle gives sequence error -110, wedged 1, and 2 out of 2 later s2idles abort with -112.
  • M2, the same fleet67 base with this commit (one-shot kernel, Enforcing): 32 cycles (24 rtc1 s2idle, 8 pm_test=devices aborts), then 2 aborts back to back and one more s2idle. ANE jobs (single conv and a 28-task MobileNet) ran every third cycle and straight after aborts. All 25 s2idles returned 0. All 10 aborts deferred the restart and the firmware came back after a runtime power cycle. No sequence errors, no -112, wedged stayed 0. Accuracy was unchanged (relL2 9.5e-5; MobileNet top-5 equal to the reference) and the single-conv p50 went from 125 to 123 us. 0 AVC, 0 DART faults.
  • A deliberately hung job still refuses sleep: the ASC never reports STOPPED (CPU_STATUS 0x2d), so its power is left on. That matches the behaviour before this change.

🤖 Generated with Claude Code

…sume

ane_t6021 stops the ANE firmware in its system suspend callback
(POWER_DOWN, WFI, ASC STOPPED) and cold-boots it again in resume, trusting
genpd to have powered the ANE domains off in between. When a suspend
aborts after the device phase started (a wake event before the noirq
phase, or pm_test=devices), genpd never powers the domains off, but
resume still runs. The firmware is then booted on a CPU that was only
halted, the boot handshake times out (-110) and the driver holds the
half-started instance.

From then on the device sits in the FAILED state, and both system sleep
callbacks return -EHOSTDOWN in any state other than ACTIVE, so every later
suspend aborts with -112 until reboot.

Count the power-offs of ane_sys_cpu (power-domains[0]) in its genpd
notifier, which T8112 already registers for the power gate and which every
legacy-restart SoC now gets. Suspend records the count once the ASC is
proven stopped. If resume finds it unchanged, the CPU domain never went
off: the firmware stays stopped, the device stays SUSPENDED and a freezable
work item (or the next client, whichever comes first) power-cycles the
domains through runtime PM, verifies them off and boots. This is the same
rule the vendor driver follows: the firmware cold-starts only after the CPU
power state reads back off.

A failure must not block system sleep either. A second suspend of a device
that is still SUSPENDED has nothing to stop and succeeds. A FAILED device
stays unavailable (wedged=1, submissions refused) but its suspend only
makes sure the CPU may lose power: clear RUN and require STOPPED, or find
it unpowered. Only if that cannot be proven is the one suspend refused.
Resume of a FAILED device returns 0 instead of repeating the error.

The ane-h14-sleep KUnit suite covers deferred restarts, sleeps while a
restart is pending, failed deferred restarts and failed parks, and no
longer expects a failure to refuse later sleeps.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide marked this pull request as ready for review November 12, 2026 12:23
@RyanTheTide
RyanTheTide merged commit c977dab into integration/aurora Nov 12, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the fix/ane-t8112-sleep-abort branch November 12, 2026 12:23
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