Repository navigation
accel/ane: recover T6000 and T8112 engines after a hung job - #1651
Closed
RyanTheTide wants to merge 4 commits into
Closed
RyanTheTide wants to merge 4 commits into
RyanTheTide wants to merge 4 commits into
Conversation
T8112 exposes the ANE_SYS_CPU power-state reset to stop and cold-boot a coprocessor that does not reach STOPPED after RUN is cleared. Describe that reset and require it for this compatible. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Connect the ANE consumer to the ANE_SYS_CPU power-state reset so the driver can force-stop a hung firmware CPU before a verified power cycle. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
When an unplanned H14 CALL hang leaves CPU_STATUS running after RUN is cleared, assert the optional CPU power-state reset instead of abandoning recovery. Keep that state across failed transactions. Release reset only after every ANE domain is proven off. Cold-boot the firmware when power returns. Planned shutdowns retain their POWER_DOWN, WFI and STOPPED proof and never use the forced path. The run-time parameter can select the former behavior. KUnit covers forced success, reset failure, planned exclusion and the disabled path. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
linux#1446 kept a T600x engine wedged until reboot once a job hung without a completion event, because every job after the recovery hung the same way. The task-manager file was thought to survive the power cycle. It does not: after the cycle it reads its reset values (nothing committed, no valid descriptor slot, TM_STATUS idle). The retained-state drain then cleared TQ_EN bit 13 along with the enable bit. That bit reads set after every power-on, and without it the TM never dispatches: the next descriptor stays pending in its queue while TM_STATUS reads idle, so that job timed out too. Clear only the enable bit (12) in the drain; the re-arm sets it again. Before the power cycle, abort the hung queue in the task manager while the engine is still powered: write the queue number with START to the abort register, wait for START to clear, then for the queue to report hardware idle with no descriptor pending, and only then invalidate both descriptor slots, clear the ownership word and restore the queue priority. Every poll reads the DART latch before the engine. A task stalled below the task manager never lets the abort be taken; the power cycle stops it then. The tm_abort parameter (default on) turns the abort off. A hang without an event is recoverable again on T600x. The engine is wedged until reboot only after three recoveries in a row without one completed job. T8103 keeps its single recovery. The drain also cleared only the first descriptor slot, and cleared the ownership word before it. Clear both slots, then the ownership word, as the normal completion path does. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
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.
A job that hangs on the Neural Engine of an M1 Pro/Max (T6000) or M2 (T8112) no longer needs a reboot. The driver recovers the engine and the next job runs.
T6000 (ane.ko, direct task manager)
#1446 kept the engine wedged after a hang without a completion event, because every job after the recovery hung the same way. The task-manager file does not survive the recovery power cycle; it comes back at its reset values. The retained-state drain then cleared TQ_EN bit 13 together with the enable bit. Without bit 13 the task manager never dispatches: the next descriptor sits pending in its queue while TM_STATUS reads idle. The drain now clears only the enable bit.
Before the power cycle the driver also tries the per-queue abort (START + queue number, then queue idle and pending count zero, then both descriptor slots and the ownership word are cleared). A task stalled below the task manager never lets it be taken, and the power cycle stops it instead. The drain now clears both descriptor slots before the ownership word. On T6000 the engine is wedged until reboot only after three recoveries in a row without a completed job.
tm_abort=0turns the abort off.T8112 (ane_t6021, firmware)
After a hung CALL, clearing RUN does not stop the ANE CPU (CPU_STATUS stays RUNNING|IDLE). An unplanned restart now holds the CPU in its ANE_SYS_CPU power-state reset, releases it only once every ANE domain reads off, and cold-boots the firmware. Planned restarts never take this path.
forced_asc_stop=0selects the old behaviour. The DT gainsresets = <&ps_ane_sys_cpu>on the T8112 ANE node, and the binding requires it there.Tests