* [PATCH v4 00/18] media: verisilicon: Recover the Rockchip VPUs from faults and timeouts
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar,
Krzysztof Kozlowski, stable
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>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 63+ messages in thread* [PATCH v4 00/18] media: verisilicon: Recover the Rockchip VPUs from faults and timeouts
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar,
Krzysztof Kozlowski, stable
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>
^ permalink raw reply [flat|nested] 63+ messages in thread* [PATCH v4 01/18] dt-bindings: media: rockchip,rk3568-vepu: Add the reset lines
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar,
Krzysztof Kozlowski
The VEPU121 encoder cores of the RK3588 each have their own AXI and AHB
reset lines in the CRU (SRST_A_JPEG_ENCODERx and SRST_H_JPEG_ENCODERx).
They are needed to recover a core that is stuck on the bus, which its
registers can't stop.
Describe them as optional, so that existing device trees stay valid.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
.../devicetree/bindings/media/rockchip,rk3568-vepu.yaml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml b/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml
index d246f5d38427..e9fda4373f0f 100644
--- a/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml
+++ b/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml
@@ -32,6 +32,16 @@ properties:
- const: aclk
- const: hclk
+ resets:
+ items:
+ - description: AXI reset line
+ - description: AHB reset line
+
+ reset-names:
+ items:
+ - const: axi
+ - const: ahb
+
power-domains:
maxItems: 1
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 01/18] dt-bindings: media: rockchip,rk3568-vepu: Add the reset lines
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar,
Krzysztof Kozlowski
From: Arun Iyengar <aiyengar1990@gmail.com>
The VEPU121 encoder cores of the RK3588 each have their own AXI and AHB
reset lines in the CRU (SRST_A_JPEG_ENCODERx and SRST_H_JPEG_ENCODERx).
They are needed to recover a core that is stuck on the bus, which its
registers can't stop.
Describe them as optional, so that existing device trees stay valid.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
.../devicetree/bindings/media/rockchip,rk3568-vepu.yaml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml b/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml
index d246f5d38427..e9fda4373f0f 100644
--- a/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml
+++ b/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml
@@ -32,6 +32,16 @@ properties:
- const: aclk
- const: hclk
+ resets:
+ items:
+ - description: AXI reset line
+ - description: AHB reset line
+
+ reset-names:
+ items:
+ - const: axi
+ - const: ahb
+
power-domains:
maxItems: 1
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 01/18] dt-bindings: media: rockchip,rk3568-vepu: Add the reset lines
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar,
Krzysztof Kozlowski
From: Arun Iyengar <aiyengar1990@gmail.com>
The VEPU121 encoder cores of the RK3588 each have their own AXI and AHB
reset lines in the CRU (SRST_A_JPEG_ENCODERx and SRST_H_JPEG_ENCODERx).
They are needed to recover a core that is stuck on the bus, which its
registers can't stop.
Describe them as optional, so that existing device trees stay valid.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
.../devicetree/bindings/media/rockchip,rk3568-vepu.yaml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml b/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml
index d246f5d38427..e9fda4373f0f 100644
--- a/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml
+++ b/Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml
@@ -32,6 +32,16 @@ properties:
- const: aclk
- const: hclk
+ resets:
+ items:
+ - description: AXI reset line
+ - description: AHB reset line
+
+ reset-names:
+ items:
+ - const: axi
+ - const: ahb
+
power-domains:
maxItems: 1
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v4 02/18] media: verisilicon: Check the match data in hantro_probe()
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
A device bound through driver_override may have no OF match, and
hantro_probe() then dereferences a NULL match. Use
device_get_match_data() and fail with -ENODEV without match data.
Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 5c962847fdf5..da9813c60cf7 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -17,6 +17,7 @@
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
+#include <linux/property.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
#include <linux/workqueue.h>
@@ -1099,7 +1100,6 @@ static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
static int hantro_probe(struct platform_device *pdev)
{
- const struct of_device_id *match;
struct hantro_dev *vpu;
int i, ret;
@@ -1112,8 +1112,9 @@ static int hantro_probe(struct platform_device *pdev)
mutex_init(&vpu->vpu_mutex);
spin_lock_init(&vpu->irqlock);
- match = of_match_node(of_hantro_match, pdev->dev.of_node);
- vpu->variant = match->data;
+ vpu->variant = device_get_match_data(&pdev->dev);
+ if (!vpu->variant)
+ return -ENODEV;
ret = hantro_disable_multicore(vpu);
if (ret)
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 02/18] media: verisilicon: Check the match data in hantro_probe()
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
A device bound through driver_override may have no OF match, and
hantro_probe() then dereferences a NULL match. Use
device_get_match_data() and fail with -ENODEV without match data.
Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 5c962847fdf5..da9813c60cf7 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -17,6 +17,7 @@
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
+#include <linux/property.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
#include <linux/workqueue.h>
@@ -1099,7 +1100,6 @@ static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
static int hantro_probe(struct platform_device *pdev)
{
- const struct of_device_id *match;
struct hantro_dev *vpu;
int i, ret;
@@ -1112,8 +1112,9 @@ static int hantro_probe(struct platform_device *pdev)
mutex_init(&vpu->vpu_mutex);
spin_lock_init(&vpu->irqlock);
- match = of_match_node(of_hantro_match, pdev->dev.of_node);
- vpu->variant = match->data;
+ vpu->variant = device_get_match_data(&pdev->dev);
+ if (!vpu->variant)
+ return -ENODEV;
ret = hantro_disable_multicore(vpu);
if (ret)
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 02/18] media: verisilicon: Check the match data in hantro_probe()
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
A device bound through driver_override may have no OF match, and
hantro_probe() then dereferences a NULL match. Use
device_get_match_data() and fail with -ENODEV without match data.
Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 5c962847fdf5..da9813c60cf7 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -17,6 +17,7 @@
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
+#include <linux/property.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
#include <linux/workqueue.h>
@@ -1099,7 +1100,6 @@ static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
static int hantro_probe(struct platform_device *pdev)
{
- const struct of_device_id *match;
struct hantro_dev *vpu;
int i, ret;
@@ -1112,8 +1112,9 @@ static int hantro_probe(struct platform_device *pdev)
mutex_init(&vpu->vpu_mutex);
spin_lock_init(&vpu->irqlock);
- match = of_match_node(of_hantro_match, pdev->dev.of_node);
- vpu->variant = match->data;
+ vpu->variant = device_get_match_data(&pdev->dev);
+ if (!vpu->variant)
+ return -ENODEV;
ret = hantro_disable_multicore(vpu);
if (ret)
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v4 03/18] media: verisilicon: Complete the request when the VPU can't resume
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
If pm_runtime_resume_and_get() fails, device_run() returns the buffers
without completing the controls of the request, and the request stays
queued forever. Complete them on that path.
Fixes: 7d47b45dc590 ("media: rockchip/vpu: Support the Request API")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index da9813c60cf7..fa867168b947 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -203,16 +203,20 @@ static void device_run(void *priv)
dst = hantro_get_dst_buf(ctx);
ret = pm_runtime_resume_and_get(vpu->dev);
- if (ret < 0) {
- hantro_job_finish_no_pm(ctx, VB2_BUF_STATE_ERROR);
- return;
- }
+ if (ret < 0)
+ goto err_cancel_job;
v4l2_m2m_buf_copy_metadata(src, dst);
ret = ctx->codec_ops->run(ctx);
if (ret)
hantro_job_finish(ctx, VB2_BUF_STATE_ERROR);
+
+ return;
+
+err_cancel_job:
+ v4l2_ctrl_request_complete(src->vb2_buf.req_obj.req, &ctx->ctrl_handler);
+ hantro_job_finish_no_pm(ctx, VB2_BUF_STATE_ERROR);
}
static const struct v4l2_m2m_ops vpu_m2m_ops = {
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 03/18] media: verisilicon: Complete the request when the VPU can't resume
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
If pm_runtime_resume_and_get() fails, device_run() returns the buffers
without completing the controls of the request, and the request stays
queued forever. Complete them on that path.
Fixes: 7d47b45dc590 ("media: rockchip/vpu: Support the Request API")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index da9813c60cf7..fa867168b947 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -203,16 +203,20 @@ static void device_run(void *priv)
dst = hantro_get_dst_buf(ctx);
ret = pm_runtime_resume_and_get(vpu->dev);
- if (ret < 0) {
- hantro_job_finish_no_pm(ctx, VB2_BUF_STATE_ERROR);
- return;
- }
+ if (ret < 0)
+ goto err_cancel_job;
v4l2_m2m_buf_copy_metadata(src, dst);
ret = ctx->codec_ops->run(ctx);
if (ret)
hantro_job_finish(ctx, VB2_BUF_STATE_ERROR);
+
+ return;
+
+err_cancel_job:
+ v4l2_ctrl_request_complete(src->vb2_buf.req_obj.req, &ctx->ctrl_handler);
+ hantro_job_finish_no_pm(ctx, VB2_BUF_STATE_ERROR);
}
static const struct v4l2_m2m_ops vpu_m2m_ops = {
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 03/18] media: verisilicon: Complete the request when the VPU can't resume
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
If pm_runtime_resume_and_get() fails, device_run() returns the buffers
without completing the controls of the request, and the request stays
queued forever. Complete them on that path.
Fixes: 7d47b45dc590 ("media: rockchip/vpu: Support the Request API")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index da9813c60cf7..fa867168b947 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -203,16 +203,20 @@ static void device_run(void *priv)
dst = hantro_get_dst_buf(ctx);
ret = pm_runtime_resume_and_get(vpu->dev);
- if (ret < 0) {
- hantro_job_finish_no_pm(ctx, VB2_BUF_STATE_ERROR);
- return;
- }
+ if (ret < 0)
+ goto err_cancel_job;
v4l2_m2m_buf_copy_metadata(src, dst);
ret = ctx->codec_ops->run(ctx);
if (ret)
hantro_job_finish(ctx, VB2_BUF_STATE_ERROR);
+
+ return;
+
+err_cancel_job:
+ v4l2_ctrl_request_complete(src->vb2_buf.req_obj.req, &ctx->ctrl_handler);
+ hantro_job_finish_no_pm(ctx, VB2_BUF_STATE_ERROR);
}
static const struct v4l2_m2m_ops vpu_m2m_ops = {
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v4 04/18] media: verisilicon: Copy the buffer metadata before a job can fail
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
device_run() copies the OUTPUT buffer metadata to the CAPTURE buffer
only after pm_runtime_resume_and_get(). If that fails, the CAPTURE
buffer is returned with the error flag and a stale timestamp, so
userspace that matches buffers by timestamp drops the wrong frame.
Copy the metadata first.
Fixes: 6c2eb77bf566 ("media: hantro: Move copy_metadata() before doing a decode operation")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index fa867168b947..40ff60dd098a 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -202,12 +202,12 @@ static void device_run(void *priv)
src = hantro_get_src_buf(ctx);
dst = hantro_get_dst_buf(ctx);
+ v4l2_m2m_buf_copy_metadata(src, dst);
+
ret = pm_runtime_resume_and_get(vpu->dev);
if (ret < 0)
goto err_cancel_job;
- v4l2_m2m_buf_copy_metadata(src, dst);
-
ret = ctx->codec_ops->run(ctx);
if (ret)
hantro_job_finish(ctx, VB2_BUF_STATE_ERROR);
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 04/18] media: verisilicon: Copy the buffer metadata before a job can fail
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
device_run() copies the OUTPUT buffer metadata to the CAPTURE buffer
only after pm_runtime_resume_and_get(). If that fails, the CAPTURE
buffer is returned with the error flag and a stale timestamp, so
userspace that matches buffers by timestamp drops the wrong frame.
Copy the metadata first.
Fixes: 6c2eb77bf566 ("media: hantro: Move copy_metadata() before doing a decode operation")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index fa867168b947..40ff60dd098a 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -202,12 +202,12 @@ static void device_run(void *priv)
src = hantro_get_src_buf(ctx);
dst = hantro_get_dst_buf(ctx);
+ v4l2_m2m_buf_copy_metadata(src, dst);
+
ret = pm_runtime_resume_and_get(vpu->dev);
if (ret < 0)
goto err_cancel_job;
- v4l2_m2m_buf_copy_metadata(src, dst);
-
ret = ctx->codec_ops->run(ctx);
if (ret)
hantro_job_finish(ctx, VB2_BUF_STATE_ERROR);
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 04/18] media: verisilicon: Copy the buffer metadata before a job can fail
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
device_run() copies the OUTPUT buffer metadata to the CAPTURE buffer
only after pm_runtime_resume_and_get(). If that fails, the CAPTURE
buffer is returned with the error flag and a stale timestamp, so
userspace that matches buffers by timestamp drops the wrong frame.
Copy the metadata first.
Fixes: 6c2eb77bf566 ("media: hantro: Move copy_metadata() before doing a decode operation")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index fa867168b947..40ff60dd098a 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -202,12 +202,12 @@ static void device_run(void *priv)
src = hantro_get_src_buf(ctx);
dst = hantro_get_dst_buf(ctx);
+ v4l2_m2m_buf_copy_metadata(src, dst);
+
ret = pm_runtime_resume_and_get(vpu->dev);
if (ret < 0)
goto err_cancel_job;
- v4l2_m2m_buf_copy_metadata(src, dst);
-
ret = ctx->codec_ops->run(ctx);
if (ret)
hantro_job_finish(ctx, VB2_BUF_STATE_ERROR);
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v4 05/18] media: verisilicon: Don't hold the VPU in reset after remove
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar, stable
On the RK3588 the AV1 decoder resets include its bus interface resets,
which also reset its IOMMU. On unbind, hantro_remove() asserts them while
the IOMMU is runtime active; when it autosuspends, vsi_iommu_suspend()
writes its registers in reset and the SError panics the system. Hit when
reloading the module.
A runtime suspended VPU has its resets deasserted and its clocks off.
Leave it so on remove and on probe failure instead of asserting the
resets.
Fixes: ea71631b7129 ("media: hantro: add support for reset lines")
Cc: stable@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 40ff60dd098a..a5d0c09a3534 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -1224,7 +1224,7 @@ static int hantro_probe(struct platform_device *pdev)
ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks);
if (ret) {
dev_err(&pdev->dev, "Failed to prepare clocks\n");
- goto err_pm_disable_assert_reset;
+ goto err_pm_disable;
}
ret = v4l2_device_register(&pdev->dev, &vpu->v4l2_dev);
@@ -1278,11 +1278,6 @@ static int hantro_probe(struct platform_device *pdev)
v4l2_device_unregister(&vpu->v4l2_dev);
err_clk_unprepare:
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
-err_pm_disable_assert_reset:
- pm_runtime_dont_use_autosuspend(vpu->dev);
- pm_runtime_disable(vpu->dev);
- reset_control_assert(vpu->resets);
- return ret;
err_pm_disable:
pm_runtime_dont_use_autosuspend(vpu->dev);
pm_runtime_disable(vpu->dev);
@@ -1318,7 +1313,6 @@ static void hantro_remove(struct platform_device *pdev)
}
v4l2_device_unregister(&vpu->v4l2_dev);
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
- reset_control_assert(vpu->resets);
}
static int hantro_runtime_resume(struct device *dev)
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 05/18] media: verisilicon: Don't hold the VPU in reset after remove
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar, stable
From: Arun Iyengar <aiyengar1990@gmail.com>
On the RK3588 the AV1 decoder resets include its bus interface resets,
which also reset its IOMMU. On unbind, hantro_remove() asserts them while
the IOMMU is runtime active; when it autosuspends, vsi_iommu_suspend()
writes its registers in reset and the SError panics the system. Hit when
reloading the module.
A runtime suspended VPU has its resets deasserted and its clocks off.
Leave it so on remove and on probe failure instead of asserting the
resets.
Fixes: ea71631b7129 ("media: hantro: add support for reset lines")
Cc: stable@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 40ff60dd098a..a5d0c09a3534 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -1224,7 +1224,7 @@ static int hantro_probe(struct platform_device *pdev)
ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks);
if (ret) {
dev_err(&pdev->dev, "Failed to prepare clocks\n");
- goto err_pm_disable_assert_reset;
+ goto err_pm_disable;
}
ret = v4l2_device_register(&pdev->dev, &vpu->v4l2_dev);
@@ -1278,11 +1278,6 @@ static int hantro_probe(struct platform_device *pdev)
v4l2_device_unregister(&vpu->v4l2_dev);
err_clk_unprepare:
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
-err_pm_disable_assert_reset:
- pm_runtime_dont_use_autosuspend(vpu->dev);
- pm_runtime_disable(vpu->dev);
- reset_control_assert(vpu->resets);
- return ret;
err_pm_disable:
pm_runtime_dont_use_autosuspend(vpu->dev);
pm_runtime_disable(vpu->dev);
@@ -1318,7 +1313,6 @@ static void hantro_remove(struct platform_device *pdev)
}
v4l2_device_unregister(&vpu->v4l2_dev);
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
- reset_control_assert(vpu->resets);
}
static int hantro_runtime_resume(struct device *dev)
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 05/18] media: verisilicon: Don't hold the VPU in reset after remove
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar, stable
From: Arun Iyengar <aiyengar1990@gmail.com>
On the RK3588 the AV1 decoder resets include its bus interface resets,
which also reset its IOMMU. On unbind, hantro_remove() asserts them while
the IOMMU is runtime active; when it autosuspends, vsi_iommu_suspend()
writes its registers in reset and the SError panics the system. Hit when
reloading the module.
A runtime suspended VPU has its resets deasserted and its clocks off.
Leave it so on remove and on probe failure instead of asserting the
resets.
Fixes: ea71631b7129 ("media: hantro: add support for reset lines")
Cc: stable@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 40ff60dd098a..a5d0c09a3534 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -1224,7 +1224,7 @@ static int hantro_probe(struct platform_device *pdev)
ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks);
if (ret) {
dev_err(&pdev->dev, "Failed to prepare clocks\n");
- goto err_pm_disable_assert_reset;
+ goto err_pm_disable;
}
ret = v4l2_device_register(&pdev->dev, &vpu->v4l2_dev);
@@ -1278,11 +1278,6 @@ static int hantro_probe(struct platform_device *pdev)
v4l2_device_unregister(&vpu->v4l2_dev);
err_clk_unprepare:
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
-err_pm_disable_assert_reset:
- pm_runtime_dont_use_autosuspend(vpu->dev);
- pm_runtime_disable(vpu->dev);
- reset_control_assert(vpu->resets);
- return ret;
err_pm_disable:
pm_runtime_dont_use_autosuspend(vpu->dev);
pm_runtime_disable(vpu->dev);
@@ -1318,7 +1313,6 @@ static void hantro_remove(struct platform_device *pdev)
}
v4l2_device_unregister(&vpu->v4l2_dev);
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
- reset_control_assert(vpu->resets);
}
static int hantro_runtime_resume(struct device *dev)
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v4 06/18] media: verisilicon: Disable runtime PM before unpreparing the clocks on probe failure
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
The probe error path unprepares the clocks before it disables runtime
PM, so a VPU resumed through its video nodes before a late failure
keeps its clocks enabled, or suspends after they are unprepared.
Prepare the clocks before enabling runtime PM, and unwind like
hantro_remove(): suspend first, then unprepare.
Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 53 ++++++++++++++-----------
1 file changed, 30 insertions(+), 23 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index a5d0c09a3534..957ed7a59197 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -1102,6 +1102,25 @@ static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
return v4l2_m2m_init(&vpu_m2m_ops);
}
+static int hantro_runtime_suspend(struct device *dev)
+{
+ struct hantro_dev *vpu = dev_get_drvdata(dev);
+
+ clk_bulk_disable(vpu->variant->num_clocks, vpu->clocks);
+ return 0;
+}
+
+static void hantro_disable_runtime_pm(struct hantro_dev *vpu)
+{
+ pm_runtime_dont_use_autosuspend(vpu->dev);
+ pm_runtime_disable(vpu->dev);
+ /* Runtime PM forbidden through sysfs: the device is still active. */
+ if (IS_ENABLED(CONFIG_PM) && !pm_runtime_status_suspended(vpu->dev)) {
+ hantro_runtime_suspend(vpu->dev);
+ pm_runtime_set_suspended(vpu->dev);
+ }
+}
+
static int hantro_probe(struct platform_device *pdev)
{
struct hantro_dev *vpu;
@@ -1211,6 +1230,12 @@ static int hantro_probe(struct platform_device *pdev)
}
}
+ ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to prepare clocks\n");
+ return ret;
+ }
+
pm_runtime_set_autosuspend_delay(vpu->dev, 100);
pm_runtime_use_autosuspend(vpu->dev);
pm_runtime_enable(vpu->dev);
@@ -1221,16 +1246,10 @@ static int hantro_probe(struct platform_device *pdev)
goto err_pm_disable;
}
- ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks);
- if (ret) {
- dev_err(&pdev->dev, "Failed to prepare clocks\n");
- goto err_pm_disable;
- }
-
ret = v4l2_device_register(&pdev->dev, &vpu->v4l2_dev);
if (ret) {
dev_err(&pdev->dev, "Failed to register v4l2 device\n");
- goto err_clk_unprepare;
+ goto err_pm_disable;
}
platform_set_drvdata(pdev, vpu);
@@ -1275,23 +1294,17 @@ static int hantro_probe(struct platform_device *pdev)
media_device_cleanup(&vpu->mdev);
v4l2_m2m_put(vpu->m2m_dev);
err_v4l2_unreg:
+ hantro_disable_runtime_pm(vpu);
v4l2_device_unregister(&vpu->v4l2_dev);
-err_clk_unprepare:
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
+ return ret;
err_pm_disable:
pm_runtime_dont_use_autosuspend(vpu->dev);
pm_runtime_disable(vpu->dev);
+ clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
return ret;
}
-static int hantro_runtime_suspend(struct device *dev)
-{
- struct hantro_dev *vpu = dev_get_drvdata(dev);
-
- clk_bulk_disable(vpu->variant->num_clocks, vpu->clocks);
- return 0;
-}
-
static void hantro_remove(struct platform_device *pdev)
{
struct hantro_dev *vpu = platform_get_drvdata(pdev);
@@ -1304,13 +1317,7 @@ static void hantro_remove(struct platform_device *pdev)
media_device_cleanup(&vpu->mdev);
v4l2_m2m_put(vpu->m2m_dev);
/* Suspend first: v4l2_device_unregister() clears the driver data. */
- pm_runtime_dont_use_autosuspend(vpu->dev);
- pm_runtime_disable(vpu->dev);
- /* Runtime PM forbidden through sysfs: the device is still active. */
- if (IS_ENABLED(CONFIG_PM) && !pm_runtime_status_suspended(vpu->dev)) {
- hantro_runtime_suspend(vpu->dev);
- pm_runtime_set_suspended(vpu->dev);
- }
+ hantro_disable_runtime_pm(vpu);
v4l2_device_unregister(&vpu->v4l2_dev);
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
}
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 06/18] media: verisilicon: Disable runtime PM before unpreparing the clocks on probe failure
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
The probe error path unprepares the clocks before it disables runtime
PM, so a VPU resumed through its video nodes before a late failure
keeps its clocks enabled, or suspends after they are unprepared.
Prepare the clocks before enabling runtime PM, and unwind like
hantro_remove(): suspend first, then unprepare.
Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 53 ++++++++++++++-----------
1 file changed, 30 insertions(+), 23 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index a5d0c09a3534..957ed7a59197 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -1102,6 +1102,25 @@ static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
return v4l2_m2m_init(&vpu_m2m_ops);
}
+static int hantro_runtime_suspend(struct device *dev)
+{
+ struct hantro_dev *vpu = dev_get_drvdata(dev);
+
+ clk_bulk_disable(vpu->variant->num_clocks, vpu->clocks);
+ return 0;
+}
+
+static void hantro_disable_runtime_pm(struct hantro_dev *vpu)
+{
+ pm_runtime_dont_use_autosuspend(vpu->dev);
+ pm_runtime_disable(vpu->dev);
+ /* Runtime PM forbidden through sysfs: the device is still active. */
+ if (IS_ENABLED(CONFIG_PM) && !pm_runtime_status_suspended(vpu->dev)) {
+ hantro_runtime_suspend(vpu->dev);
+ pm_runtime_set_suspended(vpu->dev);
+ }
+}
+
static int hantro_probe(struct platform_device *pdev)
{
struct hantro_dev *vpu;
@@ -1211,6 +1230,12 @@ static int hantro_probe(struct platform_device *pdev)
}
}
+ ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to prepare clocks\n");
+ return ret;
+ }
+
pm_runtime_set_autosuspend_delay(vpu->dev, 100);
pm_runtime_use_autosuspend(vpu->dev);
pm_runtime_enable(vpu->dev);
@@ -1221,16 +1246,10 @@ static int hantro_probe(struct platform_device *pdev)
goto err_pm_disable;
}
- ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks);
- if (ret) {
- dev_err(&pdev->dev, "Failed to prepare clocks\n");
- goto err_pm_disable;
- }
-
ret = v4l2_device_register(&pdev->dev, &vpu->v4l2_dev);
if (ret) {
dev_err(&pdev->dev, "Failed to register v4l2 device\n");
- goto err_clk_unprepare;
+ goto err_pm_disable;
}
platform_set_drvdata(pdev, vpu);
@@ -1275,23 +1294,17 @@ static int hantro_probe(struct platform_device *pdev)
media_device_cleanup(&vpu->mdev);
v4l2_m2m_put(vpu->m2m_dev);
err_v4l2_unreg:
+ hantro_disable_runtime_pm(vpu);
v4l2_device_unregister(&vpu->v4l2_dev);
-err_clk_unprepare:
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
+ return ret;
err_pm_disable:
pm_runtime_dont_use_autosuspend(vpu->dev);
pm_runtime_disable(vpu->dev);
+ clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
return ret;
}
-static int hantro_runtime_suspend(struct device *dev)
-{
- struct hantro_dev *vpu = dev_get_drvdata(dev);
-
- clk_bulk_disable(vpu->variant->num_clocks, vpu->clocks);
- return 0;
-}
-
static void hantro_remove(struct platform_device *pdev)
{
struct hantro_dev *vpu = platform_get_drvdata(pdev);
@@ -1304,13 +1317,7 @@ static void hantro_remove(struct platform_device *pdev)
media_device_cleanup(&vpu->mdev);
v4l2_m2m_put(vpu->m2m_dev);
/* Suspend first: v4l2_device_unregister() clears the driver data. */
- pm_runtime_dont_use_autosuspend(vpu->dev);
- pm_runtime_disable(vpu->dev);
- /* Runtime PM forbidden through sysfs: the device is still active. */
- if (IS_ENABLED(CONFIG_PM) && !pm_runtime_status_suspended(vpu->dev)) {
- hantro_runtime_suspend(vpu->dev);
- pm_runtime_set_suspended(vpu->dev);
- }
+ hantro_disable_runtime_pm(vpu);
v4l2_device_unregister(&vpu->v4l2_dev);
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
}
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 06/18] media: verisilicon: Disable runtime PM before unpreparing the clocks on probe failure
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
The probe error path unprepares the clocks before it disables runtime
PM, so a VPU resumed through its video nodes before a late failure
keeps its clocks enabled, or suspends after they are unprepared.
Prepare the clocks before enabling runtime PM, and unwind like
hantro_remove(): suspend first, then unprepare.
Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 53 ++++++++++++++-----------
1 file changed, 30 insertions(+), 23 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index a5d0c09a3534..957ed7a59197 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -1102,6 +1102,25 @@ static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
return v4l2_m2m_init(&vpu_m2m_ops);
}
+static int hantro_runtime_suspend(struct device *dev)
+{
+ struct hantro_dev *vpu = dev_get_drvdata(dev);
+
+ clk_bulk_disable(vpu->variant->num_clocks, vpu->clocks);
+ return 0;
+}
+
+static void hantro_disable_runtime_pm(struct hantro_dev *vpu)
+{
+ pm_runtime_dont_use_autosuspend(vpu->dev);
+ pm_runtime_disable(vpu->dev);
+ /* Runtime PM forbidden through sysfs: the device is still active. */
+ if (IS_ENABLED(CONFIG_PM) && !pm_runtime_status_suspended(vpu->dev)) {
+ hantro_runtime_suspend(vpu->dev);
+ pm_runtime_set_suspended(vpu->dev);
+ }
+}
+
static int hantro_probe(struct platform_device *pdev)
{
struct hantro_dev *vpu;
@@ -1211,6 +1230,12 @@ static int hantro_probe(struct platform_device *pdev)
}
}
+ ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to prepare clocks\n");
+ return ret;
+ }
+
pm_runtime_set_autosuspend_delay(vpu->dev, 100);
pm_runtime_use_autosuspend(vpu->dev);
pm_runtime_enable(vpu->dev);
@@ -1221,16 +1246,10 @@ static int hantro_probe(struct platform_device *pdev)
goto err_pm_disable;
}
- ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks);
- if (ret) {
- dev_err(&pdev->dev, "Failed to prepare clocks\n");
- goto err_pm_disable;
- }
-
ret = v4l2_device_register(&pdev->dev, &vpu->v4l2_dev);
if (ret) {
dev_err(&pdev->dev, "Failed to register v4l2 device\n");
- goto err_clk_unprepare;
+ goto err_pm_disable;
}
platform_set_drvdata(pdev, vpu);
@@ -1275,23 +1294,17 @@ static int hantro_probe(struct platform_device *pdev)
media_device_cleanup(&vpu->mdev);
v4l2_m2m_put(vpu->m2m_dev);
err_v4l2_unreg:
+ hantro_disable_runtime_pm(vpu);
v4l2_device_unregister(&vpu->v4l2_dev);
-err_clk_unprepare:
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
+ return ret;
err_pm_disable:
pm_runtime_dont_use_autosuspend(vpu->dev);
pm_runtime_disable(vpu->dev);
+ clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
return ret;
}
-static int hantro_runtime_suspend(struct device *dev)
-{
- struct hantro_dev *vpu = dev_get_drvdata(dev);
-
- clk_bulk_disable(vpu->variant->num_clocks, vpu->clocks);
- return 0;
-}
-
static void hantro_remove(struct platform_device *pdev)
{
struct hantro_dev *vpu = platform_get_drvdata(pdev);
@@ -1304,13 +1317,7 @@ static void hantro_remove(struct platform_device *pdev)
media_device_cleanup(&vpu->mdev);
v4l2_m2m_put(vpu->m2m_dev);
/* Suspend first: v4l2_device_unregister() clears the driver data. */
- pm_runtime_dont_use_autosuspend(vpu->dev);
- pm_runtime_disable(vpu->dev);
- /* Runtime PM forbidden through sysfs: the device is still active. */
- if (IS_ENABLED(CONFIG_PM) && !pm_runtime_status_suspended(vpu->dev)) {
- hantro_runtime_suspend(vpu->dev);
- pm_runtime_set_suspended(vpu->dev);
- }
+ hantro_disable_runtime_pm(vpu);
v4l2_device_unregister(&vpu->v4l2_dev);
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
}
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* Re: [PATCH v4 06/18] media: verisilicon: Disable runtime PM before unpreparing the clocks on probe failure
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
(?)
@ 2026-12-06 6:11 ` sashiko-bot
-1 siblings, 0 replies; 63+ messages in thread
From: sashiko-bot @ 2026-12-06 6:11 UTC (permalink / raw)
To: Arun Iyengar; +Cc: devicetree, robh, conor+dt, media-ci
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] media: verisilicon: Fixes trailer cites 775fec69008d instead of
556ab0b2741d
--
commit 56349933e88ca17d9f433ca9184631783de8230d
Author: Arun Iyengar <aiyengar1990@gmail.com>
> media: verisilicon: Disable runtime PM before unpreparing the clocks on probe failure
>
> The probe error path unprepares the clocks before it disables runtime
> PM, so a VPU resumed through its video nodes before a late failure
> keeps its clocks enabled, or suspends after they are unprepared.
> Prepare the clocks before enabling runtime PM, and unwind like
> hantro_remove(): suspend first, then unprepare.
>
> Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
[Severity: Low]
Should the Fixes tag point to 556ab0b2741d ("media: hantro: release runtime
resources when device_run fails") instead?
In 775fec69008d ("media: add Rockchip VPU JPEG encoder driver"), clocks were
enabled and disabled directly per job rather than by runtime PM callbacks.
That later commit moved clk_bulk_enable() and clk_bulk_disable() into
hantro_runtime_resume() and hantro_runtime_suspend(), introducing this bug.
The companion fix in 8f9ab25ffef6 ("media: verisilicon: suspend the device
before unregistering it on remove") cites the same commit. Citing the
initial driver commit can misdirect stable backports to kernels where clocks
are not managed by runtime PM.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261206-hantro-robust-v4-0-b99d33a5ec6d@gmail.com?part=6
^ permalink raw reply [flat|nested] 63+ messages in thread
* [PATCH v4 07/18] media: verisilicon: Enable the Rockchip encoder interrupt again after a reset
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar, stable
The reset operations of the Rockchip VEPU1 and VEPU2 encoders disable
the encoder interrupt before stopping the encoder. Nothing enables it
again: the encoder run functions don't write the interrupt register,
only the interrupt handler does. Every later job on the encoder then
times out as well.
Clear the interrupt register at the end of the reset, as the interrupt
handler does after each frame.
Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Cc: stable@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/rockchip_vpu_hw.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index 614d54e3a8ef..d54ba36d4449 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -476,6 +476,8 @@ static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, H1_REG_INTERRUPT_DIS_BIT, H1_REG_INTERRUPT);
vepu_write(vpu, 0, H1_REG_ENC_CTRL);
vepu_write(vpu, 0, H1_REG_AXI_CTRL);
+ /* Only the interrupt handler writes this register: enable the interrupt again. */
+ vepu_write(vpu, 0, H1_REG_INTERRUPT);
}
static void rockchip_vpu2_dec_reset(struct hantro_ctx *ctx)
@@ -494,6 +496,8 @@ static void rockchip_vpu2_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, VEPU_REG_INTERRUPT_DIS_BIT, VEPU_REG_INTERRUPT);
vepu_write(vpu, 0, VEPU_REG_ENCODE_START);
vepu_write(vpu, 0, VEPU_REG_AXI_CTRL);
+ /* Only the interrupt handler writes this register: enable the interrupt again. */
+ vepu_write(vpu, 0, VEPU_REG_INTERRUPT);
}
/*
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 07/18] media: verisilicon: Enable the Rockchip encoder interrupt again after a reset
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar, stable
From: Arun Iyengar <aiyengar1990@gmail.com>
The reset operations of the Rockchip VEPU1 and VEPU2 encoders disable
the encoder interrupt before stopping the encoder. Nothing enables it
again: the encoder run functions don't write the interrupt register,
only the interrupt handler does. Every later job on the encoder then
times out as well.
Clear the interrupt register at the end of the reset, as the interrupt
handler does after each frame.
Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Cc: stable@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/rockchip_vpu_hw.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index 614d54e3a8ef..d54ba36d4449 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -476,6 +476,8 @@ static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, H1_REG_INTERRUPT_DIS_BIT, H1_REG_INTERRUPT);
vepu_write(vpu, 0, H1_REG_ENC_CTRL);
vepu_write(vpu, 0, H1_REG_AXI_CTRL);
+ /* Only the interrupt handler writes this register: enable the interrupt again. */
+ vepu_write(vpu, 0, H1_REG_INTERRUPT);
}
static void rockchip_vpu2_dec_reset(struct hantro_ctx *ctx)
@@ -494,6 +496,8 @@ static void rockchip_vpu2_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, VEPU_REG_INTERRUPT_DIS_BIT, VEPU_REG_INTERRUPT);
vepu_write(vpu, 0, VEPU_REG_ENCODE_START);
vepu_write(vpu, 0, VEPU_REG_AXI_CTRL);
+ /* Only the interrupt handler writes this register: enable the interrupt again. */
+ vepu_write(vpu, 0, VEPU_REG_INTERRUPT);
}
/*
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 07/18] media: verisilicon: Enable the Rockchip encoder interrupt again after a reset
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar, stable
From: Arun Iyengar <aiyengar1990@gmail.com>
The reset operations of the Rockchip VEPU1 and VEPU2 encoders disable
the encoder interrupt before stopping the encoder. Nothing enables it
again: the encoder run functions don't write the interrupt register,
only the interrupt handler does. Every later job on the encoder then
times out as well.
Clear the interrupt register at the end of the reset, as the interrupt
handler does after each frame.
Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Cc: stable@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/rockchip_vpu_hw.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index 614d54e3a8ef..d54ba36d4449 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -476,6 +476,8 @@ static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, H1_REG_INTERRUPT_DIS_BIT, H1_REG_INTERRUPT);
vepu_write(vpu, 0, H1_REG_ENC_CTRL);
vepu_write(vpu, 0, H1_REG_AXI_CTRL);
+ /* Only the interrupt handler writes this register: enable the interrupt again. */
+ vepu_write(vpu, 0, H1_REG_INTERRUPT);
}
static void rockchip_vpu2_dec_reset(struct hantro_ctx *ctx)
@@ -494,6 +496,8 @@ static void rockchip_vpu2_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, VEPU_REG_INTERRUPT_DIS_BIT, VEPU_REG_INTERRUPT);
vepu_write(vpu, 0, VEPU_REG_ENCODE_START);
vepu_write(vpu, 0, VEPU_REG_AXI_CTRL);
+ /* Only the interrupt handler writes this register: enable the interrupt again. */
+ vepu_write(vpu, 0, VEPU_REG_INTERRUPT);
}
/*
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v4 08/18] media: verisilicon: Reset the Rockchip encoder cores on timeout
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
On a job timeout, the Rockchip VEPU1 and VEPU2 reset operations mask the
interrupt and clear the encode enable and AXI control registers. On
RK3588, when a VEPU121 core reads an IOVA that isn't mapped, the IOMMU
reports a page fault and the core never becomes idle again: its AXI
transactions stay outstanding, the IOMMU can't be stalled anymore
("Enable stall request timed out", then "Disable paging request timed
out" on runtime suspend), and every later job times out as well.
Pulse the optional reset lines in the encoder reset operations, after
stopping the core through its registers, as the Rockchip BSP MPP driver
does. The job that timed out still holds the clocks. Nothing changes
for device trees without the resets.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
.../media/platform/verisilicon/rockchip_vpu_hw.c | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index d54ba36d4449..2ec25d6dac86 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -7,6 +7,7 @@
*/
#include <linux/clk.h>
+#include <linux/delay.h>
#include "hantro.h"
#include "hantro_av1.h"
@@ -469,6 +470,31 @@ static void rk3066_vpu_dec_reset(struct hantro_ctx *ctx)
vdpu_write(vpu, G1_REG_CONFIG_DEC_CLK_GATE_E, G1_REG_CONFIG);
}
+/*
+ * A core stuck on the bus, e.g. after an IOMMU fault, can't be stopped
+ * through its registers and keeps the IOMMU from stalling. Pulse its reset
+ * lines, if any.
+ */
+static void rockchip_vpu_enc_hw_reset(struct hantro_dev *vpu)
+{
+ int ret;
+
+ if (!vpu->resets)
+ return;
+
+ ret = reset_control_assert(vpu->resets);
+ if (ret) {
+ dev_warn(vpu->dev, "Failed to assert resets: %d\n", ret);
+ return;
+ }
+
+ udelay(5);
+
+ ret = reset_control_deassert(vpu->resets);
+ if (ret)
+ dev_err(vpu->dev, "Failed to deassert resets: %d\n", ret);
+}
+
static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
{
struct hantro_dev *vpu = ctx->dev;
@@ -476,6 +502,7 @@ static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, H1_REG_INTERRUPT_DIS_BIT, H1_REG_INTERRUPT);
vepu_write(vpu, 0, H1_REG_ENC_CTRL);
vepu_write(vpu, 0, H1_REG_AXI_CTRL);
+ rockchip_vpu_enc_hw_reset(vpu);
/* Only the interrupt handler writes this register: enable the interrupt again. */
vepu_write(vpu, 0, H1_REG_INTERRUPT);
}
@@ -496,6 +523,7 @@ static void rockchip_vpu2_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, VEPU_REG_INTERRUPT_DIS_BIT, VEPU_REG_INTERRUPT);
vepu_write(vpu, 0, VEPU_REG_ENCODE_START);
vepu_write(vpu, 0, VEPU_REG_AXI_CTRL);
+ rockchip_vpu_enc_hw_reset(vpu);
/* Only the interrupt handler writes this register: enable the interrupt again. */
vepu_write(vpu, 0, VEPU_REG_INTERRUPT);
}
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 08/18] media: verisilicon: Reset the Rockchip encoder cores on timeout
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
On a job timeout, the Rockchip VEPU1 and VEPU2 reset operations mask the
interrupt and clear the encode enable and AXI control registers. On
RK3588, when a VEPU121 core reads an IOVA that isn't mapped, the IOMMU
reports a page fault and the core never becomes idle again: its AXI
transactions stay outstanding, the IOMMU can't be stalled anymore
("Enable stall request timed out", then "Disable paging request timed
out" on runtime suspend), and every later job times out as well.
Pulse the optional reset lines in the encoder reset operations, after
stopping the core through its registers, as the Rockchip BSP MPP driver
does. The job that timed out still holds the clocks. Nothing changes
for device trees without the resets.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
.../media/platform/verisilicon/rockchip_vpu_hw.c | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index d54ba36d4449..2ec25d6dac86 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -7,6 +7,7 @@
*/
#include <linux/clk.h>
+#include <linux/delay.h>
#include "hantro.h"
#include "hantro_av1.h"
@@ -469,6 +470,31 @@ static void rk3066_vpu_dec_reset(struct hantro_ctx *ctx)
vdpu_write(vpu, G1_REG_CONFIG_DEC_CLK_GATE_E, G1_REG_CONFIG);
}
+/*
+ * A core stuck on the bus, e.g. after an IOMMU fault, can't be stopped
+ * through its registers and keeps the IOMMU from stalling. Pulse its reset
+ * lines, if any.
+ */
+static void rockchip_vpu_enc_hw_reset(struct hantro_dev *vpu)
+{
+ int ret;
+
+ if (!vpu->resets)
+ return;
+
+ ret = reset_control_assert(vpu->resets);
+ if (ret) {
+ dev_warn(vpu->dev, "Failed to assert resets: %d\n", ret);
+ return;
+ }
+
+ udelay(5);
+
+ ret = reset_control_deassert(vpu->resets);
+ if (ret)
+ dev_err(vpu->dev, "Failed to deassert resets: %d\n", ret);
+}
+
static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
{
struct hantro_dev *vpu = ctx->dev;
@@ -476,6 +502,7 @@ static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, H1_REG_INTERRUPT_DIS_BIT, H1_REG_INTERRUPT);
vepu_write(vpu, 0, H1_REG_ENC_CTRL);
vepu_write(vpu, 0, H1_REG_AXI_CTRL);
+ rockchip_vpu_enc_hw_reset(vpu);
/* Only the interrupt handler writes this register: enable the interrupt again. */
vepu_write(vpu, 0, H1_REG_INTERRUPT);
}
@@ -496,6 +523,7 @@ static void rockchip_vpu2_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, VEPU_REG_INTERRUPT_DIS_BIT, VEPU_REG_INTERRUPT);
vepu_write(vpu, 0, VEPU_REG_ENCODE_START);
vepu_write(vpu, 0, VEPU_REG_AXI_CTRL);
+ rockchip_vpu_enc_hw_reset(vpu);
/* Only the interrupt handler writes this register: enable the interrupt again. */
vepu_write(vpu, 0, VEPU_REG_INTERRUPT);
}
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 08/18] media: verisilicon: Reset the Rockchip encoder cores on timeout
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
On a job timeout, the Rockchip VEPU1 and VEPU2 reset operations mask the
interrupt and clear the encode enable and AXI control registers. On
RK3588, when a VEPU121 core reads an IOVA that isn't mapped, the IOMMU
reports a page fault and the core never becomes idle again: its AXI
transactions stay outstanding, the IOMMU can't be stalled anymore
("Enable stall request timed out", then "Disable paging request timed
out" on runtime suspend), and every later job times out as well.
Pulse the optional reset lines in the encoder reset operations, after
stopping the core through its registers, as the Rockchip BSP MPP driver
does. The job that timed out still holds the clocks. Nothing changes
for device trees without the resets.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
.../media/platform/verisilicon/rockchip_vpu_hw.c | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index d54ba36d4449..2ec25d6dac86 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -7,6 +7,7 @@
*/
#include <linux/clk.h>
+#include <linux/delay.h>
#include "hantro.h"
#include "hantro_av1.h"
@@ -469,6 +470,31 @@ static void rk3066_vpu_dec_reset(struct hantro_ctx *ctx)
vdpu_write(vpu, G1_REG_CONFIG_DEC_CLK_GATE_E, G1_REG_CONFIG);
}
+/*
+ * A core stuck on the bus, e.g. after an IOMMU fault, can't be stopped
+ * through its registers and keeps the IOMMU from stalling. Pulse its reset
+ * lines, if any.
+ */
+static void rockchip_vpu_enc_hw_reset(struct hantro_dev *vpu)
+{
+ int ret;
+
+ if (!vpu->resets)
+ return;
+
+ ret = reset_control_assert(vpu->resets);
+ if (ret) {
+ dev_warn(vpu->dev, "Failed to assert resets: %d\n", ret);
+ return;
+ }
+
+ udelay(5);
+
+ ret = reset_control_deassert(vpu->resets);
+ if (ret)
+ dev_err(vpu->dev, "Failed to deassert resets: %d\n", ret);
+}
+
static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
{
struct hantro_dev *vpu = ctx->dev;
@@ -476,6 +502,7 @@ static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, H1_REG_INTERRUPT_DIS_BIT, H1_REG_INTERRUPT);
vepu_write(vpu, 0, H1_REG_ENC_CTRL);
vepu_write(vpu, 0, H1_REG_AXI_CTRL);
+ rockchip_vpu_enc_hw_reset(vpu);
/* Only the interrupt handler writes this register: enable the interrupt again. */
vepu_write(vpu, 0, H1_REG_INTERRUPT);
}
@@ -496,6 +523,7 @@ static void rockchip_vpu2_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, VEPU_REG_INTERRUPT_DIS_BIT, VEPU_REG_INTERRUPT);
vepu_write(vpu, 0, VEPU_REG_ENCODE_START);
vepu_write(vpu, 0, VEPU_REG_AXI_CTRL);
+ rockchip_vpu_enc_hw_reset(vpu);
/* Only the interrupt handler writes this register: enable the interrupt again. */
vepu_write(vpu, 0, VEPU_REG_INTERRUPT);
}
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* Re: [PATCH v4 08/18] media: verisilicon: Reset the Rockchip encoder cores on timeout
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
(?)
@ 2026-12-06 6:23 ` sashiko-bot
-1 siblings, 0 replies; 63+ messages in thread
From: sashiko-bot @ 2026-12-06 6:23 UTC (permalink / raw)
To: Arun Iyengar; +Cc: devicetree, robh, conor+dt, media-ci
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] media: verisilicon: rockchip_vpu_enc_hw_reset() races with VEPU
IRQ MMIO
- [High] media: verisilicon: IOMMU MMIO race during
rockchip_vpu_enc_hw_reset()
--
commit f26bdf656794e3f590dbb7fe0fa7ce2d6061f6e2
Author: Arun Iyengar <aiyengar1990@gmail.com>
media: verisilicon: Reset the Rockchip encoder cores on timeout
This commit adds a rockchip_vpu_enc_hw_reset() helper that pulses the
optional reset lines for 5 us and calls it from the Rockchip VEPU1 and
VEPU2 timeout reset handlers.
> diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
> index d54ba36d44495..2ec25d6dac866 100644
> --- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
> +++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
[ ... ]
> @@ -469,6 +470,31 @@ static void rk3066_vpu_dec_reset(struct hantro_ctx *ctx)
> vdpu_write(vpu, G1_REG_CONFIG_DEC_CLK_GATE_E, G1_REG_CONFIG);
> }
>
> +/*
> + * A core stuck on the bus, e.g. after an IOMMU fault, can't be stopped
> + * through its registers and keeps the IOMMU from stalling. Pulse its reset
> + * lines, if any.
> + */
> +static void rockchip_vpu_enc_hw_reset(struct hantro_dev *vpu)
> +{
> + int ret;
> +
> + if (!vpu->resets)
> + return;
> +
> + ret = reset_control_assert(vpu->resets);
> + if (ret) {
> + dev_warn(vpu->dev, "Failed to assert resets: %d\n", ret);
> + return;
> + }
> +
> + udelay(5);
> +
> + ret = reset_control_deassert(vpu->resets);
> + if (ret)
> + dev_err(vpu->dev, "Failed to deassert resets: %d\n", ret);
> +}
[Severity: High]
Can concurrent IOMMU MMIO accesses race with asserting vpu->resets on
RK3588?
On RK3588, the VEPU121 encoder cores share their AHB/AXI reset lines with
the paired Rockchip IOMMU. When hantro_watchdog() runs, the timed-out job
still holds the runtime PM reference on vpu->dev (and via the device link
on iommu->dev), vpu->dev stays attached to its default DMA domain, and
vpu->vpu_mutex is not held.
CPU0 (kworker) CPU1 (other V4L2 context)
hantro_watchdog()
rockchip_vpu2_enc_reset()
rockchip_vpu_enc_hw_reset()
reset_control_assert(...)
VIDIOC_QBUF / VIDIOC_REQBUFS
rk_iommu_map()
rk_iommu_zap_iova()
rk_iommu_zap_lines() <-- MMIO in reset
udelay(5)
reset_control_deassert(...)
rk_iommu_zap_iova() sees pm_runtime_get_if_in_use(iommu->dev) succeed and
writes RK_MMU_ZAP_ONE_LINE while the shared reset is asserted;
rk_iommu_irq() can also read and write IOMMU registers under the same
check. MMIO accesses to a block held in reset can hang the bus or trigger
a fatal SError on RK3588.
[ ... ]
> @@ -476,6 +502,7 @@ static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
> vepu_write(vpu, H1_REG_INTERRUPT_DIS_BIT, H1_REG_INTERRUPT);
> vepu_write(vpu, 0, H1_REG_ENC_CTRL);
> vepu_write(vpu, 0, H1_REG_AXI_CTRL);
> + rockchip_vpu_enc_hw_reset(vpu);
> /* Only the interrupt handler writes this register: enable the interrupt again. */
> vepu_write(vpu, 0, H1_REG_INTERRUPT);
> }
[Severity: High]
Can rockchip_vpu1_vepu_irq() access encoder registers while
rockchip_vpu_enc_hw_reset() holds vpu->resets asserted?
hantro_watchdog() runs in workqueue context with interrupts enabled and no
shared lock, and hantro_irq_done() expects the hard IRQ handler to race
with the watchdog around timeout expiration. Writing
H1_REG_INTERRUPT_DIS_BIT is a posted MMIO write and does not stop an
already-pending interrupt or an IRQ handler already running on another CPU.
CPU0 (kworker) CPU1 (<hardirq>)
hantro_watchdog()
rockchip_vpu1_enc_reset()
vepu_write(..., DIS_BIT)
rockchip_vpu_enc_hw_reset()
reset_control_assert(...)
rockchip_vpu1_vepu_irq()
vepu_read(..., H1_REG_INTERRUPT)
<-- MMIO in reset
udelay(5)
reset_control_deassert(...)
The same race applies to rockchip_vpu2_enc_reset() and
rockchip_vpu2_vepu_irq(). MMIO accesses while the AHB/AXI reset lines are
asserted can hang the bus or trigger a fatal SError on Rockchip SoCs such
as RK3588; disabling or synchronizing the encoder IRQ before asserting
vpu->resets would avoid this.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261206-hantro-robust-v4-0-b99d33a5ec6d@gmail.com?part=8
^ permalink raw reply [flat|nested] 63+ messages in thread
* [PATCH v4 09/18] media: verisilicon: Reinitialize the IOMMU after resetting an encoder core
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
A Rockchip encoder core that faulted on an unmapped IOVA leaves its
IOMMU with the fault pending, and the reset pulse of the previous patch
can reset the IOMMU behind its driver. The IOMMU is only reprogrammed
on runtime resume, which doesn't happen between back-to-back jobs.
Do like rkvdec: allocate an empty paging domain at probe and, after the
reset pulse, attach and detach it. The IOMMU driver reprograms the
IOMMU on each domain change, and the default domain keeps its mappings.
Only do this for a device with reset lines whose domain is a DMA
domain. If the attach fails, the IOMMU may be left without translation
(rockchip-iommu falls back to its identity domain), so refuse all
further jobs. Also attach and detach it at probe, so that a rebind
repairs the IOMMU after such a failure.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro.h | 5 ++
drivers/media/platform/verisilicon/hantro_drv.c | 69 ++++++++++++++++++++++
drivers/media/platform/verisilicon/hantro_hw.h | 1 +
.../media/platform/verisilicon/rockchip_vpu_hw.c | 6 +-
4 files changed, 80 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/platform/verisilicon/hantro.h
index 1efa032506e1..5a9acc8c82a8 100644
--- a/drivers/media/platform/verisilicon/hantro.h
+++ b/drivers/media/platform/verisilicon/hantro.h
@@ -188,6 +188,9 @@ hantro_vdev_to_func(struct video_device *vdev)
* shared with interrupt handlers.
* @variant: Hardware variant-specific parameters.
* @watchdog_work: Delayed work for hardware timeout handling.
+ * @empty_domain: Empty IOMMU domain, used to reinitialize the IOMMU after
+ * a reset of the core. NULL if not needed.
+ * @iommu_lost: The IOMMU couldn't be reinitialized, no job can run.
*/
struct hantro_dev {
struct v4l2_device v4l2_dev;
@@ -207,6 +210,8 @@ struct hantro_dev {
spinlock_t irqlock;
const struct hantro_variant *variant;
struct delayed_work watchdog_work;
+ struct iommu_domain *empty_domain;
+ bool iommu_lost;
};
/**
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 957ed7a59197..e268858269ff 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -11,6 +11,7 @@
*/
#include <linux/clk.h>
+#include <linux/iommu.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
@@ -113,6 +114,31 @@ void hantro_irq_done(struct hantro_dev *vpu,
}
}
+/*
+ * Pulsing the reset lines of a core can reset its IOMMU behind the IOMMU
+ * driver. Attaching and detaching the empty domain makes the driver reprogram
+ * it; the default domain keeps its mappings. A failed attach may leave the
+ * IOMMU without translation, so no further job may run.
+ */
+int hantro_iommu_restore(struct hantro_dev *vpu)
+{
+ int ret;
+
+ if (!vpu->empty_domain)
+ return 0;
+
+ ret = iommu_attach_device(vpu->empty_domain, vpu->dev);
+ if (ret) {
+ dev_err(vpu->dev, "Failed to reinitialize the IOMMU (%d), refusing further jobs\n",
+ ret);
+ vpu->iommu_lost = true;
+ return ret;
+ }
+
+ iommu_detach_device(vpu->empty_domain, vpu->dev);
+ return 0;
+}
+
void hantro_watchdog(struct work_struct *work)
{
struct hantro_dev *vpu;
@@ -204,6 +230,9 @@ static void device_run(void *priv)
v4l2_m2m_buf_copy_metadata(src, dst);
+ if (unlikely(vpu->iommu_lost))
+ goto err_cancel_job;
+
ret = pm_runtime_resume_and_get(vpu->dev);
if (ret < 0)
goto err_cancel_job;
@@ -1121,6 +1150,42 @@ static void hantro_disable_runtime_pm(struct hantro_dev *vpu)
}
}
+static void hantro_free_empty_domain(void *data)
+{
+ iommu_domain_free(data);
+}
+
+static int hantro_alloc_empty_domain(struct hantro_dev *vpu)
+{
+ struct iommu_domain *domain;
+ int ret;
+
+ /*
+ * Only needed if the core can be reset, and only possible with a DMA
+ * domain to return to.
+ */
+ if (!vpu->resets)
+ return 0;
+
+ domain = iommu_get_domain_for_dev(vpu->dev);
+ if (!domain || !iommu_is_dma_domain(domain))
+ return 0;
+
+ domain = iommu_paging_domain_alloc(vpu->dev);
+ if (IS_ERR(domain))
+ return PTR_ERR(domain);
+
+ vpu->empty_domain = domain;
+
+ ret = devm_add_action_or_reset(vpu->dev, hantro_free_empty_domain,
+ domain);
+ if (ret)
+ return ret;
+
+ /* A failed restore before a rebind can have left the IOMMU in bypass. */
+ return hantro_iommu_restore(vpu);
+}
+
static int hantro_probe(struct platform_device *pdev)
{
struct hantro_dev *vpu;
@@ -1172,6 +1237,10 @@ static int hantro_probe(struct platform_device *pdev)
if (IS_ERR(vpu->resets))
return PTR_ERR(vpu->resets);
+ ret = hantro_alloc_empty_domain(vpu);
+ if (ret)
+ return ret;
+
vpu->reg_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(vpu->reg_base))
return PTR_ERR(vpu->reg_base);
diff --git a/drivers/media/platform/verisilicon/hantro_hw.h b/drivers/media/platform/verisilicon/hantro_hw.h
index 2d12e605cb55..d3c36948208d 100644
--- a/drivers/media/platform/verisilicon/hantro_hw.h
+++ b/drivers/media/platform/verisilicon/hantro_hw.h
@@ -431,6 +431,7 @@ extern const struct hantro_postproc_ops rockchip_vpu981_postproc_ops;
extern const u32 hantro_vp8_dec_mc_filter[8][6];
void hantro_watchdog(struct work_struct *work);
+int hantro_iommu_restore(struct hantro_dev *vpu);
void hantro_irq_done(struct hantro_dev *vpu,
enum vb2_buffer_state result);
void hantro_start_prepare_run(struct hantro_ctx *ctx);
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index 2ec25d6dac86..02fcd74e5ee0 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -491,8 +491,12 @@ static void rockchip_vpu_enc_hw_reset(struct hantro_dev *vpu)
udelay(5);
ret = reset_control_deassert(vpu->resets);
- if (ret)
+ if (ret) {
dev_err(vpu->dev, "Failed to deassert resets: %d\n", ret);
+ return;
+ }
+
+ hantro_iommu_restore(vpu);
}
static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 09/18] media: verisilicon: Reinitialize the IOMMU after resetting an encoder core
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
A Rockchip encoder core that faulted on an unmapped IOVA leaves its
IOMMU with the fault pending, and the reset pulse of the previous patch
can reset the IOMMU behind its driver. The IOMMU is only reprogrammed
on runtime resume, which doesn't happen between back-to-back jobs.
Do like rkvdec: allocate an empty paging domain at probe and, after the
reset pulse, attach and detach it. The IOMMU driver reprograms the
IOMMU on each domain change, and the default domain keeps its mappings.
Only do this for a device with reset lines whose domain is a DMA
domain. If the attach fails, the IOMMU may be left without translation
(rockchip-iommu falls back to its identity domain), so refuse all
further jobs. Also attach and detach it at probe, so that a rebind
repairs the IOMMU after such a failure.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro.h | 5 ++
drivers/media/platform/verisilicon/hantro_drv.c | 69 ++++++++++++++++++++++
drivers/media/platform/verisilicon/hantro_hw.h | 1 +
.../media/platform/verisilicon/rockchip_vpu_hw.c | 6 +-
4 files changed, 80 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/platform/verisilicon/hantro.h
index 1efa032506e1..5a9acc8c82a8 100644
--- a/drivers/media/platform/verisilicon/hantro.h
+++ b/drivers/media/platform/verisilicon/hantro.h
@@ -188,6 +188,9 @@ hantro_vdev_to_func(struct video_device *vdev)
* shared with interrupt handlers.
* @variant: Hardware variant-specific parameters.
* @watchdog_work: Delayed work for hardware timeout handling.
+ * @empty_domain: Empty IOMMU domain, used to reinitialize the IOMMU after
+ * a reset of the core. NULL if not needed.
+ * @iommu_lost: The IOMMU couldn't be reinitialized, no job can run.
*/
struct hantro_dev {
struct v4l2_device v4l2_dev;
@@ -207,6 +210,8 @@ struct hantro_dev {
spinlock_t irqlock;
const struct hantro_variant *variant;
struct delayed_work watchdog_work;
+ struct iommu_domain *empty_domain;
+ bool iommu_lost;
};
/**
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 957ed7a59197..e268858269ff 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -11,6 +11,7 @@
*/
#include <linux/clk.h>
+#include <linux/iommu.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
@@ -113,6 +114,31 @@ void hantro_irq_done(struct hantro_dev *vpu,
}
}
+/*
+ * Pulsing the reset lines of a core can reset its IOMMU behind the IOMMU
+ * driver. Attaching and detaching the empty domain makes the driver reprogram
+ * it; the default domain keeps its mappings. A failed attach may leave the
+ * IOMMU without translation, so no further job may run.
+ */
+int hantro_iommu_restore(struct hantro_dev *vpu)
+{
+ int ret;
+
+ if (!vpu->empty_domain)
+ return 0;
+
+ ret = iommu_attach_device(vpu->empty_domain, vpu->dev);
+ if (ret) {
+ dev_err(vpu->dev, "Failed to reinitialize the IOMMU (%d), refusing further jobs\n",
+ ret);
+ vpu->iommu_lost = true;
+ return ret;
+ }
+
+ iommu_detach_device(vpu->empty_domain, vpu->dev);
+ return 0;
+}
+
void hantro_watchdog(struct work_struct *work)
{
struct hantro_dev *vpu;
@@ -204,6 +230,9 @@ static void device_run(void *priv)
v4l2_m2m_buf_copy_metadata(src, dst);
+ if (unlikely(vpu->iommu_lost))
+ goto err_cancel_job;
+
ret = pm_runtime_resume_and_get(vpu->dev);
if (ret < 0)
goto err_cancel_job;
@@ -1121,6 +1150,42 @@ static void hantro_disable_runtime_pm(struct hantro_dev *vpu)
}
}
+static void hantro_free_empty_domain(void *data)
+{
+ iommu_domain_free(data);
+}
+
+static int hantro_alloc_empty_domain(struct hantro_dev *vpu)
+{
+ struct iommu_domain *domain;
+ int ret;
+
+ /*
+ * Only needed if the core can be reset, and only possible with a DMA
+ * domain to return to.
+ */
+ if (!vpu->resets)
+ return 0;
+
+ domain = iommu_get_domain_for_dev(vpu->dev);
+ if (!domain || !iommu_is_dma_domain(domain))
+ return 0;
+
+ domain = iommu_paging_domain_alloc(vpu->dev);
+ if (IS_ERR(domain))
+ return PTR_ERR(domain);
+
+ vpu->empty_domain = domain;
+
+ ret = devm_add_action_or_reset(vpu->dev, hantro_free_empty_domain,
+ domain);
+ if (ret)
+ return ret;
+
+ /* A failed restore before a rebind can have left the IOMMU in bypass. */
+ return hantro_iommu_restore(vpu);
+}
+
static int hantro_probe(struct platform_device *pdev)
{
struct hantro_dev *vpu;
@@ -1172,6 +1237,10 @@ static int hantro_probe(struct platform_device *pdev)
if (IS_ERR(vpu->resets))
return PTR_ERR(vpu->resets);
+ ret = hantro_alloc_empty_domain(vpu);
+ if (ret)
+ return ret;
+
vpu->reg_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(vpu->reg_base))
return PTR_ERR(vpu->reg_base);
diff --git a/drivers/media/platform/verisilicon/hantro_hw.h b/drivers/media/platform/verisilicon/hantro_hw.h
index 2d12e605cb55..d3c36948208d 100644
--- a/drivers/media/platform/verisilicon/hantro_hw.h
+++ b/drivers/media/platform/verisilicon/hantro_hw.h
@@ -431,6 +431,7 @@ extern const struct hantro_postproc_ops rockchip_vpu981_postproc_ops;
extern const u32 hantro_vp8_dec_mc_filter[8][6];
void hantro_watchdog(struct work_struct *work);
+int hantro_iommu_restore(struct hantro_dev *vpu);
void hantro_irq_done(struct hantro_dev *vpu,
enum vb2_buffer_state result);
void hantro_start_prepare_run(struct hantro_ctx *ctx);
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index 2ec25d6dac86..02fcd74e5ee0 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -491,8 +491,12 @@ static void rockchip_vpu_enc_hw_reset(struct hantro_dev *vpu)
udelay(5);
ret = reset_control_deassert(vpu->resets);
- if (ret)
+ if (ret) {
dev_err(vpu->dev, "Failed to deassert resets: %d\n", ret);
+ return;
+ }
+
+ hantro_iommu_restore(vpu);
}
static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 09/18] media: verisilicon: Reinitialize the IOMMU after resetting an encoder core
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
A Rockchip encoder core that faulted on an unmapped IOVA leaves its
IOMMU with the fault pending, and the reset pulse of the previous patch
can reset the IOMMU behind its driver. The IOMMU is only reprogrammed
on runtime resume, which doesn't happen between back-to-back jobs.
Do like rkvdec: allocate an empty paging domain at probe and, after the
reset pulse, attach and detach it. The IOMMU driver reprograms the
IOMMU on each domain change, and the default domain keeps its mappings.
Only do this for a device with reset lines whose domain is a DMA
domain. If the attach fails, the IOMMU may be left without translation
(rockchip-iommu falls back to its identity domain), so refuse all
further jobs. Also attach and detach it at probe, so that a rebind
repairs the IOMMU after such a failure.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro.h | 5 ++
drivers/media/platform/verisilicon/hantro_drv.c | 69 ++++++++++++++++++++++
drivers/media/platform/verisilicon/hantro_hw.h | 1 +
.../media/platform/verisilicon/rockchip_vpu_hw.c | 6 +-
4 files changed, 80 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/platform/verisilicon/hantro.h
index 1efa032506e1..5a9acc8c82a8 100644
--- a/drivers/media/platform/verisilicon/hantro.h
+++ b/drivers/media/platform/verisilicon/hantro.h
@@ -188,6 +188,9 @@ hantro_vdev_to_func(struct video_device *vdev)
* shared with interrupt handlers.
* @variant: Hardware variant-specific parameters.
* @watchdog_work: Delayed work for hardware timeout handling.
+ * @empty_domain: Empty IOMMU domain, used to reinitialize the IOMMU after
+ * a reset of the core. NULL if not needed.
+ * @iommu_lost: The IOMMU couldn't be reinitialized, no job can run.
*/
struct hantro_dev {
struct v4l2_device v4l2_dev;
@@ -207,6 +210,8 @@ struct hantro_dev {
spinlock_t irqlock;
const struct hantro_variant *variant;
struct delayed_work watchdog_work;
+ struct iommu_domain *empty_domain;
+ bool iommu_lost;
};
/**
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 957ed7a59197..e268858269ff 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -11,6 +11,7 @@
*/
#include <linux/clk.h>
+#include <linux/iommu.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
@@ -113,6 +114,31 @@ void hantro_irq_done(struct hantro_dev *vpu,
}
}
+/*
+ * Pulsing the reset lines of a core can reset its IOMMU behind the IOMMU
+ * driver. Attaching and detaching the empty domain makes the driver reprogram
+ * it; the default domain keeps its mappings. A failed attach may leave the
+ * IOMMU without translation, so no further job may run.
+ */
+int hantro_iommu_restore(struct hantro_dev *vpu)
+{
+ int ret;
+
+ if (!vpu->empty_domain)
+ return 0;
+
+ ret = iommu_attach_device(vpu->empty_domain, vpu->dev);
+ if (ret) {
+ dev_err(vpu->dev, "Failed to reinitialize the IOMMU (%d), refusing further jobs\n",
+ ret);
+ vpu->iommu_lost = true;
+ return ret;
+ }
+
+ iommu_detach_device(vpu->empty_domain, vpu->dev);
+ return 0;
+}
+
void hantro_watchdog(struct work_struct *work)
{
struct hantro_dev *vpu;
@@ -204,6 +230,9 @@ static void device_run(void *priv)
v4l2_m2m_buf_copy_metadata(src, dst);
+ if (unlikely(vpu->iommu_lost))
+ goto err_cancel_job;
+
ret = pm_runtime_resume_and_get(vpu->dev);
if (ret < 0)
goto err_cancel_job;
@@ -1121,6 +1150,42 @@ static void hantro_disable_runtime_pm(struct hantro_dev *vpu)
}
}
+static void hantro_free_empty_domain(void *data)
+{
+ iommu_domain_free(data);
+}
+
+static int hantro_alloc_empty_domain(struct hantro_dev *vpu)
+{
+ struct iommu_domain *domain;
+ int ret;
+
+ /*
+ * Only needed if the core can be reset, and only possible with a DMA
+ * domain to return to.
+ */
+ if (!vpu->resets)
+ return 0;
+
+ domain = iommu_get_domain_for_dev(vpu->dev);
+ if (!domain || !iommu_is_dma_domain(domain))
+ return 0;
+
+ domain = iommu_paging_domain_alloc(vpu->dev);
+ if (IS_ERR(domain))
+ return PTR_ERR(domain);
+
+ vpu->empty_domain = domain;
+
+ ret = devm_add_action_or_reset(vpu->dev, hantro_free_empty_domain,
+ domain);
+ if (ret)
+ return ret;
+
+ /* A failed restore before a rebind can have left the IOMMU in bypass. */
+ return hantro_iommu_restore(vpu);
+}
+
static int hantro_probe(struct platform_device *pdev)
{
struct hantro_dev *vpu;
@@ -1172,6 +1237,10 @@ static int hantro_probe(struct platform_device *pdev)
if (IS_ERR(vpu->resets))
return PTR_ERR(vpu->resets);
+ ret = hantro_alloc_empty_domain(vpu);
+ if (ret)
+ return ret;
+
vpu->reg_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(vpu->reg_base))
return PTR_ERR(vpu->reg_base);
diff --git a/drivers/media/platform/verisilicon/hantro_hw.h b/drivers/media/platform/verisilicon/hantro_hw.h
index 2d12e605cb55..d3c36948208d 100644
--- a/drivers/media/platform/verisilicon/hantro_hw.h
+++ b/drivers/media/platform/verisilicon/hantro_hw.h
@@ -431,6 +431,7 @@ extern const struct hantro_postproc_ops rockchip_vpu981_postproc_ops;
extern const u32 hantro_vp8_dec_mc_filter[8][6];
void hantro_watchdog(struct work_struct *work);
+int hantro_iommu_restore(struct hantro_dev *vpu);
void hantro_irq_done(struct hantro_dev *vpu,
enum vb2_buffer_state result);
void hantro_start_prepare_run(struct hantro_ctx *ctx);
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index 2ec25d6dac86..02fcd74e5ee0 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -491,8 +491,12 @@ static void rockchip_vpu_enc_hw_reset(struct hantro_dev *vpu)
udelay(5);
ret = reset_control_deassert(vpu->resets);
- if (ret)
+ if (ret) {
dev_err(vpu->dev, "Failed to deassert resets: %d\n", ret);
+ return;
+ }
+
+ hantro_iommu_restore(vpu);
}
static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* Re: [PATCH v4 09/18] media: verisilicon: Reinitialize the IOMMU after resetting an encoder core
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
(?)
@ 2026-12-06 6:21 ` sashiko-bot
-1 siblings, 0 replies; 63+ messages in thread
From: sashiko-bot @ 2026-12-06 6:21 UTC (permalink / raw)
To: Arun Iyengar; +Cc: devicetree, robh, conor+dt, media-ci
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] media: verisilicon: hantro_alloc_empty_domain() breaks
Allwinner H6 probe
- [Medium] media: verisilicon: hantro_iommu_restore() runs before reset
deassert
- [Medium] media: verisilicon: hantro_iommu_restore() misses detach
re-attach error
- [Medium] media: verisilicon: rockchip_vpu_enc_hw_reset() races with
IOMMU TLB zaps
--
commit 073ab73b0d27dc2c08cf79b3863b16efe04c5710
Author: Arun Iyengar <aiyengar1990@gmail.com>
media: verisilicon: Reinitialize the IOMMU after resetting an encoder core
This commit allocates an empty IOMMU paging domain at probe and cycles
through it after a Rockchip encoder reset so the IOMMU driver reprograms
the hardware. If attaching the empty domain fails, further jobs are
refused via vpu->iommu_lost.
> diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
> index 957ed7a59197c..e268858269ff3 100644
> --- a/drivers/media/platform/verisilicon/hantro_drv.c
> +++ b/drivers/media/platform/verisilicon/hantro_drv.c
[ ... ]
> @@ -113,6 +114,31 @@ void hantro_irq_done(struct hantro_dev *vpu,
> }
> }
>
> +/*
> + * Pulsing the reset lines of a core can reset its IOMMU behind the IOMMU
> + * driver. Attaching and detaching the empty domain makes the driver reprogram
> + * it; the default domain keeps its mappings. A failed attach may leave the
> + * IOMMU without translation, so no further job may run.
> + */
> +int hantro_iommu_restore(struct hantro_dev *vpu)
> +{
> + int ret;
> +
> + if (!vpu->empty_domain)
> + return 0;
> +
> + ret = iommu_attach_device(vpu->empty_domain, vpu->dev);
> + if (ret) {
> + dev_err(vpu->dev, "Failed to reinitialize the IOMMU (%d), refusing further jobs\n",
> + ret);
> + vpu->iommu_lost = true;
> + return ret;
> + }
> +
> + iommu_detach_device(vpu->empty_domain, vpu->dev);
> + return 0;
> +}
[Severity: Medium]
Can iommu_detach_device() silently leave the IOMMU in bypass mode without
setting vpu->iommu_lost?
iommu_detach_device() returns void and re-attaches the default DMA domain
via __iommu_group_set_domain_nofail() -> rk_iommu_attach_device(). If
rk_iommu_enable() fails on that re-attach, rockchip-iommu reverts
iommu->domain to rk_identity_domain and __iommu_group_set_domain_nofail()
only logs a WARN_ON and discards the error.
Once reverted to rk_identity_domain, rk_iommu_resume() never re-enables
paging. With vpu->iommu_lost still false, subsequent VPU jobs continue
issuing DMA using IOVAs as raw physical addresses.
[ ... ]
> @@ -1121,6 +1150,42 @@ static void hantro_disable_runtime_pm(struct hantro_dev *vpu)
> }
> }
>
> +static void hantro_free_empty_domain(void *data)
> +{
> + iommu_domain_free(data);
> +}
> +
> +static int hantro_alloc_empty_domain(struct hantro_dev *vpu)
> +{
> + struct iommu_domain *domain;
> + int ret;
> +
> + /*
> + * Only needed if the core can be reset, and only possible with a DMA
> + * domain to return to.
> + */
> + if (!vpu->resets)
> + return 0;
> +
> + domain = iommu_get_domain_for_dev(vpu->dev);
> + if (!domain || !iommu_is_dma_domain(domain))
> + return 0;
> +
> + domain = iommu_paging_domain_alloc(vpu->dev);
> + if (IS_ERR(domain))
> + return PTR_ERR(domain);
> +
> + vpu->empty_domain = domain;
> +
> + ret = devm_add_action_or_reset(vpu->dev, hantro_free_empty_domain,
> + domain);
> + if (ret)
> + return ret;
> +
> + /* A failed restore before a rebind can have left the IOMMU in bypass. */
> + return hantro_iommu_restore(vpu);
> +}
[Severity: High]
Does hantro_alloc_empty_domain() break hantro_probe() on Allwinner H6?
In sun50i-h6.dtsi, video-codec-g2 has both resets and iommus = <&iommu 5>,
sharing sun50i-iommu with mixer0 and video-codec. Because sun50i-iommu
uses generic_single_device_group, iommu_attach_device() fails with -EINVAL
on the multi-device group and aborts probe.
Even if the VPU were alone in the group, sun50i-iommu initializes
sun50i_domain->refcnt to 1 and never drops it to 0 on detach, leaking DMA
mappings and clock enable counts. Since sunxi_vpu_reset() never calls
hantro_iommu_restore(), this should only run on variants that use it.
> @@ -1172,6 +1237,10 @@ static int hantro_probe(struct platform_device *pdev)
> if (IS_ERR(vpu->resets))
> return PTR_ERR(vpu->resets);
>
> + ret = hantro_alloc_empty_domain(vpu);
> + if (ret)
> + return ret;
> +
> vpu->reg_base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(vpu->reg_base))
> return PTR_ERR(vpu->reg_base);
[Severity: Medium]
Can hantro_alloc_empty_domain() touch IOMMU registers while shared reset
lines are still asserted?
reset_control_deassert(vpu->resets) does not run until much later in
hantro_probe(). On platforms whose VPU bus-interface resets also reset
the IOMMU (such as RK3588 AV1 with vsi-iommu, or RK3588 VEPU121 on rebind
after a failed reset deassert), hantro_iommu_restore() can issue IOMMU
MMIO writes while the hardware is still in reset.
On vsi-iommu, vsi_iommu_attach_device() unconditionally resumes the IOMMU
and writes VSI_MMU_FLUSH_BASE, which can cause an SError panic; on an
active rockchip-iommu, rk_iommu_enable() can stall or time out and fail
probe. Moving this call after reset_control_deassert() avoids the hazard.
[ ... ]
> diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
> index 2ec25d6dac866..02fcd74e5ee0b 100644
> --- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
> +++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
> @@ -491,8 +491,12 @@ static void rockchip_vpu_enc_hw_reset(struct hantro_dev *vpu)
> udelay(5);
>
> ret = reset_control_deassert(vpu->resets);
> - if (ret)
> + if (ret) {
> dev_err(vpu->dev, "Failed to deassert resets: %d\n", ret);
> + return;
> + }
> +
> + hantro_iommu_restore(vpu);
> }
[Severity: Medium]
Can rockchip_vpu_enc_hw_reset() race with concurrent IOMMU TLB zaps while
vpu->resets is asserted?
hantro_watchdog() runs without vpu->vpu_mutex while the timed-out job
still holds the runtime PM reference keeping the linked IOMMU active.
While the IOMMU stays attached to the default DMA domain, another V4L2
context freeing or mapping buffers can zap TLBs during the reset:
CPU0 (hantro_watchdog) CPU1 (other V4L2 context)
rockchip_vpu_enc_hw_reset()
reset_control_assert(vpu->resets)
vb2_dc_put() -> dma_free_attrs()
rk_iommu_unmap() -> rk_iommu_zap_iova()
pm_runtime_get_if_in_use(iommu->dev)
rk_iommu_zap_lines()
writel(..., RK_MMU_ZAP_ONE_LINE)
<-- MMIO while IOMMU in reset
udelay(5)
reset_control_deassert(vpu->resets)
hantro_iommu_restore(vpu)
On SoCs where vpu->resets also resets the co-located IOMMU bus interface
(such as RK3588 VEPU121), an MMIO write during reset can trigger an
unrecoverable SError panic or hang the IOMMU.
Additionally, when hantro_iommu_restore() re-attaches the default domain,
rk_iommu_attach_device() adds iommu->node back to rk_domain->iommus before
rk_iommu_enable() finishes, exposing rk_iommu_force_reset() and DTE
programming to concurrent zaps as well.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261206-hantro-robust-v4-0-b99d33a5ec6d@gmail.com?part=9
^ permalink raw reply [flat|nested] 63+ messages in thread
* [PATCH v4 10/18] media: verisilicon: Acquire the reset lines only while using them
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
The RK3588 AV1 IOMMU has no reset lines of its own: it shares the four
AV1 resets with the decoder. Get them as released exclusive controls and
acquire them only around their use, so that the IOMMU driver can
deassert them too.
Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 10 ++++++++--
drivers/media/platform/verisilicon/rockchip_vpu_hw.c | 12 ++++++++++--
drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c | 4 ++++
drivers/media/platform/verisilicon/sunxi_vpu_hw.c | 4 ++++
4 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index e268858269ff..26b273cd339d 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -1233,7 +1233,9 @@ static int hantro_probe(struct platform_device *pdev)
return PTR_ERR(vpu->clocks[0].clk);
}
- vpu->resets = devm_reset_control_array_get_optional_exclusive(&pdev->dev);
+ /* Released: the IOMMU of a core can share its reset lines. */
+ vpu->resets = devm_reset_control_array_get(&pdev->dev,
+ RESET_CONTROL_OPTIONAL_EXCLUSIVE_RELEASED);
if (IS_ERR(vpu->resets))
return PTR_ERR(vpu->resets);
@@ -1309,7 +1311,11 @@ static int hantro_probe(struct platform_device *pdev)
pm_runtime_use_autosuspend(vpu->dev);
pm_runtime_enable(vpu->dev);
- ret = reset_control_deassert(vpu->resets);
+ ret = reset_control_acquire(vpu->resets);
+ if (!ret) {
+ ret = reset_control_deassert(vpu->resets);
+ reset_control_release(vpu->resets);
+ }
if (ret) {
dev_err(&pdev->dev, "Failed to deassert resets\n");
goto err_pm_disable;
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index 02fcd74e5ee0..f04d3cc0c1a8 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -482,10 +482,16 @@ static void rockchip_vpu_enc_hw_reset(struct hantro_dev *vpu)
if (!vpu->resets)
return;
+ ret = reset_control_acquire(vpu->resets);
+ if (ret) {
+ dev_warn(vpu->dev, "Failed to acquire resets: %d\n", ret);
+ return;
+ }
+
ret = reset_control_assert(vpu->resets);
if (ret) {
dev_warn(vpu->dev, "Failed to assert resets: %d\n", ret);
- return;
+ goto release;
}
udelay(5);
@@ -493,10 +499,12 @@ static void rockchip_vpu_enc_hw_reset(struct hantro_dev *vpu)
ret = reset_control_deassert(vpu->resets);
if (ret) {
dev_err(vpu->dev, "Failed to deassert resets: %d\n", ret);
- return;
+ goto release;
}
hantro_iommu_restore(vpu);
+release:
+ reset_control_release(vpu->resets);
}
static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
diff --git a/drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c b/drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c
index 833821120b20..a16c43bdeb24 100644
--- a/drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c
@@ -115,7 +115,11 @@ static void stm32mp25_venc_reset(struct hantro_ctx *ctx)
{
struct hantro_dev *vpu = ctx->dev;
+ if (reset_control_acquire(vpu->resets))
+ return;
+
reset_control_reset(vpu->resets);
+ reset_control_release(vpu->resets);
}
/*
diff --git a/drivers/media/platform/verisilicon/sunxi_vpu_hw.c b/drivers/media/platform/verisilicon/sunxi_vpu_hw.c
index 02ce8b064a8f..f15ead62dc96 100644
--- a/drivers/media/platform/verisilicon/sunxi_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/sunxi_vpu_hw.c
@@ -91,7 +91,11 @@ static void sunxi_vpu_reset(struct hantro_ctx *ctx)
{
struct hantro_dev *vpu = ctx->dev;
+ if (reset_control_acquire(vpu->resets))
+ return;
+
reset_control_reset(vpu->resets);
+ reset_control_release(vpu->resets);
}
static const struct hantro_codec_ops sunxi_vpu_codec_ops[] = {
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 10/18] media: verisilicon: Acquire the reset lines only while using them
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
The RK3588 AV1 IOMMU has no reset lines of its own: it shares the four
AV1 resets with the decoder. Get them as released exclusive controls and
acquire them only around their use, so that the IOMMU driver can
deassert them too.
Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 10 ++++++++--
drivers/media/platform/verisilicon/rockchip_vpu_hw.c | 12 ++++++++++--
drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c | 4 ++++
drivers/media/platform/verisilicon/sunxi_vpu_hw.c | 4 ++++
4 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index e268858269ff..26b273cd339d 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -1233,7 +1233,9 @@ static int hantro_probe(struct platform_device *pdev)
return PTR_ERR(vpu->clocks[0].clk);
}
- vpu->resets = devm_reset_control_array_get_optional_exclusive(&pdev->dev);
+ /* Released: the IOMMU of a core can share its reset lines. */
+ vpu->resets = devm_reset_control_array_get(&pdev->dev,
+ RESET_CONTROL_OPTIONAL_EXCLUSIVE_RELEASED);
if (IS_ERR(vpu->resets))
return PTR_ERR(vpu->resets);
@@ -1309,7 +1311,11 @@ static int hantro_probe(struct platform_device *pdev)
pm_runtime_use_autosuspend(vpu->dev);
pm_runtime_enable(vpu->dev);
- ret = reset_control_deassert(vpu->resets);
+ ret = reset_control_acquire(vpu->resets);
+ if (!ret) {
+ ret = reset_control_deassert(vpu->resets);
+ reset_control_release(vpu->resets);
+ }
if (ret) {
dev_err(&pdev->dev, "Failed to deassert resets\n");
goto err_pm_disable;
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index 02fcd74e5ee0..f04d3cc0c1a8 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -482,10 +482,16 @@ static void rockchip_vpu_enc_hw_reset(struct hantro_dev *vpu)
if (!vpu->resets)
return;
+ ret = reset_control_acquire(vpu->resets);
+ if (ret) {
+ dev_warn(vpu->dev, "Failed to acquire resets: %d\n", ret);
+ return;
+ }
+
ret = reset_control_assert(vpu->resets);
if (ret) {
dev_warn(vpu->dev, "Failed to assert resets: %d\n", ret);
- return;
+ goto release;
}
udelay(5);
@@ -493,10 +499,12 @@ static void rockchip_vpu_enc_hw_reset(struct hantro_dev *vpu)
ret = reset_control_deassert(vpu->resets);
if (ret) {
dev_err(vpu->dev, "Failed to deassert resets: %d\n", ret);
- return;
+ goto release;
}
hantro_iommu_restore(vpu);
+release:
+ reset_control_release(vpu->resets);
}
static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
diff --git a/drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c b/drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c
index 833821120b20..a16c43bdeb24 100644
--- a/drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c
@@ -115,7 +115,11 @@ static void stm32mp25_venc_reset(struct hantro_ctx *ctx)
{
struct hantro_dev *vpu = ctx->dev;
+ if (reset_control_acquire(vpu->resets))
+ return;
+
reset_control_reset(vpu->resets);
+ reset_control_release(vpu->resets);
}
/*
diff --git a/drivers/media/platform/verisilicon/sunxi_vpu_hw.c b/drivers/media/platform/verisilicon/sunxi_vpu_hw.c
index 02ce8b064a8f..f15ead62dc96 100644
--- a/drivers/media/platform/verisilicon/sunxi_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/sunxi_vpu_hw.c
@@ -91,7 +91,11 @@ static void sunxi_vpu_reset(struct hantro_ctx *ctx)
{
struct hantro_dev *vpu = ctx->dev;
+ if (reset_control_acquire(vpu->resets))
+ return;
+
reset_control_reset(vpu->resets);
+ reset_control_release(vpu->resets);
}
static const struct hantro_codec_ops sunxi_vpu_codec_ops[] = {
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 10/18] media: verisilicon: Acquire the reset lines only while using them
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
The RK3588 AV1 IOMMU has no reset lines of its own: it shares the four
AV1 resets with the decoder. Get them as released exclusive controls and
acquire them only around their use, so that the IOMMU driver can
deassert them too.
Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro_drv.c | 10 ++++++++--
drivers/media/platform/verisilicon/rockchip_vpu_hw.c | 12 ++++++++++--
drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c | 4 ++++
drivers/media/platform/verisilicon/sunxi_vpu_hw.c | 4 ++++
4 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index e268858269ff..26b273cd339d 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -1233,7 +1233,9 @@ static int hantro_probe(struct platform_device *pdev)
return PTR_ERR(vpu->clocks[0].clk);
}
- vpu->resets = devm_reset_control_array_get_optional_exclusive(&pdev->dev);
+ /* Released: the IOMMU of a core can share its reset lines. */
+ vpu->resets = devm_reset_control_array_get(&pdev->dev,
+ RESET_CONTROL_OPTIONAL_EXCLUSIVE_RELEASED);
if (IS_ERR(vpu->resets))
return PTR_ERR(vpu->resets);
@@ -1309,7 +1311,11 @@ static int hantro_probe(struct platform_device *pdev)
pm_runtime_use_autosuspend(vpu->dev);
pm_runtime_enable(vpu->dev);
- ret = reset_control_deassert(vpu->resets);
+ ret = reset_control_acquire(vpu->resets);
+ if (!ret) {
+ ret = reset_control_deassert(vpu->resets);
+ reset_control_release(vpu->resets);
+ }
if (ret) {
dev_err(&pdev->dev, "Failed to deassert resets\n");
goto err_pm_disable;
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index 02fcd74e5ee0..f04d3cc0c1a8 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -482,10 +482,16 @@ static void rockchip_vpu_enc_hw_reset(struct hantro_dev *vpu)
if (!vpu->resets)
return;
+ ret = reset_control_acquire(vpu->resets);
+ if (ret) {
+ dev_warn(vpu->dev, "Failed to acquire resets: %d\n", ret);
+ return;
+ }
+
ret = reset_control_assert(vpu->resets);
if (ret) {
dev_warn(vpu->dev, "Failed to assert resets: %d\n", ret);
- return;
+ goto release;
}
udelay(5);
@@ -493,10 +499,12 @@ static void rockchip_vpu_enc_hw_reset(struct hantro_dev *vpu)
ret = reset_control_deassert(vpu->resets);
if (ret) {
dev_err(vpu->dev, "Failed to deassert resets: %d\n", ret);
- return;
+ goto release;
}
hantro_iommu_restore(vpu);
+release:
+ reset_control_release(vpu->resets);
}
static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
diff --git a/drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c b/drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c
index 833821120b20..a16c43bdeb24 100644
--- a/drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/stm32mp25_vpu_hw.c
@@ -115,7 +115,11 @@ static void stm32mp25_venc_reset(struct hantro_ctx *ctx)
{
struct hantro_dev *vpu = ctx->dev;
+ if (reset_control_acquire(vpu->resets))
+ return;
+
reset_control_reset(vpu->resets);
+ reset_control_release(vpu->resets);
}
/*
diff --git a/drivers/media/platform/verisilicon/sunxi_vpu_hw.c b/drivers/media/platform/verisilicon/sunxi_vpu_hw.c
index 02ce8b064a8f..f15ead62dc96 100644
--- a/drivers/media/platform/verisilicon/sunxi_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/sunxi_vpu_hw.c
@@ -91,7 +91,11 @@ static void sunxi_vpu_reset(struct hantro_ctx *ctx)
{
struct hantro_dev *vpu = ctx->dev;
+ if (reset_control_acquire(vpu->resets))
+ return;
+
reset_control_reset(vpu->resets);
+ reset_control_release(vpu->resets);
}
static const struct hantro_codec_ops sunxi_vpu_codec_ops[] = {
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v4 11/18] dt-bindings: iommu: verisilicon: Add the reset lines
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
The RK3588 AV1 IOMMU is part of the AV1 block and has no reset lines
of its own: the four AV1 resets also cover it. Its registers can't be
accessed while they are asserted. Describe them.
Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml b/Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml
index d3ce9e603b61..70df03102015 100644
--- a/Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml
+++ b/Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml
@@ -41,6 +41,13 @@ properties:
power-domains:
maxItems: 1
+ resets:
+ items:
+ - description: AXI reset line
+ - description: AXI bus interface unit reset line
+ - description: APB reset line
+ - description: APB bus interface unit reset line
+
required:
- compatible
- reg
@@ -55,6 +62,7 @@ examples:
- |
#include <dt-bindings/clock/rockchip,rk3588-cru.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/reset/rockchip,rk3588-cru.h>
bus {
#address-cells = <2>;
@@ -67,5 +75,7 @@ examples:
clocks = <&cru ACLK_AV1>, <&cru PCLK_AV1>;
clock-names = "core", "iface";
#iommu-cells = <0>;
+ resets = <&cru SRST_A_AV1>, <&cru SRST_A_AV1_BIU>,
+ <&cru SRST_P_AV1>, <&cru SRST_P_AV1_BIU>;
};
};
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 11/18] dt-bindings: iommu: verisilicon: Add the reset lines
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
The RK3588 AV1 IOMMU is part of the AV1 block and has no reset lines
of its own: the four AV1 resets also cover it. Its registers can't be
accessed while they are asserted. Describe them.
Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml b/Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml
index d3ce9e603b61..70df03102015 100644
--- a/Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml
+++ b/Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml
@@ -41,6 +41,13 @@ properties:
power-domains:
maxItems: 1
+ resets:
+ items:
+ - description: AXI reset line
+ - description: AXI bus interface unit reset line
+ - description: APB reset line
+ - description: APB bus interface unit reset line
+
required:
- compatible
- reg
@@ -55,6 +62,7 @@ examples:
- |
#include <dt-bindings/clock/rockchip,rk3588-cru.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/reset/rockchip,rk3588-cru.h>
bus {
#address-cells = <2>;
@@ -67,5 +75,7 @@ examples:
clocks = <&cru ACLK_AV1>, <&cru PCLK_AV1>;
clock-names = "core", "iface";
#iommu-cells = <0>;
+ resets = <&cru SRST_A_AV1>, <&cru SRST_A_AV1_BIU>,
+ <&cru SRST_P_AV1>, <&cru SRST_P_AV1_BIU>;
};
};
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 11/18] dt-bindings: iommu: verisilicon: Add the reset lines
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
The RK3588 AV1 IOMMU is part of the AV1 block and has no reset lines
of its own: the four AV1 resets also cover it. Its registers can't be
accessed while they are asserted. Describe them.
Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml b/Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml
index d3ce9e603b61..70df03102015 100644
--- a/Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml
+++ b/Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml
@@ -41,6 +41,13 @@ properties:
power-domains:
maxItems: 1
+ resets:
+ items:
+ - description: AXI reset line
+ - description: AXI bus interface unit reset line
+ - description: APB reset line
+ - description: APB bus interface unit reset line
+
required:
- compatible
- reg
@@ -55,6 +62,7 @@ examples:
- |
#include <dt-bindings/clock/rockchip,rk3588-cru.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/reset/rockchip,rk3588-cru.h>
bus {
#address-cells = <2>;
@@ -67,5 +75,7 @@ examples:
clocks = <&cru ACLK_AV1>, <&cru PCLK_AV1>;
clock-names = "core", "iface";
#iommu-cells = <0>;
+ resets = <&cru SRST_A_AV1>, <&cru SRST_A_AV1_BIU>,
+ <&cru SRST_P_AV1>, <&cru SRST_P_AV1_BIU>;
};
};
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v4 12/18] iommu/vsi: Deassert the reset lines on probe
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
The RK3588 AV1 IOMMU shares its reset lines with the decoder, and its
registers can't be accessed while they are asserted. It writes them on
attach, before the decoder's probe deasserts the resets.
Deassert the resets on probe. They are released exclusive controls,
acquired only for that, so the decoder can still use them.
Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/iommu/vsi-iommu.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/iommu/vsi-iommu.c b/drivers/iommu/vsi-iommu.c
index 5dac20b143a5..a3ec2fe5ecd5 100644
--- a/drivers/iommu/vsi-iommu.c
+++ b/drivers/iommu/vsi-iommu.c
@@ -33,6 +33,7 @@
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
@@ -669,6 +670,7 @@ MODULE_DEVICE_TABLE(of, vsi_iommu_dt_ids);
static int vsi_iommu_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
+ struct reset_control *resets;
struct vsi_iommu *iommu;
int err;
@@ -688,6 +690,20 @@ static int vsi_iommu_probe(struct platform_device *pdev)
if (iommu->num_clocks < 0)
return iommu->num_clocks;
+ /* Shared with the decoder. */
+ resets = devm_reset_control_array_get(dev, RESET_CONTROL_OPTIONAL_EXCLUSIVE_RELEASED);
+ if (IS_ERR(resets))
+ return PTR_ERR(resets);
+
+ err = reset_control_acquire(resets);
+ if (err)
+ return err;
+
+ err = reset_control_deassert(resets);
+ reset_control_release(resets);
+ if (err)
+ return err;
+
err = clk_bulk_prepare(iommu->num_clocks, iommu->clocks);
if (err)
return err;
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 12/18] iommu/vsi: Deassert the reset lines on probe
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
The RK3588 AV1 IOMMU shares its reset lines with the decoder, and its
registers can't be accessed while they are asserted. It writes them on
attach, before the decoder's probe deasserts the resets.
Deassert the resets on probe. They are released exclusive controls,
acquired only for that, so the decoder can still use them.
Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/iommu/vsi-iommu.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/iommu/vsi-iommu.c b/drivers/iommu/vsi-iommu.c
index 5dac20b143a5..a3ec2fe5ecd5 100644
--- a/drivers/iommu/vsi-iommu.c
+++ b/drivers/iommu/vsi-iommu.c
@@ -33,6 +33,7 @@
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
@@ -669,6 +670,7 @@ MODULE_DEVICE_TABLE(of, vsi_iommu_dt_ids);
static int vsi_iommu_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
+ struct reset_control *resets;
struct vsi_iommu *iommu;
int err;
@@ -688,6 +690,20 @@ static int vsi_iommu_probe(struct platform_device *pdev)
if (iommu->num_clocks < 0)
return iommu->num_clocks;
+ /* Shared with the decoder. */
+ resets = devm_reset_control_array_get(dev, RESET_CONTROL_OPTIONAL_EXCLUSIVE_RELEASED);
+ if (IS_ERR(resets))
+ return PTR_ERR(resets);
+
+ err = reset_control_acquire(resets);
+ if (err)
+ return err;
+
+ err = reset_control_deassert(resets);
+ reset_control_release(resets);
+ if (err)
+ return err;
+
err = clk_bulk_prepare(iommu->num_clocks, iommu->clocks);
if (err)
return err;
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 12/18] iommu/vsi: Deassert the reset lines on probe
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
The RK3588 AV1 IOMMU shares its reset lines with the decoder, and its
registers can't be accessed while they are asserted. It writes them on
attach, before the decoder's probe deasserts the resets.
Deassert the resets on probe. They are released exclusive controls,
acquired only for that, so the decoder can still use them.
Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/iommu/vsi-iommu.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/iommu/vsi-iommu.c b/drivers/iommu/vsi-iommu.c
index 5dac20b143a5..a3ec2fe5ecd5 100644
--- a/drivers/iommu/vsi-iommu.c
+++ b/drivers/iommu/vsi-iommu.c
@@ -33,6 +33,7 @@
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
@@ -669,6 +670,7 @@ MODULE_DEVICE_TABLE(of, vsi_iommu_dt_ids);
static int vsi_iommu_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
+ struct reset_control *resets;
struct vsi_iommu *iommu;
int err;
@@ -688,6 +690,20 @@ static int vsi_iommu_probe(struct platform_device *pdev)
if (iommu->num_clocks < 0)
return iommu->num_clocks;
+ /* Shared with the decoder. */
+ resets = devm_reset_control_array_get(dev, RESET_CONTROL_OPTIONAL_EXCLUSIVE_RELEASED);
+ if (IS_ERR(resets))
+ return PTR_ERR(resets);
+
+ err = reset_control_acquire(resets);
+ if (err)
+ return err;
+
+ err = reset_control_deassert(resets);
+ reset_control_release(resets);
+ if (err)
+ return err;
+
err = clk_bulk_prepare(iommu->num_clocks, iommu->clocks);
if (err)
return err;
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v4 13/18] arm64: dts: rockchip: Add the reset lines of the RK3588 VEPU121 cores
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
Describe the AXI and AHB reset lines of the four VEPU121 JPEG encoder
cores, so that the driver can reset a core that is stuck after a fault
of its IOMMU.
The IOMMU of each core sits in the same register block and is clocked
by the same clocks, so these resets likely cover its bus interface as
well. This relies on the driver not leaving the VPU in reset after
remove ("media: verisilicon: Don't hold the VPU in reset after remove").
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index aa69fd3793fd..227465d446a2 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -1325,6 +1325,8 @@ vepu121_0: video-codec@fdba0000 {
clock-names = "aclk", "hclk";
iommus = <&vepu121_0_mmu>;
power-domains = <&power RK3588_PD_VDPU>;
+ resets = <&cru SRST_A_JPEG_ENCODER0>, <&cru SRST_H_JPEG_ENCODER0>;
+ reset-names = "axi", "ahb";
};
vepu121_0_mmu: iommu@fdba0800 {
@@ -1345,6 +1347,8 @@ vepu121_1: video-codec@fdba4000 {
clock-names = "aclk", "hclk";
iommus = <&vepu121_1_mmu>;
power-domains = <&power RK3588_PD_VDPU>;
+ resets = <&cru SRST_A_JPEG_ENCODER1>, <&cru SRST_H_JPEG_ENCODER1>;
+ reset-names = "axi", "ahb";
};
vepu121_1_mmu: iommu@fdba4800 {
@@ -1365,6 +1369,8 @@ vepu121_2: video-codec@fdba8000 {
clock-names = "aclk", "hclk";
iommus = <&vepu121_2_mmu>;
power-domains = <&power RK3588_PD_VDPU>;
+ resets = <&cru SRST_A_JPEG_ENCODER2>, <&cru SRST_H_JPEG_ENCODER2>;
+ reset-names = "axi", "ahb";
};
vepu121_2_mmu: iommu@fdba8800 {
@@ -1385,6 +1391,8 @@ vepu121_3: video-codec@fdbac000 {
clock-names = "aclk", "hclk";
iommus = <&vepu121_3_mmu>;
power-domains = <&power RK3588_PD_VDPU>;
+ resets = <&cru SRST_A_JPEG_ENCODER3>, <&cru SRST_H_JPEG_ENCODER3>;
+ reset-names = "axi", "ahb";
};
vepu121_3_mmu: iommu@fdbac800 {
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 13/18] arm64: dts: rockchip: Add the reset lines of the RK3588 VEPU121 cores
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
Describe the AXI and AHB reset lines of the four VEPU121 JPEG encoder
cores, so that the driver can reset a core that is stuck after a fault
of its IOMMU.
The IOMMU of each core sits in the same register block and is clocked
by the same clocks, so these resets likely cover its bus interface as
well. This relies on the driver not leaving the VPU in reset after
remove ("media: verisilicon: Don't hold the VPU in reset after remove").
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index aa69fd3793fd..227465d446a2 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -1325,6 +1325,8 @@ vepu121_0: video-codec@fdba0000 {
clock-names = "aclk", "hclk";
iommus = <&vepu121_0_mmu>;
power-domains = <&power RK3588_PD_VDPU>;
+ resets = <&cru SRST_A_JPEG_ENCODER0>, <&cru SRST_H_JPEG_ENCODER0>;
+ reset-names = "axi", "ahb";
};
vepu121_0_mmu: iommu@fdba0800 {
@@ -1345,6 +1347,8 @@ vepu121_1: video-codec@fdba4000 {
clock-names = "aclk", "hclk";
iommus = <&vepu121_1_mmu>;
power-domains = <&power RK3588_PD_VDPU>;
+ resets = <&cru SRST_A_JPEG_ENCODER1>, <&cru SRST_H_JPEG_ENCODER1>;
+ reset-names = "axi", "ahb";
};
vepu121_1_mmu: iommu@fdba4800 {
@@ -1365,6 +1369,8 @@ vepu121_2: video-codec@fdba8000 {
clock-names = "aclk", "hclk";
iommus = <&vepu121_2_mmu>;
power-domains = <&power RK3588_PD_VDPU>;
+ resets = <&cru SRST_A_JPEG_ENCODER2>, <&cru SRST_H_JPEG_ENCODER2>;
+ reset-names = "axi", "ahb";
};
vepu121_2_mmu: iommu@fdba8800 {
@@ -1385,6 +1391,8 @@ vepu121_3: video-codec@fdbac000 {
clock-names = "aclk", "hclk";
iommus = <&vepu121_3_mmu>;
power-domains = <&power RK3588_PD_VDPU>;
+ resets = <&cru SRST_A_JPEG_ENCODER3>, <&cru SRST_H_JPEG_ENCODER3>;
+ reset-names = "axi", "ahb";
};
vepu121_3_mmu: iommu@fdbac800 {
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 13/18] arm64: dts: rockchip: Add the reset lines of the RK3588 VEPU121 cores
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
Describe the AXI and AHB reset lines of the four VEPU121 JPEG encoder
cores, so that the driver can reset a core that is stuck after a fault
of its IOMMU.
The IOMMU of each core sits in the same register block and is clocked
by the same clocks, so these resets likely cover its bus interface as
well. This relies on the driver not leaving the VPU in reset after
remove ("media: verisilicon: Don't hold the VPU in reset after remove").
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index aa69fd3793fd..227465d446a2 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -1325,6 +1325,8 @@ vepu121_0: video-codec@fdba0000 {
clock-names = "aclk", "hclk";
iommus = <&vepu121_0_mmu>;
power-domains = <&power RK3588_PD_VDPU>;
+ resets = <&cru SRST_A_JPEG_ENCODER0>, <&cru SRST_H_JPEG_ENCODER0>;
+ reset-names = "axi", "ahb";
};
vepu121_0_mmu: iommu@fdba0800 {
@@ -1345,6 +1347,8 @@ vepu121_1: video-codec@fdba4000 {
clock-names = "aclk", "hclk";
iommus = <&vepu121_1_mmu>;
power-domains = <&power RK3588_PD_VDPU>;
+ resets = <&cru SRST_A_JPEG_ENCODER1>, <&cru SRST_H_JPEG_ENCODER1>;
+ reset-names = "axi", "ahb";
};
vepu121_1_mmu: iommu@fdba4800 {
@@ -1365,6 +1369,8 @@ vepu121_2: video-codec@fdba8000 {
clock-names = "aclk", "hclk";
iommus = <&vepu121_2_mmu>;
power-domains = <&power RK3588_PD_VDPU>;
+ resets = <&cru SRST_A_JPEG_ENCODER2>, <&cru SRST_H_JPEG_ENCODER2>;
+ reset-names = "axi", "ahb";
};
vepu121_2_mmu: iommu@fdba8800 {
@@ -1385,6 +1391,8 @@ vepu121_3: video-codec@fdbac000 {
clock-names = "aclk", "hclk";
iommus = <&vepu121_3_mmu>;
power-domains = <&power RK3588_PD_VDPU>;
+ resets = <&cru SRST_A_JPEG_ENCODER3>, <&cru SRST_H_JPEG_ENCODER3>;
+ reset-names = "axi", "ahb";
};
vepu121_3_mmu: iommu@fdbac800 {
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* Re: [PATCH v4 13/18] arm64: dts: rockchip: Add the reset lines of the RK3588 VEPU121 cores
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
(?)
@ 2026-12-06 6:26 ` sashiko-bot
-1 siblings, 0 replies; 63+ messages in thread
From: sashiko-bot @ 2026-12-06 6:26 UTC (permalink / raw)
To: Arun Iyengar; +Cc: devicetree, robh, conor+dt, media-ci
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] media: verisilicon: unsynchronized VEPU121 reset races with
IOMMU/IRQ MMIO
- [High] media: verisilicon: unchecked iommu_detach_device() allows
IOMMU bypass
--
commit ff9dbdd5b26a4614c8a544216f4d70394108c463
Author: Arun Iyengar <aiyengar1990@gmail.com>
arm64: dts: rockchip: Add the reset lines of the RK3588 VEPU121 cores
This commit adds the AXI and AHB reset lines to the four VEPU121 JPEG
encoder nodes (vepu121_0 through vepu121_3) in rk3588-base.dtsi.
> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> index aa69fd3793fd6..227465d446a29 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> @@ -1325,6 +1325,8 @@ vepu121_0: video-codec@fdba0000 {
> clock-names = "aclk", "hclk";
> iommus = <&vepu121_0_mmu>;
> power-domains = <&power RK3588_PD_VDPU>;
> + resets = <&cru SRST_A_JPEG_ENCODER0>, <&cru SRST_H_JPEG_ENCODER0>;
> + reset-names = "axi", "ahb";
> };
>
> vepu121_0_mmu: iommu@fdba0800 {
[Severity: High]
Can adding these reset lines trigger an unrecoverable SError panic if
hantro_watchdog() resets a VEPU121 core while concurrent MMIO accesses
are in flight?
Populating resets on vepu121_0 through vepu121_3 activates
rockchip_vpu_enc_hw_reset(), which asserts the shared AXI and AHB resets
while the core and vepu121_x_mmu are still runtime-active. Another V4L2
context mapping or unmapping a buffer can access the IOMMU in that window:
CPU0 (kworker) CPU1 (V4L2 thread)
hantro_watchdog()
rockchip_vpu2_enc_reset()
rockchip_vpu_enc_hw_reset()
reset_control_assert(...)
udelay(5)
rk_iommu_map()
...
rk_iommu_zap_iova()
pm_runtime_get_if_in_use()
rk_iommu_zap_lines() <-- MMIO in reset
reset_control_deassert(...)
rk_iommu_irq() is likewise not quiesced before reset_control_assert(), and
rockchip_vpu2_enc_reset() masks VEPU_REG_INTERRUPT without disable_irq()
or synchronize_irq() against an in-flight rockchip_vpu2_vepu_irq().
MMIO accesses to either block while its bus resets are asserted can cause
an unrecoverable SError panic on RK3588, the same failure mode noted in
commit "media: verisilicon: Don't hold the VPU in reset after remove".
[Severity: High]
Can a failed default-domain re-attach in hantro_iommu_restore() leave
vepu121_x_mmu in bypass mode with vpu->iommu_lost still false?
Enabling resets on vepu121_0 through vepu121_3 activates
hantro_iommu_restore(), which checks iommu_attach_device() for
empty_domain but then calls void iommu_detach_device(). That re-attaches
the default domain through __iommu_group_set_domain_nofail().
Because the CRU reset leaves IOMMU paging disabled, the empty_domain
attach skips stalling in rk_iommu_enable_stall() and enables paging. The
re-attach inside iommu_detach_device() is the first transition that must
stall, reset, and re-enable paging in rk_iommu_attach_device().
If rk_iommu_enable() fails there, rockchip-iommu reverts the device to
rk_identity_domain (paging disabled) while __iommu_group_set_domain_nofail()
only emits a WARN_ON and drops the error.
hantro_iommu_restore() then returns 0 with vpu->iommu_lost still false,
defeating the guard from commit "media: verisilicon: Reinitialize the
IOMMU after resetting an encoder core". Later VEPU121 jobs then issue
untranslated DMA with IOVAs treated as raw physical addresses.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261206-hantro-robust-v4-0-b99d33a5ec6d@gmail.com?part=13
^ permalink raw reply [flat|nested] 63+ messages in thread
* [PATCH v4 14/18] arm64: dts: rockchip: Add the reset lines of the RK3588 AV1 IOMMU
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
The AV1 IOMMU shares the four AV1 resets with the decoder. Describe
them, so that its driver deasserts them before using its registers.
This needs the decoder to get them as released controls ("media:
verisilicon: Acquire the reset lines only while using them").
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index 227465d446a2..96898fefe840 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -1491,6 +1491,8 @@ av1d_mmu: iommu@fdca0000 {
clock-names = "core", "iface";
#iommu-cells = <0>;
power-domains = <&power RK3588_PD_AV1>;
+ resets = <&cru SRST_A_AV1>, <&cru SRST_A_AV1_BIU>,
+ <&cru SRST_P_AV1>, <&cru SRST_P_AV1_BIU>;
};
vicap: video-capture@fdce0000 {
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 14/18] arm64: dts: rockchip: Add the reset lines of the RK3588 AV1 IOMMU
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
The AV1 IOMMU shares the four AV1 resets with the decoder. Describe
them, so that its driver deasserts them before using its registers.
This needs the decoder to get them as released controls ("media:
verisilicon: Acquire the reset lines only while using them").
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index 227465d446a2..96898fefe840 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -1491,6 +1491,8 @@ av1d_mmu: iommu@fdca0000 {
clock-names = "core", "iface";
#iommu-cells = <0>;
power-domains = <&power RK3588_PD_AV1>;
+ resets = <&cru SRST_A_AV1>, <&cru SRST_A_AV1_BIU>,
+ <&cru SRST_P_AV1>, <&cru SRST_P_AV1_BIU>;
};
vicap: video-capture@fdce0000 {
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 14/18] arm64: dts: rockchip: Add the reset lines of the RK3588 AV1 IOMMU
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
The AV1 IOMMU shares the four AV1 resets with the decoder. Describe
them, so that its driver deasserts them before using its registers.
This needs the decoder to get them as released controls ("media:
verisilicon: Acquire the reset lines only while using them").
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index 227465d446a2..96898fefe840 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -1491,6 +1491,8 @@ av1d_mmu: iommu@fdca0000 {
clock-names = "core", "iface";
#iommu-cells = <0>;
power-domains = <&power RK3588_PD_AV1>;
+ resets = <&cru SRST_A_AV1>, <&cru SRST_A_AV1_BIU>,
+ <&cru SRST_P_AV1>, <&cru SRST_P_AV1_BIU>;
};
vicap: video-capture@fdce0000 {
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* Re: [PATCH v4 14/18] arm64: dts: rockchip: Add the reset lines of the RK3588 AV1 IOMMU
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
(?)
@ 2026-12-06 6:21 ` sashiko-bot
-1 siblings, 0 replies; 63+ messages in thread
From: sashiko-bot @ 2026-12-06 6:21 UTC (permalink / raw)
To: Arun Iyengar; +Cc: devicetree, robh, conor+dt, media-ci
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] arm64: dts: rockchip: shared AV1 resets race without EBUSY
deferral in probe
--
commit 3f6ec41e4fd112ee4560a8e6441836d00641d43d
Author: Arun Iyengar <aiyengar1990@gmail.com>
arm64: dts: rockchip: Add the reset lines of the RK3588 AV1 IOMMU
This commit adds the four shared AV1 reset lines to the RK3588 AV1 IOMMU
device tree node.
> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> index 227465d446a29..96898fefe8401 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> @@ -1491,6 +1491,8 @@ av1d_mmu: iommu@fdca0000 {
> clock-names = "core", "iface";
> #iommu-cells = <0>;
> power-domains = <&power RK3588_PD_AV1>;
> + resets = <&cru SRST_A_AV1>, <&cru SRST_A_AV1_BIU>,
> + <&cru SRST_P_AV1>, <&cru SRST_P_AV1_BIU>;
> };
>
> vicap: video-capture@fdce0000 {
[Severity: Medium]
Can sharing these four AV1 resets between av1d_mmu and av1d cause
vsi_iommu_probe() or hantro_probe() to fail permanently with -EBUSY?
Because of_supplier_bindings marks iommus as an optional fw_devlink
supplier, no device link orders av1d behind av1d_mmu by default. Once
deferred_probe_timeout expires (or is 0), of_dma_configure_id() ignores
-ETIMEDOUT from of_iommu_configure() and lets both probes run together:
CPU0 CPU1
vsi_iommu_probe() hantro_probe()
reset_control_acquire(resets)
reset_control_acquire(vpu->resets)
<-- returns -EBUSY, probe fails
reset_control_release(resets)
reset_control_acquire() returns -EBUSY immediately when another consumer
holds the reset, and neither probe retries or returns -EPROBE_DEFER. A
failed av1d_mmu probe also cannot be rebound via sysfs because
rockchip_vsi_iommu_driver sets suppress_bind_attrs.
Should vsi_iommu_probe() and hantro_probe() convert -EBUSY from
reset_control_acquire() to -EPROBE_DEFER (or retry)?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261206-hantro-robust-v4-0-b99d33a5ec6d@gmail.com?part=14
^ permalink raw reply [flat|nested] 63+ messages in thread
* [PATCH v4 15/18] pmdomain: rockchip: Add rockchip_pmu_idle_reset()
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
Randy Li, Caesar Wang and Jeffy Chen posted "soc: rockchip: power-domain:
export idle request" for this in 2017 and 2019; it was not merged.
A device reset during a bus transfer can hang the bus of its domain.
Let drivers reset a device with the bus stopped, as the vendor kernel
does: idle request, reset callback and idle release under the PMU mutex.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/pmdomain/rockchip/pm-domains.c | 52 ++++++++++++++++++++++++++++++++++
include/soc/rockchip/pm_domains.h | 12 ++++++++
2 files changed, 64 insertions(+)
diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
index db3879846db6..5dc1c4c6e211 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -743,6 +743,58 @@ static int rockchip_pd_power_off(struct generic_pm_domain *domain)
return ret;
}
+/**
+ * rockchip_pmu_idle_reset() - Reset a device with the bus of its domain stopped
+ * @dev: device with a single power domain, which must be on
+ * @reset: resets the device; must not access the domain
+ * @data: argument of @reset
+ *
+ * A reset during a bus transfer can hang the bus. The caller must keep the
+ * other devices of the domain off the bus during the call. @reset runs with
+ * the PMU mutex held and must not change the state of a power domain.
+ *
+ * Return: 0, the error of @reset or of enabling the domain clocks, -EINVAL if
+ * @dev does not have exactly one Rockchip power domain, -EIO if the domain is
+ * off, or -ETIMEDOUT if the bus did not stop or restart; its state is then
+ * unknown.
+ */
+int rockchip_pmu_idle_reset(struct device *dev, int (*reset)(void *data),
+ void *data)
+{
+ struct rockchip_pm_domain *pd;
+ struct generic_pm_domain *genpd;
+ int ret, ret2;
+
+ if (!dev->pm_domain)
+ return -EINVAL;
+
+ genpd = pd_to_genpd(dev->pm_domain);
+ if (genpd->power_on != rockchip_pd_power_on)
+ return -EINVAL;
+
+ pd = to_rockchip_pd(genpd);
+ guard(mutex)(&pd->pmu->mutex);
+
+ if (!rockchip_pmu_domain_is_on(pd))
+ return -EIO;
+
+ ret = clk_bulk_enable(pd->num_clks, pd->clks);
+ if (ret)
+ return ret;
+
+ rockchip_pmu_ungate_clk(pd, true);
+ ret = rockchip_pmu_set_idle_request(pd, true);
+ if (!ret)
+ ret = reset(data);
+ ret2 = rockchip_pmu_set_idle_request(pd, false);
+ rockchip_pmu_ungate_clk(pd, false);
+
+ clk_bulk_disable(pd->num_clks, pd->clks);
+
+ return ret2 ?: ret;
+}
+EXPORT_SYMBOL_GPL(rockchip_pmu_idle_reset);
+
static int rockchip_pd_attach_dev(struct generic_pm_domain *genpd,
struct device *dev)
{
diff --git a/include/soc/rockchip/pm_domains.h b/include/soc/rockchip/pm_domains.h
index 7dbd941fc937..e1f488140b12 100644
--- a/include/soc/rockchip/pm_domains.h
+++ b/include/soc/rockchip/pm_domains.h
@@ -6,10 +6,16 @@
#ifndef __SOC_ROCKCHIP_PM_DOMAINS_H__
#define __SOC_ROCKCHIP_PM_DOMAINS_H__
+#include <linux/errno.h>
+
+struct device;
+
#ifdef CONFIG_ROCKCHIP_PM_DOMAINS
int rockchip_pmu_block(void);
void rockchip_pmu_unblock(void);
+int rockchip_pmu_idle_reset(struct device *dev, int (*reset)(void *data),
+ void *data);
#else /* CONFIG_ROCKCHIP_PM_DOMAINS */
@@ -20,6 +26,12 @@ static inline int rockchip_pmu_block(void)
static inline void rockchip_pmu_unblock(void) { }
+static inline int rockchip_pmu_idle_reset(struct device *dev,
+ int (*reset)(void *data), void *data)
+{
+ return -EOPNOTSUPP;
+}
+
#endif /* CONFIG_ROCKCHIP_PM_DOMAINS */
#endif /* __SOC_ROCKCHIP_PM_DOMAINS_H__ */
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 15/18] pmdomain: rockchip: Add rockchip_pmu_idle_reset()
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
Randy Li, Caesar Wang and Jeffy Chen posted "soc: rockchip: power-domain:
export idle request" for this in 2017 and 2019; it was not merged.
A device reset during a bus transfer can hang the bus of its domain.
Let drivers reset a device with the bus stopped, as the vendor kernel
does: idle request, reset callback and idle release under the PMU mutex.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/pmdomain/rockchip/pm-domains.c | 52 ++++++++++++++++++++++++++++++++++
include/soc/rockchip/pm_domains.h | 12 ++++++++
2 files changed, 64 insertions(+)
diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
index db3879846db6..5dc1c4c6e211 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -743,6 +743,58 @@ static int rockchip_pd_power_off(struct generic_pm_domain *domain)
return ret;
}
+/**
+ * rockchip_pmu_idle_reset() - Reset a device with the bus of its domain stopped
+ * @dev: device with a single power domain, which must be on
+ * @reset: resets the device; must not access the domain
+ * @data: argument of @reset
+ *
+ * A reset during a bus transfer can hang the bus. The caller must keep the
+ * other devices of the domain off the bus during the call. @reset runs with
+ * the PMU mutex held and must not change the state of a power domain.
+ *
+ * Return: 0, the error of @reset or of enabling the domain clocks, -EINVAL if
+ * @dev does not have exactly one Rockchip power domain, -EIO if the domain is
+ * off, or -ETIMEDOUT if the bus did not stop or restart; its state is then
+ * unknown.
+ */
+int rockchip_pmu_idle_reset(struct device *dev, int (*reset)(void *data),
+ void *data)
+{
+ struct rockchip_pm_domain *pd;
+ struct generic_pm_domain *genpd;
+ int ret, ret2;
+
+ if (!dev->pm_domain)
+ return -EINVAL;
+
+ genpd = pd_to_genpd(dev->pm_domain);
+ if (genpd->power_on != rockchip_pd_power_on)
+ return -EINVAL;
+
+ pd = to_rockchip_pd(genpd);
+ guard(mutex)(&pd->pmu->mutex);
+
+ if (!rockchip_pmu_domain_is_on(pd))
+ return -EIO;
+
+ ret = clk_bulk_enable(pd->num_clks, pd->clks);
+ if (ret)
+ return ret;
+
+ rockchip_pmu_ungate_clk(pd, true);
+ ret = rockchip_pmu_set_idle_request(pd, true);
+ if (!ret)
+ ret = reset(data);
+ ret2 = rockchip_pmu_set_idle_request(pd, false);
+ rockchip_pmu_ungate_clk(pd, false);
+
+ clk_bulk_disable(pd->num_clks, pd->clks);
+
+ return ret2 ?: ret;
+}
+EXPORT_SYMBOL_GPL(rockchip_pmu_idle_reset);
+
static int rockchip_pd_attach_dev(struct generic_pm_domain *genpd,
struct device *dev)
{
diff --git a/include/soc/rockchip/pm_domains.h b/include/soc/rockchip/pm_domains.h
index 7dbd941fc937..e1f488140b12 100644
--- a/include/soc/rockchip/pm_domains.h
+++ b/include/soc/rockchip/pm_domains.h
@@ -6,10 +6,16 @@
#ifndef __SOC_ROCKCHIP_PM_DOMAINS_H__
#define __SOC_ROCKCHIP_PM_DOMAINS_H__
+#include <linux/errno.h>
+
+struct device;
+
#ifdef CONFIG_ROCKCHIP_PM_DOMAINS
int rockchip_pmu_block(void);
void rockchip_pmu_unblock(void);
+int rockchip_pmu_idle_reset(struct device *dev, int (*reset)(void *data),
+ void *data);
#else /* CONFIG_ROCKCHIP_PM_DOMAINS */
@@ -20,6 +26,12 @@ static inline int rockchip_pmu_block(void)
static inline void rockchip_pmu_unblock(void) { }
+static inline int rockchip_pmu_idle_reset(struct device *dev,
+ int (*reset)(void *data), void *data)
+{
+ return -EOPNOTSUPP;
+}
+
#endif /* CONFIG_ROCKCHIP_PM_DOMAINS */
#endif /* __SOC_ROCKCHIP_PM_DOMAINS_H__ */
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 15/18] pmdomain: rockchip: Add rockchip_pmu_idle_reset()
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
Randy Li, Caesar Wang and Jeffy Chen posted "soc: rockchip: power-domain:
export idle request" for this in 2017 and 2019; it was not merged.
A device reset during a bus transfer can hang the bus of its domain.
Let drivers reset a device with the bus stopped, as the vendor kernel
does: idle request, reset callback and idle release under the PMU mutex.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/pmdomain/rockchip/pm-domains.c | 52 ++++++++++++++++++++++++++++++++++
include/soc/rockchip/pm_domains.h | 12 ++++++++
2 files changed, 64 insertions(+)
diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
index db3879846db6..5dc1c4c6e211 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -743,6 +743,58 @@ static int rockchip_pd_power_off(struct generic_pm_domain *domain)
return ret;
}
+/**
+ * rockchip_pmu_idle_reset() - Reset a device with the bus of its domain stopped
+ * @dev: device with a single power domain, which must be on
+ * @reset: resets the device; must not access the domain
+ * @data: argument of @reset
+ *
+ * A reset during a bus transfer can hang the bus. The caller must keep the
+ * other devices of the domain off the bus during the call. @reset runs with
+ * the PMU mutex held and must not change the state of a power domain.
+ *
+ * Return: 0, the error of @reset or of enabling the domain clocks, -EINVAL if
+ * @dev does not have exactly one Rockchip power domain, -EIO if the domain is
+ * off, or -ETIMEDOUT if the bus did not stop or restart; its state is then
+ * unknown.
+ */
+int rockchip_pmu_idle_reset(struct device *dev, int (*reset)(void *data),
+ void *data)
+{
+ struct rockchip_pm_domain *pd;
+ struct generic_pm_domain *genpd;
+ int ret, ret2;
+
+ if (!dev->pm_domain)
+ return -EINVAL;
+
+ genpd = pd_to_genpd(dev->pm_domain);
+ if (genpd->power_on != rockchip_pd_power_on)
+ return -EINVAL;
+
+ pd = to_rockchip_pd(genpd);
+ guard(mutex)(&pd->pmu->mutex);
+
+ if (!rockchip_pmu_domain_is_on(pd))
+ return -EIO;
+
+ ret = clk_bulk_enable(pd->num_clks, pd->clks);
+ if (ret)
+ return ret;
+
+ rockchip_pmu_ungate_clk(pd, true);
+ ret = rockchip_pmu_set_idle_request(pd, true);
+ if (!ret)
+ ret = reset(data);
+ ret2 = rockchip_pmu_set_idle_request(pd, false);
+ rockchip_pmu_ungate_clk(pd, false);
+
+ clk_bulk_disable(pd->num_clks, pd->clks);
+
+ return ret2 ?: ret;
+}
+EXPORT_SYMBOL_GPL(rockchip_pmu_idle_reset);
+
static int rockchip_pd_attach_dev(struct generic_pm_domain *genpd,
struct device *dev)
{
diff --git a/include/soc/rockchip/pm_domains.h b/include/soc/rockchip/pm_domains.h
index 7dbd941fc937..e1f488140b12 100644
--- a/include/soc/rockchip/pm_domains.h
+++ b/include/soc/rockchip/pm_domains.h
@@ -6,10 +6,16 @@
#ifndef __SOC_ROCKCHIP_PM_DOMAINS_H__
#define __SOC_ROCKCHIP_PM_DOMAINS_H__
+#include <linux/errno.h>
+
+struct device;
+
#ifdef CONFIG_ROCKCHIP_PM_DOMAINS
int rockchip_pmu_block(void);
void rockchip_pmu_unblock(void);
+int rockchip_pmu_idle_reset(struct device *dev, int (*reset)(void *data),
+ void *data);
#else /* CONFIG_ROCKCHIP_PM_DOMAINS */
@@ -20,6 +26,12 @@ static inline int rockchip_pmu_block(void)
static inline void rockchip_pmu_unblock(void) { }
+static inline int rockchip_pmu_idle_reset(struct device *dev,
+ int (*reset)(void *data), void *data)
+{
+ return -EOPNOTSUPP;
+}
+
#endif /* CONFIG_ROCKCHIP_PM_DOMAINS */
#endif /* __SOC_ROCKCHIP_PM_DOMAINS_H__ */
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v4 16/18] dt-bindings: media: rockchip-vpu: Add reset-names
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
The AV1 decoder driver resets only the AXI and APB lines of the core,
not their bus interfaces. Name the lines so it can pick them.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Documentation/devicetree/bindings/media/rockchip-vpu.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml
index 8c2501634080..533ee3eb20d2 100644
--- a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml
+++ b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml
@@ -79,6 +79,13 @@ properties:
- description: APB reset line
- description: APB bus interface unit reset line
+ reset-names:
+ items:
+ - const: axi
+ - const: axi-biu
+ - const: apb
+ - const: apb-biu
+
required:
- compatible
- reg
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 16/18] dt-bindings: media: rockchip-vpu: Add reset-names
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
The AV1 decoder driver resets only the AXI and APB lines of the core,
not their bus interfaces. Name the lines so it can pick them.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Documentation/devicetree/bindings/media/rockchip-vpu.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml
index 8c2501634080..533ee3eb20d2 100644
--- a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml
+++ b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml
@@ -79,6 +79,13 @@ properties:
- description: APB reset line
- description: APB bus interface unit reset line
+ reset-names:
+ items:
+ - const: axi
+ - const: axi-biu
+ - const: apb
+ - const: apb-biu
+
required:
- compatible
- reg
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 16/18] dt-bindings: media: rockchip-vpu: Add reset-names
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
The AV1 decoder driver resets only the AXI and APB lines of the core,
not their bus interfaces. Name the lines so it can pick them.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Documentation/devicetree/bindings/media/rockchip-vpu.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml
index 8c2501634080..533ee3eb20d2 100644
--- a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml
+++ b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml
@@ -79,6 +79,13 @@ properties:
- description: APB reset line
- description: APB bus interface unit reset line
+ reset-names:
+ items:
+ - const: axi
+ - const: axi-biu
+ - const: apb
+ - const: apb-biu
+
required:
- compatible
- reg
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v4 17/18] media: verisilicon: Reset the RK3588 AV1 decoder after an error
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
Nothing resets the AV1 core after an error interrupt, and the frames
after it time out: 50 watchdog timeouts in one AV1 test run.
Reset the core from the watchdog work as the vendor driver does: its AXI
and APB lines only, with the bus of its power domain stopped and its
interrupt masked. A reset of all four lines without the bus stop left
the domain unable to go idle, and an SError followed.
Stop a core still running after a timeout with its abort first, as
hantro_g2_reset() does: a reset during its bus transfers corrupted
memory. If it does not stop, refuse further jobs.
Attach the empty IOMMU domain for the reset, so that unmaps of other
contexts do not write the IOMMU of the stopped bus; the vendor driver
blocks them with a lock. With two decoders, a reset failed to idle the
domain, and a write from an unmap then raised an SError. If the bus
does not stop or restart, keep the empty domain and refuse further
jobs.
Fixes: 003afda97c65 ("media: verisilicon: Enable AV1 decoder on rk3588")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro.h | 7 +-
drivers/media/platform/verisilicon/hantro_drv.c | 51 ++++++++++---
drivers/media/platform/verisilicon/hantro_hw.h | 5 +-
.../platform/verisilicon/rockchip_vpu981_regs.h | 3 +
.../media/platform/verisilicon/rockchip_vpu_hw.c | 86 +++++++++++++++++++++-
5 files changed, 140 insertions(+), 12 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/platform/verisilicon/hantro.h
index 5a9acc8c82a8..2d021c98f085 100644
--- a/drivers/media/platform/verisilicon/hantro.h
+++ b/drivers/media/platform/verisilicon/hantro.h
@@ -180,6 +180,7 @@ hantro_vdev_to_func(struct video_device *vdev)
* dev_ macros.
* @clocks: Array of clock handles.
* @resets: Array of reset handles.
+ * @core_resets: AXI and APB resets of the core, without the bus interfaces.
* @reg_base: Mapped address of VPU registers.
* @enc_base: Mapped address of VPU encoder register for convenience.
* @dec_base: Mapped address of VPU decoder register for convenience.
@@ -190,7 +191,9 @@ hantro_vdev_to_func(struct video_device *vdev)
* @watchdog_work: Delayed work for hardware timeout handling.
* @empty_domain: Empty IOMMU domain, used to reinitialize the IOMMU after
* a reset of the core. NULL if not needed.
- * @iommu_lost: The IOMMU couldn't be reinitialized, no job can run.
+ * @iommu_lost: The IOMMU couldn't be reinitialized, or the bus of the
+ * core hangs: no job can run.
+ * @error_reset: The watchdog was queued by hantro_irq_reset().
*/
struct hantro_dev {
struct v4l2_device v4l2_dev;
@@ -202,6 +205,7 @@ struct hantro_dev {
struct device *dev;
struct clk_bulk_data *clocks;
struct reset_control *resets;
+ struct reset_control_bulk_data core_resets[2];
void __iomem *reg_base;
void __iomem *enc_base;
void __iomem *dec_base;
@@ -212,6 +216,7 @@ struct hantro_dev {
struct delayed_work watchdog_work;
struct iommu_domain *empty_domain;
bool iommu_lost;
+ bool error_reset;
};
/**
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 26b273cd339d..bb611b414e75 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -117,10 +117,12 @@ void hantro_irq_done(struct hantro_dev *vpu,
/*
* Pulsing the reset lines of a core can reset its IOMMU behind the IOMMU
* driver. Attaching and detaching the empty domain makes the driver reprogram
- * it; the default domain keeps its mappings. A failed attach may leave the
- * IOMMU without translation, so no further job may run.
+ * it; the default domain keeps its mappings. While the empty domain is
+ * attached, maps and unmaps of the default domain leave the IOMMU alone. A
+ * failed attach may leave the IOMMU without translation, so no further job may
+ * run.
*/
-int hantro_iommu_restore(struct hantro_dev *vpu)
+int hantro_iommu_park(struct hantro_dev *vpu)
{
int ret;
@@ -132,29 +134,55 @@ int hantro_iommu_restore(struct hantro_dev *vpu)
dev_err(vpu->dev, "Failed to reinitialize the IOMMU (%d), refusing further jobs\n",
ret);
vpu->iommu_lost = true;
- return ret;
}
- iommu_detach_device(vpu->empty_domain, vpu->dev);
- return 0;
+ return ret;
+}
+
+void hantro_iommu_unpark(struct hantro_dev *vpu)
+{
+ if (vpu->empty_domain)
+ iommu_detach_device(vpu->empty_domain, vpu->dev);
+}
+
+int hantro_iommu_restore(struct hantro_dev *vpu)
+{
+ int ret = hantro_iommu_park(vpu);
+
+ if (!ret)
+ hantro_iommu_unpark(vpu);
+ return ret;
}
void hantro_watchdog(struct work_struct *work)
{
struct hantro_dev *vpu;
struct hantro_ctx *ctx;
+ bool error_reset;
vpu = container_of(to_delayed_work(work),
struct hantro_dev, watchdog_work);
+ error_reset = vpu->error_reset;
+ vpu->error_reset = false;
ctx = v4l2_m2m_get_curr_priv(vpu->m2m_dev);
if (ctx) {
- vpu_err("frame processing timed out!\n");
+ if (!error_reset)
+ vpu_err("frame processing timed out!\n");
if (ctx->codec_ops->reset)
ctx->codec_ops->reset(ctx);
hantro_job_finish(ctx, VB2_BUF_STATE_ERROR);
}
}
+/* For a failed job whose core needs a reset: the watchdog work resets it and ends the job. */
+void hantro_irq_reset(struct hantro_dev *vpu)
+{
+ if (cancel_delayed_work(&vpu->watchdog_work)) {
+ vpu->error_reset = true;
+ schedule_delayed_work(&vpu->watchdog_work, 0);
+ }
+}
+
void hantro_start_prepare_run(struct hantro_ctx *ctx)
{
struct vb2_v4l2_buffer *src_buf;
@@ -1152,7 +1180,12 @@ static void hantro_disable_runtime_pm(struct hantro_dev *vpu)
static void hantro_free_empty_domain(void *data)
{
- iommu_domain_free(data);
+ struct hantro_dev *vpu = data;
+
+ /* Still attached after a failed reset */
+ if (iommu_get_domain_for_dev(vpu->dev) == vpu->empty_domain)
+ hantro_iommu_unpark(vpu);
+ iommu_domain_free(vpu->empty_domain);
}
static int hantro_alloc_empty_domain(struct hantro_dev *vpu)
@@ -1178,7 +1211,7 @@ static int hantro_alloc_empty_domain(struct hantro_dev *vpu)
vpu->empty_domain = domain;
ret = devm_add_action_or_reset(vpu->dev, hantro_free_empty_domain,
- domain);
+ vpu);
if (ret)
return ret;
diff --git a/drivers/media/platform/verisilicon/hantro_hw.h b/drivers/media/platform/verisilicon/hantro_hw.h
index d3c36948208d..b63893a17df0 100644
--- a/drivers/media/platform/verisilicon/hantro_hw.h
+++ b/drivers/media/platform/verisilicon/hantro_hw.h
@@ -382,7 +382,7 @@ struct hantro_postproc_ops {
* should be programmed and started. Returns zero if OK, a
* negative value in error cases.
* @done: Read back processing results and additional data from hardware.
- * @reset: Reset the hardware in case of a timeout.
+ * @reset: Reset the hardware in case of a timeout or hantro_irq_reset().
*/
struct hantro_codec_ops {
int (*init)(struct hantro_ctx *ctx);
@@ -431,12 +431,15 @@ extern const struct hantro_postproc_ops rockchip_vpu981_postproc_ops;
extern const u32 hantro_vp8_dec_mc_filter[8][6];
void hantro_watchdog(struct work_struct *work);
+int hantro_iommu_park(struct hantro_dev *vpu);
+void hantro_iommu_unpark(struct hantro_dev *vpu);
int hantro_iommu_restore(struct hantro_dev *vpu);
void hantro_irq_done(struct hantro_dev *vpu,
enum vb2_buffer_state result);
void hantro_start_prepare_run(struct hantro_ctx *ctx);
void hantro_end_prepare_run(struct hantro_ctx *ctx);
void hantro_abort_prepare_run(struct hantro_ctx *ctx);
+void hantro_irq_reset(struct hantro_dev *vpu);
irqreturn_t hantro_g1_irq(int irq, void *dev_id);
void hantro_g1_reset(struct hantro_ctx *ctx);
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h b/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h
index e4008da64f19..b88df093b5e2 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h
+++ b/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h
@@ -21,6 +21,9 @@
#define AV1_REG_INTERRUPT AV1_SWREG(1)
#define AV1_REG_INTERRUPT_DEC_RDY_INT BIT(12)
+#define AV1_REG_INTERRUPT_DEC_ABORT_E BIT(5)
+#define AV1_REG_INTERRUPT_DEC_IRQ_DIS BIT(4)
+#define AV1_REG_INTERRUPT_DEC_E BIT(0)
#define AV1_REG_CONFIG AV1_SWREG(2)
#define AV1_REG_CONFIG_DEC_CLK_GATE_E BIT(10)
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index f04d3cc0c1a8..6bb85ccbf460 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -8,6 +8,9 @@
#include <linux/clk.h>
#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/iopoll.h>
+#include <soc/rockchip/pm_domains.h>
#include "hantro.h"
#include "hantro_av1.h"
@@ -435,11 +438,23 @@ static irqreturn_t rk3588_vpu981_irq(int irq, void *dev_id)
vdpu_write(vpu, 0, AV1_REG_INTERRUPT);
vdpu_write(vpu, AV1_REG_CONFIG_DEC_CLK_GATE_E, AV1_REG_CONFIG);
- hantro_irq_done(vpu, state);
+ if (state == VB2_BUF_STATE_DONE)
+ hantro_irq_done(vpu, state);
+ else
+ hantro_irq_reset(vpu);
return IRQ_HANDLED;
}
+static int rk3588_vpu981_hw_init(struct hantro_dev *vpu)
+{
+ vpu->core_resets[0].id = "axi";
+ vpu->core_resets[1].id = "apb";
+
+ return devm_reset_control_bulk_get_optional_exclusive_released(vpu->dev,
+ ARRAY_SIZE(vpu->core_resets), vpu->core_resets);
+}
+
static int rk3036_vpu_hw_init(struct hantro_dev *vpu)
{
/* Bump ACLK to max. possible freq. to improve performance. */
@@ -540,6 +555,73 @@ static void rockchip_vpu2_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, 0, VEPU_REG_INTERRUPT);
}
+static int rockchip_vpu981_core_reset(void *data)
+{
+ struct hantro_dev *vpu = data;
+ int n = ARRAY_SIZE(vpu->core_resets);
+ int ret;
+
+ ret = reset_control_bulk_assert(n, vpu->core_resets);
+ udelay(5);
+ return reset_control_bulk_deassert(n, vpu->core_resets) ?: ret;
+}
+
+static void rockchip_vpu981_av1_dec_reset(struct hantro_ctx *ctx)
+{
+ struct hantro_dev *vpu = ctx->dev;
+ struct reset_control_bulk_data *rst = vpu->core_resets;
+ int n = ARRAY_SIZE(vpu->core_resets);
+ int irq, ret;
+ u32 status;
+
+ if (!rst[0].rstc)
+ return;
+
+ irq = platform_get_irq(vpu->pdev, 0);
+ if (irq < 0)
+ return;
+
+ ret = reset_control_bulk_acquire(n, rst);
+ if (ret) {
+ dev_err(vpu->dev, "Failed to acquire the core resets: %d\n", ret);
+ return;
+ }
+
+ /* After a timeout, keep the handler off the core and the next job. */
+ disable_irq(irq);
+
+ status = vdpu_read(vpu, AV1_REG_INTERRUPT);
+ if (status & AV1_REG_INTERRUPT_DEC_E) {
+ vdpu_write(vpu, status | AV1_REG_INTERRUPT_DEC_ABORT_E |
+ AV1_REG_INTERRUPT_DEC_IRQ_DIS, AV1_REG_INTERRUPT);
+ if (readl_poll_timeout(vpu->dec_base + AV1_REG_INTERRUPT, status,
+ !(status & AV1_REG_INTERRUPT_DEC_E), 100, 100000)) {
+ dev_err(vpu->dev, "The core does not stop, refusing further jobs\n");
+ hantro_iommu_park(vpu);
+ vpu->iommu_lost = true;
+ goto release;
+ }
+ }
+
+ if (hantro_iommu_park(vpu))
+ goto out;
+
+ ret = rockchip_pmu_idle_reset(vpu->dev, rockchip_vpu981_core_reset, vpu);
+ if (ret) {
+ dev_err(vpu->dev, "Failed to reset the core: %d\n", ret);
+ /* Bus state unknown: keep the IOMMU and the handler off it. */
+ if (ret == -ETIMEDOUT) {
+ vpu->iommu_lost = true;
+ goto release;
+ }
+ }
+ hantro_iommu_unpark(vpu);
+out:
+ enable_irq(irq);
+release:
+ reset_control_bulk_release(n, rst);
+}
+
/*
* Supported codec ops.
*/
@@ -656,6 +738,7 @@ static const struct hantro_codec_ops rk3588_vpu981_codec_ops[] = {
.init = hantro_av1_init,
.exit = hantro_av1_exit,
.done = hantro_av1_update_prob,
+ .reset = rockchip_vpu981_av1_dec_reset,
},
};
/*
@@ -856,6 +939,7 @@ const struct hantro_variant rk3588_vpu981_variant = {
.postproc_ops = &rockchip_vpu981_postproc_ops,
.codec = HANTRO_AV1_DECODER,
.codec_ops = rk3588_vpu981_codec_ops,
+ .init = rk3588_vpu981_hw_init,
.irqs = rk3588_vpu981_irqs,
.num_irqs = ARRAY_SIZE(rk3588_vpu981_irqs),
.clk_names = rk3588_vpu981_vpu_clk_names,
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 17/18] media: verisilicon: Reset the RK3588 AV1 decoder after an error
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
Nothing resets the AV1 core after an error interrupt, and the frames
after it time out: 50 watchdog timeouts in one AV1 test run.
Reset the core from the watchdog work as the vendor driver does: its AXI
and APB lines only, with the bus of its power domain stopped and its
interrupt masked. A reset of all four lines without the bus stop left
the domain unable to go idle, and an SError followed.
Stop a core still running after a timeout with its abort first, as
hantro_g2_reset() does: a reset during its bus transfers corrupted
memory. If it does not stop, refuse further jobs.
Attach the empty IOMMU domain for the reset, so that unmaps of other
contexts do not write the IOMMU of the stopped bus; the vendor driver
blocks them with a lock. With two decoders, a reset failed to idle the
domain, and a write from an unmap then raised an SError. If the bus
does not stop or restart, keep the empty domain and refuse further
jobs.
Fixes: 003afda97c65 ("media: verisilicon: Enable AV1 decoder on rk3588")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro.h | 7 +-
drivers/media/platform/verisilicon/hantro_drv.c | 51 ++++++++++---
drivers/media/platform/verisilicon/hantro_hw.h | 5 +-
.../platform/verisilicon/rockchip_vpu981_regs.h | 3 +
.../media/platform/verisilicon/rockchip_vpu_hw.c | 86 +++++++++++++++++++++-
5 files changed, 140 insertions(+), 12 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/platform/verisilicon/hantro.h
index 5a9acc8c82a8..2d021c98f085 100644
--- a/drivers/media/platform/verisilicon/hantro.h
+++ b/drivers/media/platform/verisilicon/hantro.h
@@ -180,6 +180,7 @@ hantro_vdev_to_func(struct video_device *vdev)
* dev_ macros.
* @clocks: Array of clock handles.
* @resets: Array of reset handles.
+ * @core_resets: AXI and APB resets of the core, without the bus interfaces.
* @reg_base: Mapped address of VPU registers.
* @enc_base: Mapped address of VPU encoder register for convenience.
* @dec_base: Mapped address of VPU decoder register for convenience.
@@ -190,7 +191,9 @@ hantro_vdev_to_func(struct video_device *vdev)
* @watchdog_work: Delayed work for hardware timeout handling.
* @empty_domain: Empty IOMMU domain, used to reinitialize the IOMMU after
* a reset of the core. NULL if not needed.
- * @iommu_lost: The IOMMU couldn't be reinitialized, no job can run.
+ * @iommu_lost: The IOMMU couldn't be reinitialized, or the bus of the
+ * core hangs: no job can run.
+ * @error_reset: The watchdog was queued by hantro_irq_reset().
*/
struct hantro_dev {
struct v4l2_device v4l2_dev;
@@ -202,6 +205,7 @@ struct hantro_dev {
struct device *dev;
struct clk_bulk_data *clocks;
struct reset_control *resets;
+ struct reset_control_bulk_data core_resets[2];
void __iomem *reg_base;
void __iomem *enc_base;
void __iomem *dec_base;
@@ -212,6 +216,7 @@ struct hantro_dev {
struct delayed_work watchdog_work;
struct iommu_domain *empty_domain;
bool iommu_lost;
+ bool error_reset;
};
/**
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 26b273cd339d..bb611b414e75 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -117,10 +117,12 @@ void hantro_irq_done(struct hantro_dev *vpu,
/*
* Pulsing the reset lines of a core can reset its IOMMU behind the IOMMU
* driver. Attaching and detaching the empty domain makes the driver reprogram
- * it; the default domain keeps its mappings. A failed attach may leave the
- * IOMMU without translation, so no further job may run.
+ * it; the default domain keeps its mappings. While the empty domain is
+ * attached, maps and unmaps of the default domain leave the IOMMU alone. A
+ * failed attach may leave the IOMMU without translation, so no further job may
+ * run.
*/
-int hantro_iommu_restore(struct hantro_dev *vpu)
+int hantro_iommu_park(struct hantro_dev *vpu)
{
int ret;
@@ -132,29 +134,55 @@ int hantro_iommu_restore(struct hantro_dev *vpu)
dev_err(vpu->dev, "Failed to reinitialize the IOMMU (%d), refusing further jobs\n",
ret);
vpu->iommu_lost = true;
- return ret;
}
- iommu_detach_device(vpu->empty_domain, vpu->dev);
- return 0;
+ return ret;
+}
+
+void hantro_iommu_unpark(struct hantro_dev *vpu)
+{
+ if (vpu->empty_domain)
+ iommu_detach_device(vpu->empty_domain, vpu->dev);
+}
+
+int hantro_iommu_restore(struct hantro_dev *vpu)
+{
+ int ret = hantro_iommu_park(vpu);
+
+ if (!ret)
+ hantro_iommu_unpark(vpu);
+ return ret;
}
void hantro_watchdog(struct work_struct *work)
{
struct hantro_dev *vpu;
struct hantro_ctx *ctx;
+ bool error_reset;
vpu = container_of(to_delayed_work(work),
struct hantro_dev, watchdog_work);
+ error_reset = vpu->error_reset;
+ vpu->error_reset = false;
ctx = v4l2_m2m_get_curr_priv(vpu->m2m_dev);
if (ctx) {
- vpu_err("frame processing timed out!\n");
+ if (!error_reset)
+ vpu_err("frame processing timed out!\n");
if (ctx->codec_ops->reset)
ctx->codec_ops->reset(ctx);
hantro_job_finish(ctx, VB2_BUF_STATE_ERROR);
}
}
+/* For a failed job whose core needs a reset: the watchdog work resets it and ends the job. */
+void hantro_irq_reset(struct hantro_dev *vpu)
+{
+ if (cancel_delayed_work(&vpu->watchdog_work)) {
+ vpu->error_reset = true;
+ schedule_delayed_work(&vpu->watchdog_work, 0);
+ }
+}
+
void hantro_start_prepare_run(struct hantro_ctx *ctx)
{
struct vb2_v4l2_buffer *src_buf;
@@ -1152,7 +1180,12 @@ static void hantro_disable_runtime_pm(struct hantro_dev *vpu)
static void hantro_free_empty_domain(void *data)
{
- iommu_domain_free(data);
+ struct hantro_dev *vpu = data;
+
+ /* Still attached after a failed reset */
+ if (iommu_get_domain_for_dev(vpu->dev) == vpu->empty_domain)
+ hantro_iommu_unpark(vpu);
+ iommu_domain_free(vpu->empty_domain);
}
static int hantro_alloc_empty_domain(struct hantro_dev *vpu)
@@ -1178,7 +1211,7 @@ static int hantro_alloc_empty_domain(struct hantro_dev *vpu)
vpu->empty_domain = domain;
ret = devm_add_action_or_reset(vpu->dev, hantro_free_empty_domain,
- domain);
+ vpu);
if (ret)
return ret;
diff --git a/drivers/media/platform/verisilicon/hantro_hw.h b/drivers/media/platform/verisilicon/hantro_hw.h
index d3c36948208d..b63893a17df0 100644
--- a/drivers/media/platform/verisilicon/hantro_hw.h
+++ b/drivers/media/platform/verisilicon/hantro_hw.h
@@ -382,7 +382,7 @@ struct hantro_postproc_ops {
* should be programmed and started. Returns zero if OK, a
* negative value in error cases.
* @done: Read back processing results and additional data from hardware.
- * @reset: Reset the hardware in case of a timeout.
+ * @reset: Reset the hardware in case of a timeout or hantro_irq_reset().
*/
struct hantro_codec_ops {
int (*init)(struct hantro_ctx *ctx);
@@ -431,12 +431,15 @@ extern const struct hantro_postproc_ops rockchip_vpu981_postproc_ops;
extern const u32 hantro_vp8_dec_mc_filter[8][6];
void hantro_watchdog(struct work_struct *work);
+int hantro_iommu_park(struct hantro_dev *vpu);
+void hantro_iommu_unpark(struct hantro_dev *vpu);
int hantro_iommu_restore(struct hantro_dev *vpu);
void hantro_irq_done(struct hantro_dev *vpu,
enum vb2_buffer_state result);
void hantro_start_prepare_run(struct hantro_ctx *ctx);
void hantro_end_prepare_run(struct hantro_ctx *ctx);
void hantro_abort_prepare_run(struct hantro_ctx *ctx);
+void hantro_irq_reset(struct hantro_dev *vpu);
irqreturn_t hantro_g1_irq(int irq, void *dev_id);
void hantro_g1_reset(struct hantro_ctx *ctx);
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h b/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h
index e4008da64f19..b88df093b5e2 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h
+++ b/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h
@@ -21,6 +21,9 @@
#define AV1_REG_INTERRUPT AV1_SWREG(1)
#define AV1_REG_INTERRUPT_DEC_RDY_INT BIT(12)
+#define AV1_REG_INTERRUPT_DEC_ABORT_E BIT(5)
+#define AV1_REG_INTERRUPT_DEC_IRQ_DIS BIT(4)
+#define AV1_REG_INTERRUPT_DEC_E BIT(0)
#define AV1_REG_CONFIG AV1_SWREG(2)
#define AV1_REG_CONFIG_DEC_CLK_GATE_E BIT(10)
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index f04d3cc0c1a8..6bb85ccbf460 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -8,6 +8,9 @@
#include <linux/clk.h>
#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/iopoll.h>
+#include <soc/rockchip/pm_domains.h>
#include "hantro.h"
#include "hantro_av1.h"
@@ -435,11 +438,23 @@ static irqreturn_t rk3588_vpu981_irq(int irq, void *dev_id)
vdpu_write(vpu, 0, AV1_REG_INTERRUPT);
vdpu_write(vpu, AV1_REG_CONFIG_DEC_CLK_GATE_E, AV1_REG_CONFIG);
- hantro_irq_done(vpu, state);
+ if (state == VB2_BUF_STATE_DONE)
+ hantro_irq_done(vpu, state);
+ else
+ hantro_irq_reset(vpu);
return IRQ_HANDLED;
}
+static int rk3588_vpu981_hw_init(struct hantro_dev *vpu)
+{
+ vpu->core_resets[0].id = "axi";
+ vpu->core_resets[1].id = "apb";
+
+ return devm_reset_control_bulk_get_optional_exclusive_released(vpu->dev,
+ ARRAY_SIZE(vpu->core_resets), vpu->core_resets);
+}
+
static int rk3036_vpu_hw_init(struct hantro_dev *vpu)
{
/* Bump ACLK to max. possible freq. to improve performance. */
@@ -540,6 +555,73 @@ static void rockchip_vpu2_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, 0, VEPU_REG_INTERRUPT);
}
+static int rockchip_vpu981_core_reset(void *data)
+{
+ struct hantro_dev *vpu = data;
+ int n = ARRAY_SIZE(vpu->core_resets);
+ int ret;
+
+ ret = reset_control_bulk_assert(n, vpu->core_resets);
+ udelay(5);
+ return reset_control_bulk_deassert(n, vpu->core_resets) ?: ret;
+}
+
+static void rockchip_vpu981_av1_dec_reset(struct hantro_ctx *ctx)
+{
+ struct hantro_dev *vpu = ctx->dev;
+ struct reset_control_bulk_data *rst = vpu->core_resets;
+ int n = ARRAY_SIZE(vpu->core_resets);
+ int irq, ret;
+ u32 status;
+
+ if (!rst[0].rstc)
+ return;
+
+ irq = platform_get_irq(vpu->pdev, 0);
+ if (irq < 0)
+ return;
+
+ ret = reset_control_bulk_acquire(n, rst);
+ if (ret) {
+ dev_err(vpu->dev, "Failed to acquire the core resets: %d\n", ret);
+ return;
+ }
+
+ /* After a timeout, keep the handler off the core and the next job. */
+ disable_irq(irq);
+
+ status = vdpu_read(vpu, AV1_REG_INTERRUPT);
+ if (status & AV1_REG_INTERRUPT_DEC_E) {
+ vdpu_write(vpu, status | AV1_REG_INTERRUPT_DEC_ABORT_E |
+ AV1_REG_INTERRUPT_DEC_IRQ_DIS, AV1_REG_INTERRUPT);
+ if (readl_poll_timeout(vpu->dec_base + AV1_REG_INTERRUPT, status,
+ !(status & AV1_REG_INTERRUPT_DEC_E), 100, 100000)) {
+ dev_err(vpu->dev, "The core does not stop, refusing further jobs\n");
+ hantro_iommu_park(vpu);
+ vpu->iommu_lost = true;
+ goto release;
+ }
+ }
+
+ if (hantro_iommu_park(vpu))
+ goto out;
+
+ ret = rockchip_pmu_idle_reset(vpu->dev, rockchip_vpu981_core_reset, vpu);
+ if (ret) {
+ dev_err(vpu->dev, "Failed to reset the core: %d\n", ret);
+ /* Bus state unknown: keep the IOMMU and the handler off it. */
+ if (ret == -ETIMEDOUT) {
+ vpu->iommu_lost = true;
+ goto release;
+ }
+ }
+ hantro_iommu_unpark(vpu);
+out:
+ enable_irq(irq);
+release:
+ reset_control_bulk_release(n, rst);
+}
+
/*
* Supported codec ops.
*/
@@ -656,6 +738,7 @@ static const struct hantro_codec_ops rk3588_vpu981_codec_ops[] = {
.init = hantro_av1_init,
.exit = hantro_av1_exit,
.done = hantro_av1_update_prob,
+ .reset = rockchip_vpu981_av1_dec_reset,
},
};
/*
@@ -856,6 +939,7 @@ const struct hantro_variant rk3588_vpu981_variant = {
.postproc_ops = &rockchip_vpu981_postproc_ops,
.codec = HANTRO_AV1_DECODER,
.codec_ops = rk3588_vpu981_codec_ops,
+ .init = rk3588_vpu981_hw_init,
.irqs = rk3588_vpu981_irqs,
.num_irqs = ARRAY_SIZE(rk3588_vpu981_irqs),
.clk_names = rk3588_vpu981_vpu_clk_names,
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 17/18] media: verisilicon: Reset the RK3588 AV1 decoder after an error
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
Nothing resets the AV1 core after an error interrupt, and the frames
after it time out: 50 watchdog timeouts in one AV1 test run.
Reset the core from the watchdog work as the vendor driver does: its AXI
and APB lines only, with the bus of its power domain stopped and its
interrupt masked. A reset of all four lines without the bus stop left
the domain unable to go idle, and an SError followed.
Stop a core still running after a timeout with its abort first, as
hantro_g2_reset() does: a reset during its bus transfers corrupted
memory. If it does not stop, refuse further jobs.
Attach the empty IOMMU domain for the reset, so that unmaps of other
contexts do not write the IOMMU of the stopped bus; the vendor driver
blocks them with a lock. With two decoders, a reset failed to idle the
domain, and a write from an unmap then raised an SError. If the bus
does not stop or restart, keep the empty domain and refuse further
jobs.
Fixes: 003afda97c65 ("media: verisilicon: Enable AV1 decoder on rk3588")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/media/platform/verisilicon/hantro.h | 7 +-
drivers/media/platform/verisilicon/hantro_drv.c | 51 ++++++++++---
drivers/media/platform/verisilicon/hantro_hw.h | 5 +-
.../platform/verisilicon/rockchip_vpu981_regs.h | 3 +
.../media/platform/verisilicon/rockchip_vpu_hw.c | 86 +++++++++++++++++++++-
5 files changed, 140 insertions(+), 12 deletions(-)
diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/platform/verisilicon/hantro.h
index 5a9acc8c82a8..2d021c98f085 100644
--- a/drivers/media/platform/verisilicon/hantro.h
+++ b/drivers/media/platform/verisilicon/hantro.h
@@ -180,6 +180,7 @@ hantro_vdev_to_func(struct video_device *vdev)
* dev_ macros.
* @clocks: Array of clock handles.
* @resets: Array of reset handles.
+ * @core_resets: AXI and APB resets of the core, without the bus interfaces.
* @reg_base: Mapped address of VPU registers.
* @enc_base: Mapped address of VPU encoder register for convenience.
* @dec_base: Mapped address of VPU decoder register for convenience.
@@ -190,7 +191,9 @@ hantro_vdev_to_func(struct video_device *vdev)
* @watchdog_work: Delayed work for hardware timeout handling.
* @empty_domain: Empty IOMMU domain, used to reinitialize the IOMMU after
* a reset of the core. NULL if not needed.
- * @iommu_lost: The IOMMU couldn't be reinitialized, no job can run.
+ * @iommu_lost: The IOMMU couldn't be reinitialized, or the bus of the
+ * core hangs: no job can run.
+ * @error_reset: The watchdog was queued by hantro_irq_reset().
*/
struct hantro_dev {
struct v4l2_device v4l2_dev;
@@ -202,6 +205,7 @@ struct hantro_dev {
struct device *dev;
struct clk_bulk_data *clocks;
struct reset_control *resets;
+ struct reset_control_bulk_data core_resets[2];
void __iomem *reg_base;
void __iomem *enc_base;
void __iomem *dec_base;
@@ -212,6 +216,7 @@ struct hantro_dev {
struct delayed_work watchdog_work;
struct iommu_domain *empty_domain;
bool iommu_lost;
+ bool error_reset;
};
/**
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 26b273cd339d..bb611b414e75 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -117,10 +117,12 @@ void hantro_irq_done(struct hantro_dev *vpu,
/*
* Pulsing the reset lines of a core can reset its IOMMU behind the IOMMU
* driver. Attaching and detaching the empty domain makes the driver reprogram
- * it; the default domain keeps its mappings. A failed attach may leave the
- * IOMMU without translation, so no further job may run.
+ * it; the default domain keeps its mappings. While the empty domain is
+ * attached, maps and unmaps of the default domain leave the IOMMU alone. A
+ * failed attach may leave the IOMMU without translation, so no further job may
+ * run.
*/
-int hantro_iommu_restore(struct hantro_dev *vpu)
+int hantro_iommu_park(struct hantro_dev *vpu)
{
int ret;
@@ -132,29 +134,55 @@ int hantro_iommu_restore(struct hantro_dev *vpu)
dev_err(vpu->dev, "Failed to reinitialize the IOMMU (%d), refusing further jobs\n",
ret);
vpu->iommu_lost = true;
- return ret;
}
- iommu_detach_device(vpu->empty_domain, vpu->dev);
- return 0;
+ return ret;
+}
+
+void hantro_iommu_unpark(struct hantro_dev *vpu)
+{
+ if (vpu->empty_domain)
+ iommu_detach_device(vpu->empty_domain, vpu->dev);
+}
+
+int hantro_iommu_restore(struct hantro_dev *vpu)
+{
+ int ret = hantro_iommu_park(vpu);
+
+ if (!ret)
+ hantro_iommu_unpark(vpu);
+ return ret;
}
void hantro_watchdog(struct work_struct *work)
{
struct hantro_dev *vpu;
struct hantro_ctx *ctx;
+ bool error_reset;
vpu = container_of(to_delayed_work(work),
struct hantro_dev, watchdog_work);
+ error_reset = vpu->error_reset;
+ vpu->error_reset = false;
ctx = v4l2_m2m_get_curr_priv(vpu->m2m_dev);
if (ctx) {
- vpu_err("frame processing timed out!\n");
+ if (!error_reset)
+ vpu_err("frame processing timed out!\n");
if (ctx->codec_ops->reset)
ctx->codec_ops->reset(ctx);
hantro_job_finish(ctx, VB2_BUF_STATE_ERROR);
}
}
+/* For a failed job whose core needs a reset: the watchdog work resets it and ends the job. */
+void hantro_irq_reset(struct hantro_dev *vpu)
+{
+ if (cancel_delayed_work(&vpu->watchdog_work)) {
+ vpu->error_reset = true;
+ schedule_delayed_work(&vpu->watchdog_work, 0);
+ }
+}
+
void hantro_start_prepare_run(struct hantro_ctx *ctx)
{
struct vb2_v4l2_buffer *src_buf;
@@ -1152,7 +1180,12 @@ static void hantro_disable_runtime_pm(struct hantro_dev *vpu)
static void hantro_free_empty_domain(void *data)
{
- iommu_domain_free(data);
+ struct hantro_dev *vpu = data;
+
+ /* Still attached after a failed reset */
+ if (iommu_get_domain_for_dev(vpu->dev) == vpu->empty_domain)
+ hantro_iommu_unpark(vpu);
+ iommu_domain_free(vpu->empty_domain);
}
static int hantro_alloc_empty_domain(struct hantro_dev *vpu)
@@ -1178,7 +1211,7 @@ static int hantro_alloc_empty_domain(struct hantro_dev *vpu)
vpu->empty_domain = domain;
ret = devm_add_action_or_reset(vpu->dev, hantro_free_empty_domain,
- domain);
+ vpu);
if (ret)
return ret;
diff --git a/drivers/media/platform/verisilicon/hantro_hw.h b/drivers/media/platform/verisilicon/hantro_hw.h
index d3c36948208d..b63893a17df0 100644
--- a/drivers/media/platform/verisilicon/hantro_hw.h
+++ b/drivers/media/platform/verisilicon/hantro_hw.h
@@ -382,7 +382,7 @@ struct hantro_postproc_ops {
* should be programmed and started. Returns zero if OK, a
* negative value in error cases.
* @done: Read back processing results and additional data from hardware.
- * @reset: Reset the hardware in case of a timeout.
+ * @reset: Reset the hardware in case of a timeout or hantro_irq_reset().
*/
struct hantro_codec_ops {
int (*init)(struct hantro_ctx *ctx);
@@ -431,12 +431,15 @@ extern const struct hantro_postproc_ops rockchip_vpu981_postproc_ops;
extern const u32 hantro_vp8_dec_mc_filter[8][6];
void hantro_watchdog(struct work_struct *work);
+int hantro_iommu_park(struct hantro_dev *vpu);
+void hantro_iommu_unpark(struct hantro_dev *vpu);
int hantro_iommu_restore(struct hantro_dev *vpu);
void hantro_irq_done(struct hantro_dev *vpu,
enum vb2_buffer_state result);
void hantro_start_prepare_run(struct hantro_ctx *ctx);
void hantro_end_prepare_run(struct hantro_ctx *ctx);
void hantro_abort_prepare_run(struct hantro_ctx *ctx);
+void hantro_irq_reset(struct hantro_dev *vpu);
irqreturn_t hantro_g1_irq(int irq, void *dev_id);
void hantro_g1_reset(struct hantro_ctx *ctx);
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h b/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h
index e4008da64f19..b88df093b5e2 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h
+++ b/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h
@@ -21,6 +21,9 @@
#define AV1_REG_INTERRUPT AV1_SWREG(1)
#define AV1_REG_INTERRUPT_DEC_RDY_INT BIT(12)
+#define AV1_REG_INTERRUPT_DEC_ABORT_E BIT(5)
+#define AV1_REG_INTERRUPT_DEC_IRQ_DIS BIT(4)
+#define AV1_REG_INTERRUPT_DEC_E BIT(0)
#define AV1_REG_CONFIG AV1_SWREG(2)
#define AV1_REG_CONFIG_DEC_CLK_GATE_E BIT(10)
diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index f04d3cc0c1a8..6bb85ccbf460 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -8,6 +8,9 @@
#include <linux/clk.h>
#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/iopoll.h>
+#include <soc/rockchip/pm_domains.h>
#include "hantro.h"
#include "hantro_av1.h"
@@ -435,11 +438,23 @@ static irqreturn_t rk3588_vpu981_irq(int irq, void *dev_id)
vdpu_write(vpu, 0, AV1_REG_INTERRUPT);
vdpu_write(vpu, AV1_REG_CONFIG_DEC_CLK_GATE_E, AV1_REG_CONFIG);
- hantro_irq_done(vpu, state);
+ if (state == VB2_BUF_STATE_DONE)
+ hantro_irq_done(vpu, state);
+ else
+ hantro_irq_reset(vpu);
return IRQ_HANDLED;
}
+static int rk3588_vpu981_hw_init(struct hantro_dev *vpu)
+{
+ vpu->core_resets[0].id = "axi";
+ vpu->core_resets[1].id = "apb";
+
+ return devm_reset_control_bulk_get_optional_exclusive_released(vpu->dev,
+ ARRAY_SIZE(vpu->core_resets), vpu->core_resets);
+}
+
static int rk3036_vpu_hw_init(struct hantro_dev *vpu)
{
/* Bump ACLK to max. possible freq. to improve performance. */
@@ -540,6 +555,73 @@ static void rockchip_vpu2_enc_reset(struct hantro_ctx *ctx)
vepu_write(vpu, 0, VEPU_REG_INTERRUPT);
}
+static int rockchip_vpu981_core_reset(void *data)
+{
+ struct hantro_dev *vpu = data;
+ int n = ARRAY_SIZE(vpu->core_resets);
+ int ret;
+
+ ret = reset_control_bulk_assert(n, vpu->core_resets);
+ udelay(5);
+ return reset_control_bulk_deassert(n, vpu->core_resets) ?: ret;
+}
+
+static void rockchip_vpu981_av1_dec_reset(struct hantro_ctx *ctx)
+{
+ struct hantro_dev *vpu = ctx->dev;
+ struct reset_control_bulk_data *rst = vpu->core_resets;
+ int n = ARRAY_SIZE(vpu->core_resets);
+ int irq, ret;
+ u32 status;
+
+ if (!rst[0].rstc)
+ return;
+
+ irq = platform_get_irq(vpu->pdev, 0);
+ if (irq < 0)
+ return;
+
+ ret = reset_control_bulk_acquire(n, rst);
+ if (ret) {
+ dev_err(vpu->dev, "Failed to acquire the core resets: %d\n", ret);
+ return;
+ }
+
+ /* After a timeout, keep the handler off the core and the next job. */
+ disable_irq(irq);
+
+ status = vdpu_read(vpu, AV1_REG_INTERRUPT);
+ if (status & AV1_REG_INTERRUPT_DEC_E) {
+ vdpu_write(vpu, status | AV1_REG_INTERRUPT_DEC_ABORT_E |
+ AV1_REG_INTERRUPT_DEC_IRQ_DIS, AV1_REG_INTERRUPT);
+ if (readl_poll_timeout(vpu->dec_base + AV1_REG_INTERRUPT, status,
+ !(status & AV1_REG_INTERRUPT_DEC_E), 100, 100000)) {
+ dev_err(vpu->dev, "The core does not stop, refusing further jobs\n");
+ hantro_iommu_park(vpu);
+ vpu->iommu_lost = true;
+ goto release;
+ }
+ }
+
+ if (hantro_iommu_park(vpu))
+ goto out;
+
+ ret = rockchip_pmu_idle_reset(vpu->dev, rockchip_vpu981_core_reset, vpu);
+ if (ret) {
+ dev_err(vpu->dev, "Failed to reset the core: %d\n", ret);
+ /* Bus state unknown: keep the IOMMU and the handler off it. */
+ if (ret == -ETIMEDOUT) {
+ vpu->iommu_lost = true;
+ goto release;
+ }
+ }
+ hantro_iommu_unpark(vpu);
+out:
+ enable_irq(irq);
+release:
+ reset_control_bulk_release(n, rst);
+}
+
/*
* Supported codec ops.
*/
@@ -656,6 +738,7 @@ static const struct hantro_codec_ops rk3588_vpu981_codec_ops[] = {
.init = hantro_av1_init,
.exit = hantro_av1_exit,
.done = hantro_av1_update_prob,
+ .reset = rockchip_vpu981_av1_dec_reset,
},
};
/*
@@ -856,6 +939,7 @@ const struct hantro_variant rk3588_vpu981_variant = {
.postproc_ops = &rockchip_vpu981_postproc_ops,
.codec = HANTRO_AV1_DECODER,
.codec_ops = rk3588_vpu981_codec_ops,
+ .init = rk3588_vpu981_hw_init,
.irqs = rk3588_vpu981_irqs,
.num_irqs = ARRAY_SIZE(rk3588_vpu981_irqs),
.clk_names = rk3588_vpu981_vpu_clk_names,
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* Re: [PATCH v4 17/18] media: verisilicon: Reset the RK3588 AV1 decoder after an error
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
(?)
@ 2026-12-06 6:32 ` sashiko-bot
-1 siblings, 0 replies; 63+ messages in thread
From: sashiko-bot @ 2026-12-06 6:32 UTC (permalink / raw)
To: Arun Iyengar; +Cc: devicetree, robh, conor+dt, media-ci
Thank you for your contribution! Sashiko AI review found 6 potential
issues to consider:
- [High] media: verisilicon: IOMMU park in AV1 reset races with
vsi-iommu TLB flush
- [High] media: verisilicon: probe IOMMU restore breaks Allwinner H6
sun50i-iommu
- [Medium] media: verisilicon: unsynchronized vsi_iommu_irq() during AV1
bus idle reset
- [Medium] media: verisilicon: AV1 IRQ left masked after non-ETIMEDOUT
reset failure
- [Medium] media: verisilicon: autosuspend disables AV1 IOMMU on fatal
reset failure
- [Medium] media: verisilicon: hantro_irq_done() can cancel queued error
reset
--
commit b0061f03847e949dc6ad1fe23da4402a10a0f6ce
Author: Arun Iyengar <aiyengar1990@gmail.com>
media: verisilicon: Reset the RK3588 AV1 decoder after an error
This commit adds error and timeout reset handling for the RK3588 AV1
decoder using rockchip_pmu_idle_reset() and parks the IOMMU on an empty
domain during the reset.
> diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
> index 26b273cd339d0..bb611b414e75d 100644
> --- a/drivers/media/platform/verisilicon/hantro_drv.c
> +++ b/drivers/media/platform/verisilicon/hantro_drv.c
[ ... ]
> @@ -132,29 +134,55 @@ int hantro_iommu_restore(struct hantro_dev *vpu)
[ ... ]
> +/* For a failed job whose core needs a reset: the watchdog work resets it and ends the job. */
> +void hantro_irq_reset(struct hantro_dev *vpu)
> +{
> + if (cancel_delayed_work(&vpu->watchdog_work)) {
> + vpu->error_reset = true;
> + schedule_delayed_work(&vpu->watchdog_work, 0);
> + }
> +}
[Severity: Medium]
Can hantro_irq_done() cancel a queued error reset if a second interrupt
arrives before hantro_watchdog() starts?
rk3588_vpu981_irq() clears AV1_REG_INTERRUPT to 0 without setting
AV1_REG_INTERRUPT_DEC_IRQ_DIS, and hantro_irq_reset() re-arms
vpu->watchdog_work into the pending state. If a DEC_RDY_INT interrupt
arrives before a kworker dequeues watchdog_work, hantro_irq_done() calls
cancel_delayed_work(&vpu->watchdog_work) without checking
vpu->error_reset.
That drops rockchip_vpu981_av1_dec_reset(), finishes the errored job as
VB2_BUF_STATE_DONE (running hantro_av1_update_prob() on errored state),
and leaves vpu->error_reset true until a later timeout suppresses its
timeout log. Checking vpu->error_reset in hantro_irq_done() or using a
separate work item for error resets would avoid this.
[ ... ]
> @@ -1178,7 +1211,7 @@ static int hantro_alloc_empty_domain(struct hantro_dev *vpu)
> vpu->empty_domain = domain;
>
> ret = devm_add_action_or_reset(vpu->dev, hantro_free_empty_domain,
> - domain);
> + vpu);
> if (ret)
> return ret;
[Severity: High]
Does the unconditional hantro_iommu_restore() call at the end of
hantro_alloc_empty_domain() break probing on Allwinner H6?
In arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi, video-codec-g2@1c00000
(sunxi_vpu_variant) has both resets and a DMA domain on sun50i-iommu, so
hantro_alloc_empty_domain() (added in commit "media: verisilicon:
Reinitialize the IOMMU after resetting an encoder core") calls
hantro_iommu_restore() -> iommu_attach_device() during probe.
Because sun50i-iommu uses generic_single_device_group, video-codec-g2
shares its IOMMU group with mixer0 and video-codec@1c0e000, so
iommu_attach_device() fails list_count_nodes(&group->devices) != 1 and
hantro_probe() fails with -EINVAL. Even with a single device in the
group, sun50i_iommu_attach_device() increments sun50i_domain->refcnt
(initialized to 1), preventing sun50i_iommu_detach_domain() from running
during domain swaps and leaking DMA mappings and clock references.
> diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
> index f04d3cc0c1a85..6bb85ccbf4601 100644
> --- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
> +++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
[ ... ]
> @@ -540,6 +555,73 @@ static void rockchip_vpu2_enc_reset(struct hantro_ctx *ctx)
[ ... ]
> + status = vdpu_read(vpu, AV1_REG_INTERRUPT);
> + if (status & AV1_REG_INTERRUPT_DEC_E) {
> + vdpu_write(vpu, status | AV1_REG_INTERRUPT_DEC_ABORT_E |
> + AV1_REG_INTERRUPT_DEC_IRQ_DIS, AV1_REG_INTERRUPT);
> + if (readl_poll_timeout(vpu->dec_base + AV1_REG_INTERRUPT, status,
> + !(status & AV1_REG_INTERRUPT_DEC_E), 100, 100000)) {
> + dev_err(vpu->dev, "The core does not stop, refusing further jobs\n");
> + hantro_iommu_park(vpu);
> + vpu->iommu_lost = true;
> + goto release;
> + }
> + }
> +
> + if (hantro_iommu_park(vpu))
> + goto out;
[Severity: High]
Can hantro_iommu_park() race with concurrent DMA maps or unmaps on
another decoder context in vsi-iommu?
CPU0 (kworker) CPU1 (other decoder context)
rockchip_vpu981_av1_dec_reset() vsi_iommu_unmap()
hantro_iommu_park() spin_lock(&default_domain->lock)
vsi_iommu_attach_device() vsi_iommu_flush_tlb(default_domain)
spin_lock(&empty->lock) list_for_each_entry(iommu, ...)
spin_lock(&iommu->lock) pm_runtime_get(iommu->dev)
list_del_init(&iommu->node)
list_add_tail(&iommu->node,
&empty->iommus)
spin_unlock(&iommu->lock)
rockchip_pmu_idle_reset() spin_lock(&iommu->lock)
[bus stopped] writel(..., VSI_MMU_FLUSH_BASE)
<-- write on stopped bus
list_next_entry(iommu, node)
<-- walks onto &empty->iommus
vsi_iommu_attach_device() ignores the old domain parameter and never
takes default_domain->lock, while vsi_iommu_flush_tlb() iterates
default_domain->iommus and drops iommu->lock around pm_runtime_get() and
pm_runtime_put_autosuspend().
Moving iommu->node onto empty_domain->iommus mid-loop makes
list_for_each_entry() miss the &default_domain->iommus sentinel and
compute an out-of-bounds container_of() pointer before empty_domain,
corrupting adjacent slab memory. Because vsi_iommu_attach_device() also
leaves iommu->enable set, an in-flight vsi_iommu_flush_tlb() can still
write VSI_MMU_FLUSH_BASE after rockchip_pmu_idle_reset() stops the
RK3588_PD_AV1 bus, raising an SError.
> + ret = rockchip_pmu_idle_reset(vpu->dev, rockchip_vpu981_core_reset, vpu);
[Severity: Medium]
Can vsi_iommu_irq() still access av1d_mmu registers while
rockchip_pmu_idle_reset() has the RK3588_PD_AV1 bus stopped?
av1d_mmu shares RK3588_PD_AV1 with av1d but uses a separate interrupt
(GIC_SPI 109). rockchip_vpu981_av1_dec_reset() only disables av1d's IRQ,
and hantro_iommu_park() does not clear VSI_MMU_STATUS_BASE or synchronize
av1d_mmu's IRQ.
If a failing decode raises an IOMMU page fault right before
AV1_REG_INTERRUPT_DEC_E clears, vsi_iommu_irq() on another CPU can pass
pm_runtime_resume_and_get(), take iommu->lock after
vsi_iommu_attach_device() drops it, and read/write VSI_MMU_STATUS_BASE on
the stopped bus, causing the idle handshake to time out or raising an
SError.
> + if (ret) {
> + dev_err(vpu->dev, "Failed to reset the core: %d\n", ret);
> + /* Bus state unknown: keep the IOMMU and the handler off it. */
> + if (ret == -ETIMEDOUT) {
> + vpu->iommu_lost = true;
> + goto release;
> + }
> + }
[Severity: Medium]
Does runtime PM autosuspend still call vsi_iommu_suspend() after either
fatal failure path sets vpu->iommu_lost = true?
After rockchip_vpu981_av1_dec_reset() returns on the -ETIMEDOUT or
core-did-not-stop path, hantro_watchdog() calls hantro_job_finish() ->
pm_runtime_put_autosuspend(vpu->dev). Once av1d suspends, its runtime PM
device link drops av1d_mmu's reference and vsi_iommu_suspend() calls
vsi_iommu_disable(), writing 0 to VSI_MMU_AHB_CONTROL_BASE before gating
the shared ACLK_AV1 and PCLK_AV1 clocks.
On the -ETIMEDOUT path, that MMIO write hits the unknown-state bus and
can raise an SError; on the core-did-not-stop path, it disables IOMMU
translation while the unstopped core is still clocked. Holding a runtime
PM reference on these fatal paths would keep av1d_mmu from autosuspending.
> + hantro_iommu_unpark(vpu);
> +out:
> + enable_irq(irq);
[Severity: Medium]
Is AV1_REG_INTERRUPT_DEC_IRQ_DIS left set in hardware if
rockchip_pmu_idle_reset() fails with an error other than -ETIMEDOUT?
When a timeout aborts a running core, AV1_REG_INTERRUPT_DEC_IRQ_DIS is
written to AV1_REG_INTERRUPT. If rockchip_pmu_idle_reset() then returns
a non-ETIMEDOUT error (for example -EOPNOTSUPP when
CONFIG_ROCKCHIP_PM_DOMAINS is disabled), the core is not reset and
vpu->iommu_lost stays false, yet AV1_REG_INTERRUPT is never cleared.
Because rockchip_vpu981_av1_dec_run() only updates bits 0, 5, and 7 via
hantro_reg_write(), bit 4 stays latched and every subsequent AV1 job
times out until the power domain is power-cycled.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261206-hantro-robust-v4-0-b99d33a5ec6d@gmail.com?part=17
^ permalink raw reply [flat|nested] 63+ messages in thread
* [PATCH v4 18/18] arm64: dts: rockchip: Name the RK3588 AV1 decoder resets
2026-12-06 5:57 ` Arun Iyengar via B4 Relay
(?)
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
-1 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
The AV1 decoder driver picks its core resets by name. Add the names and
list the resets in the binding order: AXI, AXI BIU, APB, APB BIU.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index 96898fefe840..ffaab952d0ee 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -1479,7 +1479,9 @@ av1d: video-codec@fdc70000 {
clocks = <&cru ACLK_AV1>, <&cru PCLK_AV1>;
clock-names = "aclk", "hclk";
power-domains = <&power RK3588_PD_AV1>;
- resets = <&cru SRST_A_AV1>, <&cru SRST_P_AV1>, <&cru SRST_A_AV1_BIU>, <&cru SRST_P_AV1_BIU>;
+ resets = <&cru SRST_A_AV1>, <&cru SRST_A_AV1_BIU>,
+ <&cru SRST_P_AV1>, <&cru SRST_P_AV1_BIU>;
+ reset-names = "axi", "axi-biu", "apb", "apb-biu";
iommus = <&av1d_mmu>;
};
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 18/18] arm64: dts: rockchip: Name the RK3588 AV1 decoder resets
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
The AV1 decoder driver picks its core resets by name. Add the names and
list the resets in the binding order: AXI, AXI BIU, APB, APB BIU.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index 96898fefe840..ffaab952d0ee 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -1479,7 +1479,9 @@ av1d: video-codec@fdc70000 {
clocks = <&cru ACLK_AV1>, <&cru PCLK_AV1>;
clock-names = "aclk", "hclk";
power-domains = <&power RK3588_PD_AV1>;
- resets = <&cru SRST_A_AV1>, <&cru SRST_P_AV1>, <&cru SRST_A_AV1_BIU>, <&cru SRST_P_AV1_BIU>;
+ resets = <&cru SRST_A_AV1>, <&cru SRST_A_AV1_BIU>,
+ <&cru SRST_P_AV1>, <&cru SRST_P_AV1_BIU>;
+ reset-names = "axi", "axi-biu", "apb", "apb-biu";
iommus = <&av1d_mmu>;
};
--
2.55.0
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 63+ messages in thread* [PATCH v4 18/18] arm64: dts: rockchip: Name the RK3588 AV1 decoder resets
@ 2026-12-06 5:57 ` Arun Iyengar via B4 Relay
0 siblings, 0 replies; 63+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-06 5:57 UTC (permalink / raw)
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, iommu, linux-rockchip, devicetree, linux-arm-kernel,
linux-pm, linux-kernel, Sergei Khomenkov,
Tharit Tangkijwanichakul, Sascha Hauer, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
The AV1 decoder driver picks its core resets by name. Add the names and
list the resets in the binding order: AXI, AXI BIU, APB, APB BIU.
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index 96898fefe840..ffaab952d0ee 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -1479,7 +1479,9 @@ av1d: video-codec@fdc70000 {
clocks = <&cru ACLK_AV1>, <&cru PCLK_AV1>;
clock-names = "aclk", "hclk";
power-domains = <&power RK3588_PD_AV1>;
- resets = <&cru SRST_A_AV1>, <&cru SRST_P_AV1>, <&cru SRST_A_AV1_BIU>, <&cru SRST_P_AV1_BIU>;
+ resets = <&cru SRST_A_AV1>, <&cru SRST_A_AV1_BIU>,
+ <&cru SRST_P_AV1>, <&cru SRST_P_AV1_BIU>;
+ reset-names = "axi", "axi-biu", "apb", "apb-biu";
iommus = <&av1d_mmu>;
};
--
2.55.0
^ permalink raw reply related [flat|nested] 63+ messages in thread