ARM Sunxi Platform Development
 help / color / mirror / Atom feed
* [PATCH v2 0/7] arm64: allwinner: h616: Support Video Engine
@ 2026-07-11 13:59 Chen-Yu Tsai
  2026-07-11 13:59 ` [PATCH v2 1/7] dt-bindings: media: sun4i-a10-video-engine: Fix IOMMU count for H6 Chen-Yu Tsai
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Chen-Yu Tsai @ 2026-07-11 13:59 UTC (permalink / raw)
  To: Maxime Ripard, Paul Kocialkowski, Mauro Carvalho Chehab,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Greg Kroah-Hartman, linux-media, linux-staging, devicetree,
	linux-sunxi, linux-arm-kernel, linux-kernel

Hi folks,


This is v2 of my Allwinner H616 Cedrus series. The series is ready to be
merged.

Changes since v1:
- Fixed IOMMU ports on H616 (patch 7)
- Updated comment about VP9 on H616


This series adds support for the Cedar video engine found in the
Allwinner H616 SoC. On the way, it also fixes some issues with the
DT representation for the Allwinner H6 SoC.

Patch 1 fixes the video engine's number of IOMMU endpoints on the
H6 in the DT binding.

Patch 2 fixes the video engine's number of SRAM regions on the
H6 in the DT binding.

Patch 3 adds a new compatible for the H616's video engine.

Patch 4 adds the new compatible for the H616's video engine to the
cedrus driver.

Patch 5 adds the video engine's missing SRAM region to the H6 dtsi.

Patch 6 adds the video engine's missing IOMMU endpoint to the H6 dtsi.

Patch 7 adds a device node for the video engine to the H616 dtsi.


Patches 1-4 should go through the media tree, while patches 5-7 will go
through the soc tree via the sunxi tree.


Please have a look.


Thanks
ChenYu


Chen-Yu Tsai (6):
  dt-bindings: media: sun4i-a10-video-engine: Fix IOMMU count for H6
  dt-bindings: media: sun4i-a10-video-engine: Fix SRAM count for H6
  dt-bindings: media: sun4i-a10-video-engine: Add H616 compatible
  drivers: staging: media: sunxi: cedrus: add H616 variant
  arm64: dts: allwinner: sun50i-h6: Add missing SRAM region for video
    engine
  arm64: dts: allwinner: sun50i-h6: Add missing IOMMU for video engine

Jernej Skrabec (1):
  arm64: dts: allwinner: sun50i-h616: Add video engine

 .../allwinner,sun4i-a10-video-engine.yaml     | 45 ++++++++++++++++++-
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi  |  4 +-
 .../arm64/boot/dts/allwinner/sun50i-h616.dtsi | 12 +++++
 drivers/staging/media/sunxi/cedrus/cedrus.c   |  4 ++
 4 files changed, 61 insertions(+), 4 deletions(-)

-- 
2.47.3


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/7] dt-bindings: media: sun4i-a10-video-engine: Fix IOMMU count for H6
  2026-07-11 13:59 [PATCH v2 0/7] arm64: allwinner: h616: Support Video Engine Chen-Yu Tsai
@ 2026-07-11 13:59 ` Chen-Yu Tsai
  2026-07-11 13:59 ` [PATCH v2 2/7] dt-bindings: media: sun4i-a10-video-engine: Fix SRAM " Chen-Yu Tsai
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Chen-Yu Tsai @ 2026-07-11 13:59 UTC (permalink / raw)
  To: Maxime Ripard, Paul Kocialkowski, Mauro Carvalho Chehab,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Greg Kroah-Hartman, linux-media, linux-staging, devicetree,
	linux-sunxi, linux-arm-kernel, linux-kernel, Jernej Skrabec

On the H6 SoC, the Video Engine has two memory ports, thus two IOMMU
connections. The secondary one that is missing is likely used for
reading reference frames. The newer H616 is the same. On the other
hand, the D1 only has one memory port.

Add the missing IOMMU connection for the Video Engine.

Fixes: 62a8ccf3a248 ("arm64: dts: allwinner: h6: Fix Cedrus IOMMU usage")
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
---
 .../allwinner,sun4i-a10-video-engine.yaml     | 21 ++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
index 01f2afa023f0..932043d7f0cc 100644
--- a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
+++ b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
@@ -55,7 +55,10 @@ properties:
     description: Phandle to the device SRAM
 
   iommus:
-    maxItems: 1
+    minItems: 1
+    items:
+      - description: VE port on IOMMU
+      - description: VE_R port on IOMMU
 
   memory-region:
     maxItems: 1
@@ -82,6 +85,22 @@ required:
   - resets
   - allwinner,sram
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - allwinner,sun50i-h6-video-engine
+    then:
+      properties:
+        iommus:
+          minItems: 2
+    else:
+      properties:
+        iommus:
+          maxItems: 1
+
 additionalProperties: false
 
 examples:
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/7] dt-bindings: media: sun4i-a10-video-engine: Fix SRAM count for H6
  2026-07-11 13:59 [PATCH v2 0/7] arm64: allwinner: h616: Support Video Engine Chen-Yu Tsai
  2026-07-11 13:59 ` [PATCH v2 1/7] dt-bindings: media: sun4i-a10-video-engine: Fix IOMMU count for H6 Chen-Yu Tsai
@ 2026-07-11 13:59 ` Chen-Yu Tsai
  2026-07-11 13:59 ` [PATCH v2 3/7] dt-bindings: media: sun4i-a10-video-engine: Add H616 compatible Chen-Yu Tsai
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Chen-Yu Tsai @ 2026-07-11 13:59 UTC (permalink / raw)
  To: Maxime Ripard, Paul Kocialkowski, Mauro Carvalho Chehab,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Greg Kroah-Hartman, linux-media, linux-staging, devicetree,
	linux-sunxi, linux-arm-kernel, linux-kernel, Jernej Skrabec

On the H6, the SRAM C region includes an alias of part of the VE SRAM
used by the video engine. This region should also be claimed so that no
access happens through the alias window.

Add a second SRAM region phandle to the video engine for the H6.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
---
 .../allwinner,sun4i-a10-video-engine.yaml     | 21 ++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
index 932043d7f0cc..818d815d4732 100644
--- a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
+++ b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
@@ -48,11 +48,15 @@ properties:
 
   allwinner,sram:
     $ref: /schemas/types.yaml#/definitions/phandle-array
+    minItems: 1
     items:
       - items:
           - description: phandle to SRAM
           - description: register value for device
-    description: Phandle to the device SRAM
+      - items:
+          - description: phandle to SRAM alias
+          - description: register value for device
+    description: Phandle to the device SRAM(s)
 
   iommus:
     minItems: 1
@@ -101,6 +105,21 @@ allOf:
         iommus:
           maxItems: 1
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - allwinner,sun50i-h6-video-engine
+    then:
+      properties:
+        allwinner,sram:
+          minItems: 2
+    else:
+      properties:
+        allwinner,sram:
+          maxItems: 1
+
 additionalProperties: false
 
 examples:
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/7] dt-bindings: media: sun4i-a10-video-engine: Add H616 compatible
  2026-07-11 13:59 [PATCH v2 0/7] arm64: allwinner: h616: Support Video Engine Chen-Yu Tsai
  2026-07-11 13:59 ` [PATCH v2 1/7] dt-bindings: media: sun4i-a10-video-engine: Fix IOMMU count for H6 Chen-Yu Tsai
  2026-07-11 13:59 ` [PATCH v2 2/7] dt-bindings: media: sun4i-a10-video-engine: Fix SRAM " Chen-Yu Tsai
@ 2026-07-11 13:59 ` Chen-Yu Tsai
  2026-07-11 13:59 ` [PATCH v2 4/7] drivers: staging: media: sunxi: cedrus: add H616 variant Chen-Yu Tsai
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Chen-Yu Tsai @ 2026-07-11 13:59 UTC (permalink / raw)
  To: Maxime Ripard, Paul Kocialkowski, Mauro Carvalho Chehab,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Greg Kroah-Hartman, linux-media, linux-staging, devicetree,
	linux-sunxi, linux-arm-kernel, linux-kernel, Jernej Skrabec

The H616 contains a video engine similar to past SoCs.

Add a new compatible for it.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
---
 .../bindings/media/allwinner,sun4i-a10-video-engine.yaml       | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
index 818d815d4732..20c430795134 100644
--- a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
+++ b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-video-engine.yaml
@@ -24,6 +24,7 @@ properties:
       - allwinner,sun50i-a64-video-engine
       - allwinner,sun50i-h5-video-engine
       - allwinner,sun50i-h6-video-engine
+      - allwinner,sun50i-h616-video-engine
 
   reg:
     maxItems: 1
@@ -96,6 +97,7 @@ allOf:
           contains:
             enum:
               - allwinner,sun50i-h6-video-engine
+              - allwinner,sun50i-h616-video-engine
     then:
       properties:
         iommus:
@@ -111,6 +113,7 @@ allOf:
           contains:
             enum:
               - allwinner,sun50i-h6-video-engine
+              - allwinner,sun50i-h616-video-engine
     then:
       properties:
         allwinner,sram:
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/7] drivers: staging: media: sunxi: cedrus: add H616 variant
  2026-07-11 13:59 [PATCH v2 0/7] arm64: allwinner: h616: Support Video Engine Chen-Yu Tsai
                   ` (2 preceding siblings ...)
  2026-07-11 13:59 ` [PATCH v2 3/7] dt-bindings: media: sun4i-a10-video-engine: Add H616 compatible Chen-Yu Tsai
@ 2026-07-11 13:59 ` Chen-Yu Tsai
  2026-07-11 13:59 ` [PATCH v2 5/7] arm64: dts: allwinner: sun50i-h6: Add missing SRAM region for video engine Chen-Yu Tsai
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Chen-Yu Tsai @ 2026-07-11 13:59 UTC (permalink / raw)
  To: Maxime Ripard, Paul Kocialkowski, Mauro Carvalho Chehab,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Greg Kroah-Hartman, linux-media, linux-staging, devicetree,
	linux-sunxi, linux-arm-kernel, linux-kernel, Jernej Skrabec

The Allwinner H616 SoC has a video engine hardware block like the one
found on previous generations such as the H6. In addition to the
currently supported features of the H6, it also includes a VP9 decoder.
Support for VP9 will be added separately.

Add the compatible for the H616 variant, using the H6 variant data.

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
---
Changes since v1:
- Updated commit message on VP9 decoder status
---
 drivers/staging/media/sunxi/cedrus/cedrus.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c
index bbd186b8035b..ac0217976670 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.c
@@ -696,6 +696,10 @@ static const struct of_device_id cedrus_dt_match[] = {
 		.compatible = "allwinner,sun50i-h6-video-engine",
 		.data = &sun50i_h6_cedrus_variant,
 	},
+	{
+		.compatible = "allwinner,sun50i-h616-video-engine",
+		.data = &sun50i_h6_cedrus_variant,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, cedrus_dt_match);
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 5/7] arm64: dts: allwinner: sun50i-h6: Add missing SRAM region for video engine
  2026-07-11 13:59 [PATCH v2 0/7] arm64: allwinner: h616: Support Video Engine Chen-Yu Tsai
                   ` (3 preceding siblings ...)
  2026-07-11 13:59 ` [PATCH v2 4/7] drivers: staging: media: sunxi: cedrus: add H616 variant Chen-Yu Tsai
@ 2026-07-11 13:59 ` Chen-Yu Tsai
  2026-07-11 14:08   ` sashiko-bot
  2026-07-11 13:59 ` [PATCH v2 6/7] arm64: dts: allwinner: sun50i-h6: Add missing IOMMU " Chen-Yu Tsai
  2026-07-11 13:59 ` [PATCH v2 7/7] arm64: dts: allwinner: sun50i-h616: Add " Chen-Yu Tsai
  6 siblings, 1 reply; 13+ messages in thread
From: Chen-Yu Tsai @ 2026-07-11 13:59 UTC (permalink / raw)
  To: Maxime Ripard, Paul Kocialkowski, Mauro Carvalho Chehab,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Greg Kroah-Hartman, linux-media, linux-staging, devicetree,
	linux-sunxi, linux-arm-kernel, linux-kernel, Jernej Skrabec

The SRAM C region contains a partial alias to the VE SRAM already
referenced by the video engine. To avoid access through this alias
window, the region should also be claimed by the video engine.

Add a reference to the SRAM C region to the video engine node.

Fixes: b542570e5605 ("arm64: dts: allwinner: h6: Add Video Engine node")
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
---
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
index 72ce1a75647b..88c6e3e105c0 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
@@ -205,7 +205,7 @@ video-codec@1c0e000 {
 			clock-names = "ahb", "mod", "ram";
 			resets = <&ccu RST_BUS_VE>;
 			interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
-			allwinner,sram = <&ve_sram 1>;
+			allwinner,sram = <&ve_sram 1>, <&de2_sram 1>;
 			iommus = <&iommu 3>;
 		};
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 6/7] arm64: dts: allwinner: sun50i-h6: Add missing IOMMU for video engine
  2026-07-11 13:59 [PATCH v2 0/7] arm64: allwinner: h616: Support Video Engine Chen-Yu Tsai
                   ` (4 preceding siblings ...)
  2026-07-11 13:59 ` [PATCH v2 5/7] arm64: dts: allwinner: sun50i-h6: Add missing SRAM region for video engine Chen-Yu Tsai
@ 2026-07-11 13:59 ` Chen-Yu Tsai
  2026-07-11 14:08   ` sashiko-bot
  2026-07-11 13:59 ` [PATCH v2 7/7] arm64: dts: allwinner: sun50i-h616: Add " Chen-Yu Tsai
  6 siblings, 1 reply; 13+ messages in thread
From: Chen-Yu Tsai @ 2026-07-11 13:59 UTC (permalink / raw)
  To: Maxime Ripard, Paul Kocialkowski, Mauro Carvalho Chehab,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Greg Kroah-Hartman, linux-media, linux-staging, devicetree,
	linux-sunxi, linux-arm-kernel, linux-kernel, Jernej Skrabec

The video engine on the H6 actually has two IOMMU ports. The one already
listed is simply named "VE" in the user manual. The missing one is named
"VE_R" and is probably either read-only or used for reference frames.
Either way, it should be listed.

Add a reference to the "VE_R" IOMMU port to the video engine node.

Fixes: 62a8ccf3a248 ("arm64: dts: allwinner: h6: Fix Cedrus IOMMU usage")
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
---
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
index 88c6e3e105c0..48c771223af4 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
@@ -206,7 +206,7 @@ video-codec@1c0e000 {
 			resets = <&ccu RST_BUS_VE>;
 			interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
 			allwinner,sram = <&ve_sram 1>, <&de2_sram 1>;
-			iommus = <&iommu 3>;
+			iommus = <&iommu 3>, <&iommu 1>;
 		};
 
 		gpu: gpu@1800000 {
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 7/7] arm64: dts: allwinner: sun50i-h616: Add video engine
  2026-07-11 13:59 [PATCH v2 0/7] arm64: allwinner: h616: Support Video Engine Chen-Yu Tsai
                   ` (5 preceding siblings ...)
  2026-07-11 13:59 ` [PATCH v2 6/7] arm64: dts: allwinner: sun50i-h6: Add missing IOMMU " Chen-Yu Tsai
@ 2026-07-11 13:59 ` Chen-Yu Tsai
  2026-07-11 14:11   ` sashiko-bot
  2026-07-11 15:13   ` Andre Przywara
  6 siblings, 2 replies; 13+ messages in thread
From: Chen-Yu Tsai @ 2026-07-11 13:59 UTC (permalink / raw)
  To: Maxime Ripard, Paul Kocialkowski, Mauro Carvalho Chehab,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Jernej Skrabec, Greg Kroah-Hartman, linux-media, linux-staging,
	devicetree, linux-sunxi, linux-arm-kernel, linux-kernel

From: Jernej Skrabec <jernej.skrabec@gmail.com>

The H616 SoC has a video engine, and two SRAM regions needed by it.

Add the video engine to the dtsi file.

Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
[wens@kernel.org: Add VE SRAM region and commit message]
Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
---
Changes since v1:
- Corrected second IOMMU port
---
 arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
index 1598e86259ab..c6b3a3f8359a 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
@@ -175,6 +175,18 @@ crypto: crypto@1904000 {
 			resets = <&ccu RST_BUS_CE>;
 		};
 
+		video-codec@1c0e000 {
+			compatible = "allwinner,sun50i-h616-video-engine";
+			reg = <0x01c0e000 0x2000>;
+			clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>,
+				 <&ccu CLK_MBUS_VE>;
+			clock-names = "ahb", "mod", "ram";
+			resets = <&ccu RST_BUS_VE>;
+			interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
+			iommus = <&iommu 3>, <&iommu 2>;
+			allwinner,sram = <&ve_sram 1>, <&sram_c 1>;
+		};
+
 		syscon: syscon@3000000 {
 			compatible = "allwinner,sun50i-h616-system-control";
 			reg = <0x03000000 0x1000>;
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 6/7] arm64: dts: allwinner: sun50i-h6: Add missing IOMMU for video engine
  2026-07-11 13:59 ` [PATCH v2 6/7] arm64: dts: allwinner: sun50i-h6: Add missing IOMMU " Chen-Yu Tsai
@ 2026-07-11 14:08   ` sashiko-bot
  0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-07-11 14:08 UTC (permalink / raw)
  To: Chen-Yu Tsai; +Cc: conor+dt, linux-sunxi, robh, devicetree

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] The sun50i-iommu driver fails to properly detach domains from the hardware due to an unbalanced refcount, leading to a use-after-free of the domain structure.
- [High] The sun50i-iommu driver assigns a separate IOMMU group/domain per device despite the hardware only supporting a single global translation table, causing devices to overwrite each other's page tables.
--

--- Patch [6]: [PATCH v2 6/7] arm64: dts: allwinner: sun50i-h6: Add missing IOMMU for video engine ---
commit 8a79dfe07f469620b0b60592b02052d1c198fe97
Author: Chen-Yu Tsai <wens@kernel.org>

arm64: dts: allwinner: sun50i-h6: Add missing IOMMU for video engine
    
This commit adds a missing IOMMU port ("VE_R") to the video engine node
in the sun50i-h6 device tree.

> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> index 88c6e3e105c07..48c771223af4d 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> @@ -206,7 +206,7 @@ video-codec@1c0e000 {
>  			resets = <&ccu RST_BUS_VE>;
>  			interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
>  			allwinner,sram = <&ve_sram 1>, <&de2_sram 1>;
> -			iommus = <&iommu 3>;
> +			iommus = <&iommu 3>, <&iommu 1>;

[Severity: High]
This is a pre-existing issue, but does adding a second IOMMU trigger a
use-after-free during device unbind?

Looking at the sun50i-iommu driver, sun50i_iommu_domain_alloc_paging() sets
the domain refcount to 1:

drivers/iommu/sun50i-iommu.c:sun50i_iommu_domain_alloc_paging() {
    ...
	refcount_set(&sun50i_domain->refcnt, 1);
    ...
}

Later, when a device is detached, sun50i_iommu_identity_attach()
decrements it:

drivers/iommu/sun50i-iommu.c:sun50i_iommu_identity_attach() {
    ...
	sun50i_domain = to_sun50i_domain(iommu->domain);
	if (refcount_dec_and_test(&sun50i_domain->refcnt))
		sun50i_iommu_detach_domain(iommu, sun50i_domain);
    ...
}

Because the reference count drops from 2 to 1 here, it fails to reach 0 and
bypasses the domain detachment. This leaves iommu->domain as a dangling
pointer which is later freed by sun50i_iommu_domain_free(). Could this
cause a kernel panic on a subsequent IOMMU page fault interrupt since it
dereferences the freed pointer?

[Severity: High]
This isn't a bug introduced by this patch, but does adding another IOMMU
reference here break DMA due to a single global translation table?

The sun50i-iommu driver assigns a separate IOMMU group per device:

drivers/iommu/sun50i-iommu.c:
static const struct iommu_ops sun50i_iommu_ops = {
    ...
	.device_group	= generic_single_device_group,
    ...
};

Since the hardware only supports a single global translation table
(IOMMU_TTB_REG), placing every device into its own independent group and
domain means multiple devices will repeatedly overwrite the shared IOMMU's
domain on probe. Will enabling this second IOMMU port overwrite previously
configured translation tables and corrupt memory for other devices?

>  		};
>  
>  		gpu: gpu@1800000 {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260711135959.3616919-1-wens@kernel.org?part=6

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 5/7] arm64: dts: allwinner: sun50i-h6: Add missing SRAM region for video engine
  2026-07-11 13:59 ` [PATCH v2 5/7] arm64: dts: allwinner: sun50i-h6: Add missing SRAM region for video engine Chen-Yu Tsai
@ 2026-07-11 14:08   ` sashiko-bot
  2026-07-11 14:51     ` Chen-Yu Tsai
  0 siblings, 1 reply; 13+ messages in thread
From: sashiko-bot @ 2026-07-11 14:08 UTC (permalink / raw)
  To: Chen-Yu Tsai; +Cc: conor+dt, linux-sunxi, devicetree, robh

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Adding a second phandle to the `allwinner,sram` property has no effect at runtime because the sunxi_sram driver infrastructure hardcodes parsing to only the first index.
--

--- Patch [5]: [PATCH v2 5/7] arm64: dts: allwinner: sun50i-h6: Add missing SRAM region for video engine ---
commit 8b2bcf328faa458d85d11e3cef06ddda86e2e10e
Author: Chen-Yu Tsai <wens@kernel.org>

arm64: dts: allwinner: sun50i-h6: Add missing SRAM region for video engine

This commit adds a reference to the SRAM C region in the video engine node
to prevent access through a partial alias window.

> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> @@ -205,7 +205,7 @@ video-codec@1c0e000 {
>  			clock-names = "ahb", "mod", "ram";
>  			resets = <&ccu RST_BUS_VE>;
>  			interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
> -			allwinner,sram = <&ve_sram 1>;
> +			allwinner,sram = <&ve_sram 1>, <&de2_sram 1>;

[Severity: Medium]
Will the second phandle be silently ignored during runtime?

Looking at the cedrus driver, it calls sunxi_sram_claim() during probe.
However, the underlying infrastructure appears to hardcode index 0 when
parsing this property:

drivers/soc/sunxi/sunxi_sram.c:sunxi_sram_of_parse() {
    ...
    ret = of_parse_phandle_with_fixed_args(node, "allwinner,sram", 1, 0,
                                           &args);
    ...
}

Does the driver infrastructure need to be updated to parse multiple indices
before this device tree addition takes effect?

>  			iommus = <&iommu 3>;
>  		};

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260711135959.3616919-1-wens@kernel.org?part=5

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 7/7] arm64: dts: allwinner: sun50i-h616: Add video engine
  2026-07-11 13:59 ` [PATCH v2 7/7] arm64: dts: allwinner: sun50i-h616: Add " Chen-Yu Tsai
@ 2026-07-11 14:11   ` sashiko-bot
  2026-07-11 15:13   ` Andre Przywara
  1 sibling, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-07-11 14:11 UTC (permalink / raw)
  To: Chen-Yu Tsai; +Cc: robh, conor+dt, linux-sunxi, devicetree

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] The video-codec node references a non-existent label 've_sram', causing a Device Tree Compiler (DTC) build failure.
- [Low] The `allwinner,sram` property incorrectly references the generic `mmio-sram` parent controller node (`&sram_c`) instead of an `sram-section` child node.
--

--- Patch [7]: [PATCH v2 7/7] arm64: dts: allwinner: sun50i-h616: Add video engine ---
commit f351af2797d5cc85ad73122a961f9b9e63f82153
Author: Jernej Skrabec <jernej.skrabec@gmail.com>

arm64: dts: allwinner: sun50i-h616: Add video engine

This commit adds the video engine node to the sun50i-h616 device tree file.
It defines the required memory regions, clocks, resets, interrupts, and
SRAM nodes needed by the engine.

> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
[ ... ]
> @@ -175,6 +175,18 @@ crypto: crypto@1904000 {
>  			resets = <&ccu RST_BUS_CE>;
>  		};
>  
> +		video-codec@1c0e000 {
> +			compatible = "allwinner,sun50i-h616-video-engine";
> +			reg = <0x01c0e000 0x2000>;
> +			clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>,
> +				 <&ccu CLK_MBUS_VE>;
> +			clock-names = "ahb", "mod", "ram";
> +			resets = <&ccu RST_BUS_VE>;
> +			interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
> +			iommus = <&iommu 3>, <&iommu 2>;
> +			allwinner,sram = <&ve_sram 1>, <&sram_c 1>;

[Severity: Low]
Is the ve_sram label defined elsewhere? The Device Tree Compiler (DTC) will
fail to build because of this unresolved reference. It appears the sram_c1
node and its ve_sram child section might be missing.

[Severity: Low]
Does the second phandle correctly reference an sram-section child node?
Referencing &sram_c here points to the generic mmio-sram parent controller
node, which lacks #sram-cells. This violates the bindings and triggers a
dt-validate schema failure.

> +		};
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260711135959.3616919-1-wens@kernel.org?part=7

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 5/7] arm64: dts: allwinner: sun50i-h6: Add missing SRAM region for video engine
  2026-07-11 14:08   ` sashiko-bot
@ 2026-07-11 14:51     ` Chen-Yu Tsai
  0 siblings, 0 replies; 13+ messages in thread
From: Chen-Yu Tsai @ 2026-07-11 14:51 UTC (permalink / raw)
  To: sashiko-reviews; +Cc: conor+dt, linux-sunxi, devicetree, robh

On Sat, Jul 11, 2026 at 10:08 PM <sashiko-bot@kernel.org> wrote:
>
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Adding a second phandle to the `allwinner,sram` property has no effect at runtime because the sunxi_sram driver infrastructure hardcodes parsing to only the first index.
> --
>
> --- Patch [5]: [PATCH v2 5/7] arm64: dts: allwinner: sun50i-h6: Add missing SRAM region for video engine ---
> commit 8b2bcf328faa458d85d11e3cef06ddda86e2e10e
> Author: Chen-Yu Tsai <wens@kernel.org>
>
> arm64: dts: allwinner: sun50i-h6: Add missing SRAM region for video engine
>
> This commit adds a reference to the SRAM C region in the video engine node
> to prevent access through a partial alias window.
>
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > @@ -205,7 +205,7 @@ video-codec@1c0e000 {
> >                       clock-names = "ahb", "mod", "ram";
> >                       resets = <&ccu RST_BUS_VE>;
> >                       interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
> > -                     allwinner,sram = <&ve_sram 1>;
> > +                     allwinner,sram = <&ve_sram 1>, <&de2_sram 1>;
>
> [Severity: Medium]
> Will the second phandle be silently ignored during runtime?
>
> Looking at the cedrus driver, it calls sunxi_sram_claim() during probe.
> However, the underlying infrastructure appears to hardcode index 0 when
> parsing this property:
>
> drivers/soc/sunxi/sunxi_sram.c:sunxi_sram_of_parse() {
>     ...
>     ret = of_parse_phandle_with_fixed_args(node, "allwinner,sram", 1, 0,
>                                            &args);

Yeah, no. Sashiko's context needs to be updated. This was changed in
commit be99eb936b4f ("soc: sunxi: sram: Support claiming multiple regions
per device") in v7.2-rc1.

>     ...
> }
>
> Does the driver infrastructure need to be updated to parse multiple indices
> before this device tree addition takes effect?
>
> >                       iommus = <&iommu 3>;
> >               };
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260711135959.3616919-1-wens@kernel.org?part=5

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 7/7] arm64: dts: allwinner: sun50i-h616: Add video engine
  2026-07-11 13:59 ` [PATCH v2 7/7] arm64: dts: allwinner: sun50i-h616: Add " Chen-Yu Tsai
  2026-07-11 14:11   ` sashiko-bot
@ 2026-07-11 15:13   ` Andre Przywara
  1 sibling, 0 replies; 13+ messages in thread
From: Andre Przywara @ 2026-07-11 15:13 UTC (permalink / raw)
  To: Chen-Yu Tsai, Maxime Ripard, Paul Kocialkowski,
	Mauro Carvalho Chehab, Jernej Skrabec, Samuel Holland,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Jernej Skrabec, Greg Kroah-Hartman, linux-media, linux-staging,
	devicetree, linux-sunxi, linux-arm-kernel, linux-kernel

Hi,

On 7/11/26 15:59, Chen-Yu Tsai wrote:
> From: Jernej Skrabec <jernej.skrabec@gmail.com>
> 
> The H616 SoC has a video engine, and two SRAM regions needed by it.
> 
> Add the video engine to the dtsi file.
> 
> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> [wens@kernel.org: Add VE SRAM region and commit message]
> Signed-off-by: Chen-Yu Tsai <wens@kernel.org>

Checked against the binding and the manual: clocks, regs, interrupts and 
reset matches. Also test-built the DTB: that worked fine, not sure what 
Sashiko was complaining about.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Thanks,
Andre

> ---
> Changes since v1:
> - Corrected second IOMMU port
> ---
>   arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
> index 1598e86259ab..c6b3a3f8359a 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
> @@ -175,6 +175,18 @@ crypto: crypto@1904000 {
>   			resets = <&ccu RST_BUS_CE>;
>   		};
>   
> +		video-codec@1c0e000 {
> +			compatible = "allwinner,sun50i-h616-video-engine";
> +			reg = <0x01c0e000 0x2000>;
> +			clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>,
> +				 <&ccu CLK_MBUS_VE>;
> +			clock-names = "ahb", "mod", "ram";
> +			resets = <&ccu RST_BUS_VE>;
> +			interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
> +			iommus = <&iommu 3>, <&iommu 2>;
> +			allwinner,sram = <&ve_sram 1>, <&sram_c 1>;
> +		};
> +
>   		syscon: syscon@3000000 {
>   			compatible = "allwinner,sun50i-h616-system-control";
>   			reg = <0x03000000 0x1000>;


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-07-11 15:13 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-11 13:59 [PATCH v2 0/7] arm64: allwinner: h616: Support Video Engine Chen-Yu Tsai
2026-07-11 13:59 ` [PATCH v2 1/7] dt-bindings: media: sun4i-a10-video-engine: Fix IOMMU count for H6 Chen-Yu Tsai
2026-07-11 13:59 ` [PATCH v2 2/7] dt-bindings: media: sun4i-a10-video-engine: Fix SRAM " Chen-Yu Tsai
2026-07-11 13:59 ` [PATCH v2 3/7] dt-bindings: media: sun4i-a10-video-engine: Add H616 compatible Chen-Yu Tsai
2026-07-11 13:59 ` [PATCH v2 4/7] drivers: staging: media: sunxi: cedrus: add H616 variant Chen-Yu Tsai
2026-07-11 13:59 ` [PATCH v2 5/7] arm64: dts: allwinner: sun50i-h6: Add missing SRAM region for video engine Chen-Yu Tsai
2026-07-11 14:08   ` sashiko-bot
2026-07-11 14:51     ` Chen-Yu Tsai
2026-07-11 13:59 ` [PATCH v2 6/7] arm64: dts: allwinner: sun50i-h6: Add missing IOMMU " Chen-Yu Tsai
2026-07-11 14:08   ` sashiko-bot
2026-07-11 13:59 ` [PATCH v2 7/7] arm64: dts: allwinner: sun50i-h616: Add " Chen-Yu Tsai
2026-07-11 14:11   ` sashiko-bot
2026-07-11 15:13   ` Andre Przywara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox