Skip to content

media: apple: ave: recover a 6070 encoder after a hung frame - #1826

Merged
RyanTheTide merged 2 commits into
integration/aurorafrom
avefollow/6070-process-timeout-recovery
Nov 13, 2026
Merged

RyanTheTide merged 2 commits into
integration/aurorafrom
avefollow/6070-process-timeout-recovery

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

On the 6070 encoder (M1 Pro, M2), a firmware that stopped answering in the middle of a session left the encoder broken until reboot. Runtime suspend refuses to gate a 6070 firmware without a scratch-confirmed Halt, so the VENC domains kept their power and every later session failed with -EIO.

Once the last session has gone, runtime suspend and system sleep now give the hung firmware one Halt with a 500 ms deadline. The driver then stops the core, requires CTRL to read back zero and waits the usual settle interval. From there the firmware is handled like any halted one: the buffers its sessions saw stay quarantined, genpd cycles the VENC power, and the next session cold-starts the firmware and reaps that memory. If the core does not stop, the encoder stays broken as before.

Recoveries count against the existing history (3 in 10 minutes). A session that ends with a confirmed Halt now clears that history. After such a stop, system sleep keeps the boot memory mapped instead of freeing it before the power goes.

Tests

  • KUnit (arm64, LLVM, apple-ave suites): 44/44, including the new ave_recovery_reset_test. checkpatch --strict is clean.
  • M2, fleet69 with this apple-ave loaded at run time. A lab-only module parameter (not part of this PR) let HEVC B requests through to reproduce the known hang: HEVC with B pictures stops answering after 2 pictures (-110) every time. 4 of 4 hangs recovered without a reboot, 3 through runtime suspend and 1 through an s2idle entered right after the hang. The firmware confirmed its Halt each time, and HEVC 1080p encoded 300/300 frames at about 123 fps after every recovery. With the production module the first hang left the encoder broken until reboot.
  • M1 Pro, same setup: the same hang after 2 pictures, 4 of 4 recovered without a reboot (3 through runtime suspend, 1 through s2idle right after the hang), Halt confirmed each time, HEVC 1080p 300/300 at about 157 fps after every recovery.
  • M2 and M1 Pro, same module: H.264 1080p, High-B and 4K output is byte-identical to the production module; 150/150 stress sessions (H.264 and HEVC alternating, 0-3 s gaps); s2idle 3/3 with H.264 and HEVC encodes after each wake; 0 DART faults, 0 AVC.

🤖 Generated with Claude Code

A 6070 encoder (M1 Pro, M2) whose firmware stopped answering in the
middle of a session, for example a Process timeout, stayed broken until
reboot. Runtime suspend refuses to gate a 6070 firmware without a
scratch-confirmed Halt, so the VENC domains kept their power and every
later session failed with -EIO.

Once the last session has gone, runtime suspend (and system sleep) now
gives the hung firmware one Halt with a short deadline. Whether or not
the Halt is confirmed, the core is then stopped, CTRL must read back
zero, and the engines get the usual settle interval. The firmware is
then halted like any other: the buffers its sessions saw stay
quarantined, genpd cycles the VENC power with the DARTs after the
encoder, and the next session cold-starts the firmware and reaps that
memory. If the core does not stop, the encoder stays broken as before.

Recoveries count against the existing history (3 in 10 minutes); a
session that ends with a confirmed Halt now clears it, so only hangs
in a row without a working session in between hit the limit. System
sleep keeps the boot memory mapped after such a stop instead of freeing
it before the power goes.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
ave_suspend() now reads the firmware state to keep a hung 6070
firmware's boot buffers mapped after it is stopped without a confirmed
Halt. Give the stub device a firmware state and check both cases: a
stopped hung firmware keeps its boot buffers, a cleanly halted one
releases them.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide merged commit 91b6fc0 into integration/aurora Nov 13, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the avefollow/6070-process-timeout-recovery branch November 13, 2026 13:09
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