Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arun Iyengar" <aiyengar1990@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	media-ci@linuxtv.org
Subject: Re: [PATCH v4 13/18] arm64: dts: rockchip: Add the reset lines of the RK3588 VEPU121 cores
Date: Sun, 06 Dec 2026 06:26:10 +0000	[thread overview]
Message-ID: <sashiko-outbox-252223@kernel.org> (raw)
In-Reply-To: <20261206-hantro-robust-v4-13-b99d33a5ec6d@gmail.com>

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

  reply	other threads:[~2026-12-06  6:26 UTC|newest]

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

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=sashiko-outbox-252223@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=aiyengar1990@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=media-ci@linuxtv.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

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

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