Skip to content

accel/ane: H13 recovery without reboot (H13 part of #692, on aurora-wip) - #717

Merged
RyanTheTide merged 7 commits into
aurora-wipfrom
ane/h13-recovery
Oct 31, 2026
Merged

RyanTheTide merged 7 commits into
aurora-wipfrom
ane/h13-recovery

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

H13 (M1, M1 Pro/Max) ANE recovery from a timed-out or failed task without a reboot, on top of aurora-wip.

This is the H13 part of #692, rebased onto aurora-wip after #684 landed, plus the fix that made it work on silicon. The H14 firmware restart (71fa8e9) stays on #692 because it conflicts with the H16 platform code that's in aurora-wip now, and it hasn't run on an M2 yet.

What it does: on a job timeout the driver suspends the engine through runtime PM, checks every attached power domain went off (SYS_CPU included), powers back up, drains the task-manager state that T600x keeps in retention, re-arms the TM and checks it's idle. The failed submit gets its error and the device keeps working. If any step fails it stays wedged as before, no loop.

Conflicts with #684 resolved by releasing the performance request (ane_perf_suspend) before the power cycle, as aurora-wip's recovery did.

Tested on the M1 Pro (T6000), 7.3.0-aurora-fleet12e-ane692 (fleet12e plus the same commits). The deterministic reproducer (a program that times out on its first submit, -110, finish lines=0) gave -EIO, then tm recovered: idle, wedged 0, and a bit-exact smoke 20/20, five rounds in a row with no reboot. Details in #692 (comment).

KUnit, x86_64 and arm64 (LLVM): ane-pm-recovery 6/6, apple-pmp-ane 4/4, ane-submit, ane-fw-platform and the rest pass. ane-h16-hwx fails 3 subtests (forms, tensor, snapshot), and it fails the same way on aurora-wip without this branch, so it's not from here.

Not tested: T8103 (M1). M1 Pro check of this exact branch on aurora-wip is next.

🤖 Generated with Claude Code

Suspend the ANE consumer before its domain suppliers, verify the engine islands actually power off, and restore its runtime PM reference on every exit. Avoid the system-sleep force helpers and speculative retained task-error writes. Keep DMA backing and the exceptional module pin until recovery is verified.

Use one deadline across H13 fault drains and H14 command ACK/finish waits. Add an explicit destructive H13 recovery test and a deterministic fixture generator using the licensed public compiler. Document the remaining H14 firmware ownership and stale-ID work; H14 reset remains quarantined.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Share the runtime-PM cycle independently of task-manager MMIO and test it against real runtime-PM supplier links. Cover repeated and single-domain cycles, consumer and supplier suspend errors, a missing off acknowledgment and resume failure, including restoration of the caller reference.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The packaged tools contain a static libane, so a ctypes test cannot rely
on a system shared library. Use the documented ABI 1 buffer and submit
ioctls directly. Keep both fds, GEM handles and mappings alive across all
three resets, pin both public fixture hashes, and provide device-free
container validation before the destructive run.

Also depend on DRM_ACCEL for traversal of the PM KUnit test directory.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Exercise the malformed convolution with fp16 one inputs so the test
requests MAC work rather than relying on an all-zero activation path.
The input and weight bytes are deterministic; only the add fixture is
used as a numerical oracle.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The SET window covers the engine islands but not their SYS_CPU parent.
DART suppliers suspend asynchronously after the ANE consumer drops its
references. Require every attached genpd, including SYS_CPU, to report
off before resuming the consumer; otherwise that resume can race the
DART idle work and keep the task-manager register file powered.

Use only the genpd provider API and always-accessible PMGR reads. A
shared domain that cannot turn off leaves recovery failed and preserves
the DMA safety pin.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Change the add inputs for each call and poison its 64 logical output
lanes before submitting. Zero the unused padding, which need not be
written by the engine. Comparing the complete tile with the oracle now
rejects a stale completion even when the previous call was correct.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Recovery refused to restart whenever TQ_EN bit 13 was set after the
partition power cycle, reading it as "task manager still halted". On
the M1 Pro that bit is set on every healthy runtime resume as well:
TQ_EN reads 0x3000 and TM_ERROR1 0x22222222 each time the engine comes
back from autosuspend. So the check failed every recovery and left the
engine wedged until reboot. Drop it.

The tm/tq register file on T600x also keeps its state through the
acknowledged power-off, and through PMGR reset pulses on every ANE
domain (ane_sys, sys_cpu, set0, base, set1-4), so a power cycle alone
does not clear what a failed task latched. Bring back the
retained-state drain for SoCs whose descriptor says the file is
retained (T6000/T6001), based on omarchy-ane's ane_tm_drain_retained
by Joshua Warren (MIT). Before it was removed, the drain recovered
every "-5, finish lines=1" task error seen on the M1 Pro. A wedge the
drain cannot clear still fails the idle check and stays wedged, with
no reboot loop.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

M1 Pro check of this PR together with #718, kernel 7.3.0-aurora-fleet12g-ane (aurora-wip aa07c00 + #717 + #718, fleet recipe, one-shot boot):

  • Boot clean, ANE probes, wedged 0.
  • Reproducer that times out on its first submit, three rounds: each gave -EIO, tm recovered: idle, accepting work again about 0.5 ms later, wedged 0, bit-exact smoke 20/20 after each. No reboot.
  • Runtime PM goes back to suspended afterwards and the CPU boost releases.
  • arm64 W=1 on drivers/accel/ane and drivers/pmdomain/apple: no warnings.
  • KUnit x86_64 and arm64 as in the description.

Earlier the same night lane A's boost-0 bisect produced a run of -5, finish lines=0 errors on the fleet12e-ane692 boot with these commits, and every one recovered as a single -EIO.

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