Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	 Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	 Philipp Zabel <p.zabel@pengutronix.de>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	 Nicolas Frattaroli <frattaroli.nicolas@gmail.com>,
	 Andrzej Pietrasiewicz <andrzej.p@collabora.com>,
	 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
	 Hans Verkuil <hverkuil@kernel.org>,
	 Boris Brezillon <boris.brezillon@collabora.com>,
	 Jernej Skrabec <jernej.skrabec@gmail.com>,
	 "Joerg Roedel (AMD)" <joro@8bytes.org>,
	Will Deacon <will@kernel.org>,
	 Robin Murphy <robin.murphy@arm.com>,
	Ulf Hansson <ulfh@kernel.org>
Cc: linux-media@vger.kernel.org, iommu@lists.linux.dev,
	 linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	Sergei Khomenkov <shomenkow@gmail.com>,
	 Tharit Tangkijwanichakul <tharitt97@gmail.com>,
	 Sascha Hauer <s.hauer@pengutronix.de>,
	 Arun Iyengar <aiyengar1990@gmail.com>,
	 Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
	 stable@vger.kernel.org
Subject: [PATCH v4 00/18] media: verisilicon: Recover the Rockchip VPUs from faults and timeouts
Date: Sun, 06 Dec 2026 05:57:35 +0000	[thread overview]
Message-ID: <20261206-hantro-robust-v4-0-b99d33a5ec6d@gmail.com> (raw)

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@gmail.com

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>

---
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@gmail.com

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@gmail.com

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@gmail.com

---
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@gmail.com>




             reply	other threads:[~2026-12-06  5:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-06  5:57 Arun Iyengar via B4 Relay [this message]
2026-12-06  5:57 ` [PATCH v4 01/18] dt-bindings: media: rockchip,rk3568-vepu: Add the reset lines Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 02/18] media: verisilicon: Check the match data in hantro_probe() Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 03/18] media: verisilicon: Complete the request when the VPU can't resume Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 05/18] media: verisilicon: Don't hold the VPU in reset after remove Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 06/18] media: verisilicon: Disable runtime PM before unpreparing the clocks on probe failure Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 07/18] media: verisilicon: Enable the Rockchip encoder interrupt again after a reset Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 08/18] media: verisilicon: Reset the Rockchip encoder cores on timeout Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 09/18] media: verisilicon: Reinitialize the IOMMU after resetting an encoder core Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 10/18] media: verisilicon: Acquire the reset lines only while using them Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 11/18] dt-bindings: iommu: verisilicon: Add the reset lines Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 12/18] iommu/vsi: Deassert the reset lines on probe Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 13/18] arm64: dts: rockchip: Add the reset lines of the RK3588 VEPU121 cores Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 14/18] arm64: dts: rockchip: Add the reset lines of the RK3588 AV1 IOMMU Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 15/18] pmdomain: rockchip: Add rockchip_pmu_idle_reset() Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 16/18] dt-bindings: media: rockchip-vpu: Add reset-names Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 17/18] media: verisilicon: Reset the RK3588 AV1 decoder after an error Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 18/18] arm64: dts: rockchip: Name the RK3588 AV1 decoder resets Arun Iyengar via B4 Relay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261206-hantro-robust-v4-0-b99d33a5ec6d@gmail.com \
    --to=devnull+aiyengar1990.gmail.com@kernel.org \
    --cc=aiyengar1990@gmail.com \
    --cc=andrzej.p@collabora.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=boris.brezillon@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=frattaroli.nicolas@gmail.com \
    --cc=heiko@sntech.de \
    --cc=hverkuil@kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=jernej.skrabec@gmail.com \
    --cc=joro@8bytes.org \
    --cc=krzk+dt@kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shomenkow@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=tharitt97@gmail.com \
    --cc=ulfh@kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox