[PATCH v4 00/18] media: verisilicon: Recover the Rockchip VPUs from faults and timeouts

From: Arun Iyengar via B4 Relay

Date: Sun Dec 06 2026 - 00:58:29 EST


On the RK3588, later jobs time out after a VEPU121 IOVA fault or AV1 error.

1, 7-9, 13: reset a VEPU121 core on a timeout, restore its IOMMU and IRQ
2-4, 6: NULL match in probe, request left queued, stale timestamp, probe
clock unwind (2, 3, 6 found by Sashiko). 5: no reset assert on remove.
10-12, 14: AV1 resets on its IOMMU too, held only in use (Philipp Zabel)
15-18: reset the AV1 decoder after an error; 18 replaces [1], 17 needs it
and ecceb7dba63c (v7.4-rc5). 15 (via media, needs a pmdomain ack) follows
"soc: rockchip: power-domain: export idle request" by Randy Li, Caesar
Wang and Jeffy Chen (not merged). Patches 1 to 14 do not need 15 to 18.

Tested on Orange Pi 5 (RK3588S), v7.3 plus other out-of-tree Hantro
patches. Provoked encoder timeouts and IOVA faults are reset, later jobs
encode; all VPU cores probe, H.264 fluster unchanged, v4l2-compliance -s
passes (JPEG encoder). A job refused after a failed IOMMU restore completes
its request; so does a forced resume failure (3), next decode bit-exact.
60/60 failed jobs return the right timestamp (4), 0/60 without. Forced late
probe failure (6): clock counts unchanged, nothing registered. AV1
unbind/rebind: SError before 5, clean with it; 20/20 with 10-12 and 14,
s2idle 3/3, AV1 fluster and encoder recovery unchanged. 15-18 on KASAN: 216
forced error interrupts, 216 resets, 108/108 decodes between them bit-exact
while a second handle allocates and frees buffers; 344 forced timeouts
reset, in 6 the abort stopped a running core; rebind 3/3, fluster unchanged
(218/242). Forced idle-request, idle-release or IOMMU restore failure: jobs
refused until a rebind, then bit-exact; clock failure in 15: next decode
bit-exact; IOMMU restore failure at probe: bind fails, nothing left.

Claude (Anthropic) wrote the code and commit messages; I reviewed them all.

[1] https://lore.kernel.org/r/20261113-rk3588-av1-reset-order-v1-1-d73f60222ff9@xxxxxxxxx

Signed-off-by: Arun Iyengar <aiyengar1990@xxxxxxxxx>

---
Changes in v4:
- Rebased on media next (patches 2, 5 and 9 adjusted)
- New patch 4: copy the buffer metadata before a job can fail
- New patch 6: disable runtime PM before unpreparing the clocks on
probe failure (Sashiko, v3)
- Patch 9 (was 8): restore the IOMMU at probe too (Sashiko, v3)
- New patches 15 to 18: reset the AV1 decoder after an error
- Patch 2: Reviewed-by from Nicolas; patch 11: Reviewed-by from Rob
- Link to v3: https://patch.msgid.link/20261113-hantro-robust-v3-0-82383c722ad2@xxxxxxxxx

Changes in v3:
- New patch 2: check the match data in hantro_probe() (Sashiko, v1)
- New patch 3: complete the request when the VPU can't resume
- Patch 7 (was 5): complete the request of a job refused after a failed
IOMMU restore (Sashiko); fail the probe if the empty domain can't be
allocated
- Patches 4 to 7 (were 2 to 5): shorter commit messages and comments
- New patches 8 to 10, 12: the AV1 resets on its IOMMU, released
reset controls (Philipp Zabel)
- Patch 11 was 6
- Patch 1: Acked-by from Krzysztof
- Link to v2: https://patch.msgid.link/20261112-hantro-robust-v2-0-18561fd48838@xxxxxxxxx

Changes in v2:
- Patch 2: never assert the resets on remove or on the probe error path
- New patch 3: re-enable the encoder interrupt after a VEPU1/VEPU2 reset
- Patch 5 (was 4): restore the IOMMU only from the Rockchip encoder
reset, only with reset lines and a DMA domain; refuse later jobs if
the attach fails
- Link to v1: https://patch.msgid.link/20261110-hantro-robust-v1-0-6b6269c05bfa@xxxxxxxxx

---
Arun Iyengar (18):
dt-bindings: media: rockchip,rk3568-vepu: Add the reset lines
media: verisilicon: Check the match data in hantro_probe()
media: verisilicon: Complete the request when the VPU can't resume
media: verisilicon: Copy the buffer metadata before a job can fail
media: verisilicon: Don't hold the VPU in reset after remove
media: verisilicon: Disable runtime PM before unpreparing the clocks on probe failure
media: verisilicon: Enable the Rockchip encoder interrupt again after a reset
media: verisilicon: Reset the Rockchip encoder cores on timeout
media: verisilicon: Reinitialize the IOMMU after resetting an encoder core
media: verisilicon: Acquire the reset lines only while using them
dt-bindings: iommu: verisilicon: Add the reset lines
iommu/vsi: Deassert the reset lines on probe
arm64: dts: rockchip: Add the reset lines of the RK3588 VEPU121 cores
arm64: dts: rockchip: Add the reset lines of the RK3588 AV1 IOMMU
pmdomain: rockchip: Add rockchip_pmu_idle_reset()
dt-bindings: media: rockchip-vpu: Add reset-names
media: verisilicon: Reset the RK3588 AV1 decoder after an error
arm64: dts: rockchip: Name the RK3588 AV1 decoder resets

.../bindings/iommu/verisilicon,iommu.yaml | 10 ++
.../bindings/media/rockchip,rk3568-vepu.yaml | 10 ++
.../devicetree/bindings/media/rockchip-vpu.yaml | 7 +
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 14 +-
drivers/iommu/vsi-iommu.c | 16 ++
drivers/media/platform/verisilicon/hantro.h | 10 ++
drivers/media/platform/verisilicon/hantro_drv.c | 194 ++++++++++++++++-----
drivers/media/platform/verisilicon/hantro_hw.h | 6 +-
.../platform/verisilicon/rockchip_vpu981_regs.h | 3 +
.../media/platform/verisilicon/rockchip_vpu_hw.c | 130 +++++++++++++-
.../media/platform/verisilicon/stm32mp25_vpu_hw.c | 4 +
drivers/media/platform/verisilicon/sunxi_vpu_hw.c | 4 +
drivers/pmdomain/rockchip/pm-domains.c | 52 ++++++
include/soc/rockchip/pm_domains.h | 12 ++
14 files changed, 429 insertions(+), 43 deletions(-)
---
base-commit: 95c189b26efb07257888ccf9d873a5c366aafbc6
change-id: 20261110-hantro-robust-6a6c84febb06

Best regards,
--
Arun Iyengar <aiyengar1990@xxxxxxxxx>