From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796536659; b=K5kLgEsxVThHlgGsWxTAPym24TpYOZk+V4ZxVCi6+jidbFHlLgxS2uISc8cZ4vCYzLik NEuh2ye7S4x+F5uvzalQw+CsokL3+t/J1nWmGlAh6f6CjbIDARPqJBc+/e2xniy1iaExa HZMYUXrtaYbSTqWzrbQPFcH09aE+/qyIx/lDAJ5KizP4WntL0/iDcUzBThh8lM0viNMS0 uu/2VfyEI/fmtxKe3TBWPNHlI0etrd8Dk58qcIaInjd3N6v/+zvczYsZXwTbHC1plTGhZ pP+aX6NVNBK+Kg0JK58d3LosLy/ZrrKHiKbSww4kQHAwbxCamU06wcgDEQP7T/10mvQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796536659; h=Received:DKIM-Signature:Received:From:Subject:Date:Message-Id: MIME-Version:Content-Type:Content-Transfer-Encoding:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key: X-Endpoint-Received:X-Original-From:Reply-To; bh=k+XXdGRVH/txJ2hsro2qZidtwh+25GMhAi6On63f9eE=; b=z8BePIn2xfMyGZh7fWLeh5yZttBT0wyKsAlEpXYca+LV/3UG9QVBKJbagWTsxZnlRBed TI0ihVo7hHC3ASCW6LCXLHkkYf3Z3EgQ1lhSFsLlrk+Bi4pEUCtDRvVMentCUb0EAQNza L6F4ea94Q6quBdO6D6MNUx4mWg1yVSSg4PKJIwqqi5RDfnc9zpOqHd3qPp45xH+RECgZU hfsrmKIw31CiZF7MTAZglWtnO5E05nGSfp2eAQq/JITtnLbiOPDrkOWyvJ4/YRVvibiCB e0bEnhEiukWgc9GE6b5yhpcVwdtp/Heog3Bv31mkTpxcDgiyfBVtOagHoYa8cOJGFrw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="MT/47iR0"; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0666606A33A; Sun, 6 Dec 2026 05:57:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MT/47iR0 Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796536659; b=JbcIXsxjroxklwJAYRl0yKxRshJqY7V4d0IG/UxTTmhALnv5ZrjwOQyUY2A5UM7ofSW3 HS6ocuiPEgBiyFBYgL0fLrAjkSqlK5EZcvD/Sj/kMNh4tbIh+fDgzMYMfHERyMTWq3Ig3 jZEVUsDaQBR/ACgX+DmOjsXgEIPBuS4bA2udApULtmZiM+6ZiHPr/NUv/ftRFCPaIhOKH CAdsruT91T77qBc+xJlj3orkfMVT9JYkNlTxOtK4fAV1WBa0ZaX/5r42RKSm94T+SgA+V MrfeAWZHIxFTrvqItvd/pNwcQEx5iIAS9GXQThNJoXoVRk4/Sc9wpcOCW+dl6NjJnwA== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796536659; h=DKIM-Signature:Received:From:Subject:Date:Message-Id:MIME-Version: Content-Type:Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To: Cc:X-Mailer:X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To; bh=k+XXdGRVH/txJ2hsro2qZidtwh+25GMhAi6On63f9eE=; b=Qx3Mq563u8+Ybh4FMMvPjmmfEsG9WmWRnVi0nhXsJkrSeN2fyZd5sxpYHdvoG/kjaNsX VTVworSPbbzD9nFpUEJtIIMMpW0Zpgk8vu7QieSJUzRGIMHDd9Rlk+M9COtzzYzMGt5O0 fa2ZsAcjVTXT2cLZRDP11xf14onR1+cC7EzGDhBSMZCnhqfXcTlr3TRwhZa+kh9BufyaR K6Fo/PdTJaLm28CwY1N45SXz/JHIo0DbFdw2guc+JKY8LlKpBT7i7HNMGr6Ms1lqJbbbp ms0L2AEAWruBQgDS6KAKwLlzHisjx0AVnDTrHwD7/8ucBMG+kfdOELKwSiaugpw8giQ== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 8A2AD1F0092B; Sun, 6 Dec 2026 05:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796536659; bh=k+XXdGRVH/txJ2hsro2qZidtwh+25GMhAi6On63f9eE=; h=From:Subject:Date:To:Cc:Reply-To; b=MT/47iR0mmuyyQ5AILymJ+ZG9OHsVSrMvApmtJyktnDT7T7suM953soi58ySrummw aX75ZHc/BZJurEOHII54ZRV81SCWmcNN9G/m5XELzZFgYoa0qyih4mfoUke7EKKh/S Gm6Z74jgSPpQevVePdZyBsb0G42VJm/WpoeliXy2tC7VAGg44s73Sgb3nh9lW6ZMYp AdfNcOk4+nAaB3BY2N4kp65qD2Rz7cBLsKp+c7ShuIJzn7KIyLNi4BI+z/Ub1rkF10 NilHWwcONo1TWxMzEYfXm4jhR6VlQWP1hJQC5TBMOYvzBAU8h8h+vGB+fAEnxT527K Mo6n3/hg+DwKg== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id D929D50611; Sun, 6 Dec 2026 05:57:37 +0000 (UTC) From: Arun Iyengar via B4 Relay Subject: [PATCH v4 00/18] media: verisilicon: Recover the Rockchip VPUs from faults and timeouts Date: Sun, 06 Dec 2026 05:57:35 +0000 Message-Id: <20261206-hantro-robust-v4-0-b99d33a5ec6d@gmail.com> X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/3XN0Q6CIBQG4FdxXEeDgxJ11Xu0LgBBaSkNlNWc7 x7ajXPr8j/7v/9MKJrgTESXYkLBJBed73MoDwXSrewbg12dMwICnFJKcD4OwePg1RgHzCXXorR GKcJRNq9grHuve7f7L8dRPYwelpGl0bo4+PBZHya69P5tJ4oJ5ooDP2tSKSuvTSfd86h9h5btB FsNew1ZU1FxautSCCb2mm0122uWtQAmmD4ByBq2ep7nLwsCy9M4AQAA X-Change-ID: 20261110-hantro-robust-6a6c84febb06 To: Nicolas Dufresne , Benjamin Gaignard , Philipp Zabel , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Nicolas Frattaroli , Andrzej Pietrasiewicz , Ezequiel Garcia , Hans Verkuil , Boris Brezillon , Jernej Skrabec , "Joerg Roedel (AMD)" , Will Deacon , Robin Murphy , Ulf Hansson 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 , Tharit Tangkijwanichakul , Sascha Hauer , Arun Iyengar , Krzysztof Kozlowski , stable@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796536656; l=5993; i=aiyengar1990@gmail.com; s=20261110; h=from:subject:message-id; bh=zqekW1Zhvfopn2dOim+j2IZyLANmpYdab5s3Yf7GzLQ=; b=9MMFuCG0dmAhoi8u65sUb5bc1XkMMD5DuZlHQcIL4p1mhy/hElEVD5eaSYi69j535UCZuMhN9 QmR2oUg5Ly8AYGJl3PcW0hsDTzBXsyRGIa/1dUtlfuHI3ZR47d7w1YZ X-Developer-Key: i=aiyengar1990@gmail.com; a=ed25519; pk=zXpRgUTrhaFe6jLyPqbBy3ccfkj04w0g2690Wv3mg+0= X-Endpoint-Received: by B4 Relay for aiyengar1990@gmail.com/20261110 with auth_id=1480 X-Original-From: Arun Iyengar Reply-To: aiyengar1990@gmail.com 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 --- 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