diff mbox series

[RESEND,2/2] arm64: dts: rockchip: Add RGA2 support to rk356x

Message ID 20230119-rk3568-rga-v1-2-43d4d14365e6@pengutronix.de
State New
Headers show
Series [RESEND,1/2] media: dt-bindings: media: rockchip-rga: add rockchip,rk3568-rga | expand

Commit Message

Michael Tretter Jan. 20, 2023, 9:14 a.m. UTC
The rk3568 also features a RGA2 block. Add the necessary device tree
node.

Acked-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Shengyu Qu Jan. 21, 2023, 4:50 p.m. UTC | #1
Hello Michael,

Since we have the over-4GB problem now, should we mark this problem as a
TODO or something?

Shengyu
Shengyu Qu Feb. 17, 2023, 2:14 p.m. UTC | #2
Hi Michael,

Seems we could use GFP_DMA32 flag to limit memory required by driver into

upper size range(actually using ZONE_DMA32 configured by device tree). Just

some driver modification needed. Maybe Nicolas could help testing? I would

like to fix this, but I don't have much free time these days.

Best regards,

Shengyu

> Hi,
>
> On Sun, 22 Jan 2023 00:50:37 +0800, Shengyu Qu wrote:
>> Since we have the over-4GB problem now, should we mark this problem as a
>> TODO or something?
> I am not really sure where to put such a TODO to make it visible for people
> that are running into the issue and to make sure that it is removed once it is
> fixed.
>
> Maybe it would be better to add error handling to the rga_buf_map function to
> fail if the address of the buffer that should be mapped has the upper 32 bit
> set and print a warning. Furthermore, the driver would be able to skip the
> buffer and prevent potential memory corruption caused by the erroneous
> mapping.
>
> Unfortunately, I don't have hardware that allows me to test this.
>
> Michael
Michael Tretter Feb. 17, 2023, 3:32 p.m. UTC | #3
Hi Shengyu,

On Fri, 17 Feb 2023 22:14:13 +0800, Shengyu Qu wrote:
> Seems we could use GFP_DMA32 flag to limit memory required by driver into
> upper size range(actually using ZONE_DMA32 configured by device tree). Just
> some driver modification needed. 

I don't think the GFP_DMA32 flag works with DmaBuf import. The buffer may be
allocated by some other driver that is able to address more than 4G and
imported into the RGA driver. In this case, limiting the allocations is not
enough, but we would still need error handling in the map function for buffers
that cannot be addressed by the RGA.

I guess we need both, a limit for the allocation and error checking for the
map.

Michael

> Maybe Nicolas could help testing? I would
> 
> like to fix this, but I don't have much free time these days.
> 
> Best regards,
> 
> Shengyu
> 
> > Hi,
> > 
> > On Sun, 22 Jan 2023 00:50:37 +0800, Shengyu Qu wrote:
> > > Since we have the over-4GB problem now, should we mark this problem as a
> > > TODO or something?
> > I am not really sure where to put such a TODO to make it visible for people
> > that are running into the issue and to make sure that it is removed once it is
> > fixed.
> > 
> > Maybe it would be better to add error handling to the rga_buf_map function to
> > fail if the address of the buffer that should be mapped has the upper 32 bit
> > set and print a warning. Furthermore, the driver would be able to skip the
> > buffer and prevent potential memory corruption caused by the erroneous
> > mapping.
> > 
> > Unfortunately, I don't have hardware that allows me to test this.
> > 
> > Michael
Shengyu Qu Feb. 17, 2023, 4:01 p.m. UTC | #4
Hi, Michael,

> I don't think the GFP_DMA32 flag works with DmaBuf import. The buffer may be
> allocated by some other driver that is able to address more than 4G and
> imported into the RGA driver. In this case, limiting the allocations is not
> enough, but we would still need error handling in the map function for buffers
> that cannot be addressed by the RGA.
>
> I guess we need both, a limit for the allocation and error checking for the
> map.

Maybe you are right.. I haven't digged into v4l2-m2m API, so I'm not 
sure about

it. Seems we need others' help.

Shengyu
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
index 5706c3e24f0a..704b13f7f717 100644
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
@@ -612,6 +612,17 @@  vdpu_mmu: iommu@fdea0800 {
 		#iommu-cells = <0>;
 	};
 
+	rga: rga@fdeb0000 {
+		compatible = "rockchip,rk3568-rga", "rockchip,rk3288-rga";
+		reg = <0x0 0xfdeb0000 0x0 0x180>;
+		interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru CLK_RGA_CORE>;
+		clock-names = "aclk", "hclk", "sclk";
+		resets = <&cru SRST_RGA_CORE>, <&cru SRST_A_RGA>, <&cru SRST_H_RGA>;
+		reset-names = "core", "axi", "ahb";
+		power-domains = <&power RK3568_PD_RGA>;
+	};
+
 	vepu: video-codec@fdee0000 {
 		compatible = "rockchip,rk3568-vepu";
 		reg = <0x0 0xfdee0000 0x0 0x800>;