Skip to contentSkip to conversation

Add support for Verisilicon IOMMU used by media codec blocks

PATCH Applied Benjamin Gaignard 3 participants 10 messages Apr 15 – May 11

Subsystems (4)
lore
Share & tools
lore

Benjamin Gaignard

author maintainer
#0 lore raw

v14 cover Add support for Verisilicon IOMMU used by media codec blocks

Hi all,

This patch series adds support for the Verisilicon IOMMU, which is found in front of hardware encoder and decoder blocks in several SoCs using Verisilicon IP. A first implementation of this IOMMU is available on the Rockchip RK3588 SoC.

Rockchip provides a driver for this hardware in their 6.1 kernel branch:
https://github.com/rockchip-linux/kernel/blob/develop-6.1/drivers/iommu/rockchip-iommu-av1d.c

This series includes:
- a new binding for the Verisilicon IOMMU
- a driver implementation
- DT updates for RK3588

The driver was forward-ported from Rockchip’s 6.1 implementation, the prefix was renamed to vsi for generality, and several fixes were applied.

AV1 decoding was tested using the stateless VPU driver and Fluster. The test results show a score of 205/239, which confirms that no regressions were introduced by this series.

Feedback and testing welcome.

changes in version 14:
- Flush TLB after each map/unmap operations.
- Remove vsi_iommu_restore_ctx() and do not touch Verisilicon stateless video decoder.
- Allow to build the driver as a module.

changes in version 13:
- On top the driver file explicit why the hardware is different than Rockchip IOMMU
- Document why vsi_iommu_restore_ctx() is needed when using Verisilicon stateless video decoder.

changes in version 12:
- Remove useless vsi_iommu_flush_tlb_all()
- Merge MAINTAINERS changes in the patch introducing VSI iommu driver

Benjamin Gaignard (5):
dt-bindings: vendor-prefixes: Add Verisilicon
dt-bindings: iommu: verisilicon: Add binding for VSI IOMMU
iommu: Add verisilicon IOMMU driver
arm64: dts: rockchip: Add verisilicon IOMMU node on RK3588
arm64: defconfig: enable Verisilicon IOMMU for Rockchip RK3588

 .../bindings/iommu/verisilicon,iommu.yaml     |  71 ++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 MAINTAINERS                                   |   8 +
 arch/arm64/boot/dts/rockchip/rk3588-base.dtsi |  11 +
 arch/arm64/configs/defconfig                  |   1 +
 drivers/iommu/Kconfig                         |  11 +
 drivers/iommu/Makefile                        |   1 +
 drivers/iommu/vsi-iommu.c                     | 796 ++++++++++++++++++
 8 files changed, 901 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml
 create mode 100644 drivers/iommu/vsi-iommu.c
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH v14 1/5 dt-bindings: vendor-prefixes: Add Verisilicon

Verisilicon Microelectronics is a company based in Shanghai, China, developping hardware blocks for SoC.

https://verisilicon.com/

Add their name to the list of vendors.

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index ee7fd3cfe203..ebd9072300a8 100644
@@ -1761,6 +1761,8 @@ patternProperties:
     description: Variscite Ltd.
   "^vdl,.*":
     description: Van der Laan b.v.
+  "^verisilicon,.*":
+    description: VeriSilicon Microelectronics
   "^vertexcom,.*":
     description: Vertexcom Technologies, Inc.
   "^via,.*":
Signature · 1 line
2.43.0
author maintainer
#4 lore raw

PATCH v14 2/5 dt-bindings: iommu: verisilicon: Add binding for VSI IOMMU

In reply to Benjamin Gaignard

Add a device tree binding for the Verisilicon (VSI) IOMMU. This IOMMU sits in front of hardware encoder and decoder blocks on SoCs using Verisilicon IP, such as the Rockchip RK3588.

---
 .../bindings/iommu/verisilicon,iommu.yaml     | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml
Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml new file +71 -0
new file mode 100644
index 000000000000..d3ce9e603b61
@@ -0,0 +1,71 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iommu/verisilicon,iommu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Verisilicon IOMMU
+
+maintainers:
+  - Benjamin Gaignard <[email protected]>
+
+description: |+
+  A Versilicon iommu translates io virtual addresses to physical addresses for
+  its associated video decoder.
+
+properties:
+  compatible:
+    items:
+      - const: rockchip,rk3588-av1-iommu
+      - const: verisilicon,iommu-1.2
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: Core clock
+      - description: Interface clock
+
+  clock-names:
+    items:
+      - const: core
+      - const: iface
+
+  "#iommu-cells":
+    const: 0
+
+  power-domains:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - "#iommu-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/rockchip,rk3588-cru.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    bus {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      iommu@fdca0000 {
+        compatible = "rockchip,rk3588-av1-iommu","verisilicon,iommu-1.2";
+        reg = <0x0 0xfdca0000 0x0 0x600>;
+        interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH 0>;
+        clocks = <&cru ACLK_AV1>, <&cru PCLK_AV1>;
+        clock-names = "core", "iface";
+        #iommu-cells = <0>;
+      };
+    };
Signature · 1 line
2.43.0
author maintainer
#5 lore raw

PATCH v14 3/5 iommu: Add verisilicon IOMMU driver

In reply to Benjamin Gaignard

The Verisilicon IOMMU hardware block can be found in combination with Verisilicon hardware video codecs (encoders or decoders) on different SoCs.
Enable it will allow us to use non contiguous memory allocators for Verisilicon video codecs.

---
changes in version 14:
- Flush TLB after each map/unmap operations.
- Remove vsi_iommu_restore_ctx() and do not touch Verisilicon stateless video decoder.
- Allow to build the driver as a module.

 MAINTAINERS               |   8 +
 drivers/iommu/Kconfig     |  11 +
 drivers/iommu/Makefile    |   1 +
 drivers/iommu/vsi-iommu.c | 796 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 816 insertions(+)
 create mode 100644 drivers/iommu/vsi-iommu.c
MAINTAINERS +8 -0
index c3fe46d7c4bc..fa56dd0e3f25 100644
@@ -27667,6 +27667,14 @@ F:	drivers/media/v4l2-core/v4l2-isp.c
 F:	include/media/v4l2-isp.h
 F:	include/uapi/linux/media/v4l2-isp.h
 
+VERISILICON IOMMU DRIVER
+M:	Benjamin Gaignard <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml
+F:	drivers/iommu/vsi-iommu.c
+F:	include/linux/vsi-iommu.h
+
 VF610 NAND DRIVER
 M:	Stefan Agner <[email protected]>
 L:	[email protected]
drivers/iommu/Kconfig +11 -0
index f86262b11416..18d3d68af7cd 100644
@@ -384,6 +384,17 @@ config SPRD_IOMMU
 
 	  Say Y here if you want to use the multimedia devices listed above.
 
+config VSI_IOMMU
+	tristate "Verisilicon IOMMU Support"
+	depends on (ARCH_ROCKCHIP && ARM64) || COMPILE_TEST
+	select IOMMU_API
+	help
+	  Support for IOMMUs used by Verisilicon sub-systems like video
+	  decoders or encoder hardware blocks.
+
+	  Say Y here if you want to use this IOMMU in front of these
+	  hardware blocks.
+
 config IOMMU_DEBUG_PAGEALLOC
 	bool "Debug IOMMU mappings against page allocations"
 	depends on DEBUG_PAGEALLOC && IOMMU_API && PAGE_EXTENSION
drivers/iommu/Makefile +1 -0
index 0275821f4ef9..887af357a7c9 100644
@@ -36,4 +36,5 @@ obj-$(CONFIG_IOMMU_SVA) += iommu-sva.o
 obj-$(CONFIG_IOMMU_IOPF) += io-pgfault.o
 obj-$(CONFIG_SPRD_IOMMU) += sprd-iommu.o
 obj-$(CONFIG_APPLE_DART) += apple-dart.o
+obj-$(CONFIG_VSI_IOMMU) += vsi-iommu.o
 obj-$(CONFIG_IOMMU_DEBUG_PAGEALLOC) += iommu-debug-pagealloc.o
drivers/iommu/vsi-iommu.c new file +796 -0

796 lines not on this page · raw message

Signature · 1 line
2.43.0
author maintainer
#6 lore raw

PATCH v14 4/5 arm64: dts: rockchip: Add verisilicon IOMMU node on RK3588

In reply to Benjamin Gaignard

Add the device tree node for the Verisilicon IOMMU present in the RK3588 SoC.
This IOMMU handles address translation for the VPU hardware blocks.

---
 arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +11 -0
index 7fe9593d8c19..7fde18feeaf8 100644
@@ -1428,6 +1428,17 @@ av1d: video-codec@fdc70000 {
 		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>;
+		iommus = <&av1d_mmu>;
+	};
+
+	av1d_mmu: iommu@fdca0000 {
+		compatible = "rockchip,rk3588-av1-iommu", "verisilicon,iommu-1.2";
+		reg = <0x0 0xfdca0000 0x0 0x600>;
+		interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH 0>;
+		clocks = <&cru ACLK_AV1>, <&cru PCLK_AV1>;
+		clock-names = "core", "iface";
+		#iommu-cells = <0>;
+		power-domains = <&power RK3588_PD_AV1>;
 	};
 
 	vop: vop@fdd90000 {
Signature · 1 line
2.43.0
author maintainer
#7 lore raw

PATCH v14 5/5 arm64: defconfig: enable Verisilicon IOMMU for Rockchip RK3588

In reply to Benjamin Gaignard

Enable Verisilicon IOMMU used by Rockchip RK3588 AV1 hardware codec. This hardware block could be found in Radxa ROCK 5B board.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index b67d5b1fc45b..b97f5008f6be 100644
@@ -1592,6 +1592,7 @@ CONFIG_ARM_SMMU_V3=y
 CONFIG_MTK_IOMMU=y
 CONFIG_QCOM_IOMMU=y
 CONFIG_APPLE_DART=m
+CONFIG_VSI_IOMMU=m
 CONFIG_REMOTEPROC=y
 CONFIG_IMX_REMOTEPROC=y
 CONFIG_MTK_SCP=m
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v14 1/5] dt-bindings: vendor-prefixes: Add Verisilicon

In reply to Benjamin Gaignard
Quoted 18 lines · Benjamin Gaignard

Verisilicon Microelectronics is a company based in Shanghai, China, developping hardware blocks for SoC.

https://verisilicon.com/

Add their name to the list of vendors.

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +0 -0
index ee7fd3cfe203..ebd9072300a8 100644

Documentation/devicetree/bindings/vendor-prefixes.yaml patternProperties: · line 1768

Quoted 8 lines
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -1761,6 +1761,8 @@ patternProperties:
     description: Variscite Ltd.
   "^vdl,.*":
     description: Van der Laan b.v.
+  "^verisilicon,.*":
+    description: VeriSilicon Microelectronics
   "^vertexcom,.*":
     description: Vertexcom Technologies, Inc.
   "^via,.*":

FTR: Another version of this patch is already present in Linus' tree:
c131d78840d7 ("dt-bindings: vendor-prefixes: add verisilicon")

author maintainer
#3 lore raw

Re: [PATCH v14 1/5] dt-bindings: vendor-prefixes: Add Verisilicon

Le 09/05/2026 à 19:56, Diederik de Haas a écrit :

Quoted 14 lines · Benjamin Gaignard
Quoted 13 lines

Verisilicon Microelectronics is a company based in Shanghai, China, developping hardware blocks for SoC.

https://verisilicon.com/

Add their name to the list of vendors.

---
  Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
  1 file changed, 2 insertions(+)
Quoted 15 lines

Documentation/devicetree/bindings/vendor-prefixes.yaml patternProperties: · line 1768

Quoted 13 lines
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index ee7fd3cfe203..ebd9072300a8 100644
@@ -1761,6 +1761,8 @@ patternProperties:
      description: Variscite Ltd.
    "^vdl,.*":
      description: Van der Laan b.v.
+  "^verisilicon,.*":
+    description: VeriSilicon Microelectronics
    "^vertexcom,.*":
      description: Vertexcom Technologies, Inc.
    "^via,.*":

FTR: Another version of this patch is already present in Linus' tree:
c131d78840d7 ("dt-bindings: vendor-prefixes: add verisilicon")

It seems it has been merged right 7.0-rc1 that I used for this series. Both are almost identical so we can ignore mine.

Regards,
Benjamin

maintainer Applied
#8 lore raw
In reply to Benjamin Gaignard
Quoted 7 lines · Benjamin Gaignard

Benjamin Gaignard (5):
dt-bindings: vendor-prefixes: Add Verisilicon
dt-bindings: iommu: verisilicon: Add binding for VSI IOMMU
iommu: Add verisilicon IOMMU driver
arm64: dts: rockchip: Add verisilicon IOMMU node on RK3588
arm64: defconfig: enable Verisilicon IOMMU for Rockchip RK3588

Quoted 11 lines
 .../bindings/iommu/verisilicon,iommu.yaml     |  71 ++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 MAINTAINERS                                   |   8 +
 arch/arm64/boot/dts/rockchip/rk3588-base.dtsi |  11 +
 arch/arm64/configs/defconfig                  |   1 +
 drivers/iommu/Kconfig                         |  11 +
 drivers/iommu/Makefile                        |   1 +
 drivers/iommu/vsi-iommu.c                     | 796 ++++++++++++++++++
 8 files changed, 901 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml
 create mode 100644 drivers/iommu/vsi-iommu.c

Applied to the new verisilicon branch.

author maintainer
#9 lore raw

Le 11/05/2026 à 10:01, Jörg Rödel a écrit :

Quoted 19 lines · Benjamin Gaignard
Quoted 16 lines

Benjamin Gaignard (5):
dt-bindings: vendor-prefixes: Add Verisilicon
dt-bindings: iommu: verisilicon: Add binding for VSI IOMMU
iommu: Add verisilicon IOMMU driver
arm64: dts: rockchip: Add verisilicon IOMMU node on RK3588
arm64: defconfig: enable Verisilicon IOMMU for Rockchip RK3588

  .../bindings/iommu/verisilicon,iommu.yaml     |  71 ++
  .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
  MAINTAINERS                                   |   8 +
  arch/arm64/boot/dts/rockchip/rk3588-base.dtsi |  11 +
  arch/arm64/configs/defconfig                  |   1 +
  drivers/iommu/Kconfig                         |  11 +
  drivers/iommu/Makefile                        |   1 +
  drivers/iommu/vsi-iommu.c                     | 796 ++++++++++++++++++
  8 files changed, 901 insertions(+)
Quoted 2 lines

create mode 100644 Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml create mode 100644 drivers/iommu/vsi-iommu.c

Quoted 1 line

Applied to the new verisilicon branch.

Thanks a lot.

Regards,
Benjamin