Repository navigation
accel/ane: restart T8112 firmware only after a real power cycle on resume - #1680
Merged
Merged
Conversation
…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
marked this pull request as ready for review
November 12, 2026 12:23
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 showsboot: sequence error -110 AFTER CPU startandplatform_pm_resume returns -110. After that every s2idle aborts withplatform_pm_suspend returns -112until 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:
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.Tests:
pm_test=devicess2idle givessequence error -110,wedged1, and 2 out of 2 later s2idles abort with -112.pm_test=devicesaborts), 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,wedgedstayed 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.🤖 Generated with Claude Code