Skip to contentSkip to conversation

add GPU for RK356x SoCs

PATCH In review Alex Bee 6 participants 11 messages Nov 26, 2021 – Jan 18, 2022

Subsystems (4)
lore
Share & tools
lore

Alex Bee

author
#0 lore raw

cover add GPU for RK356x SoCs

This is a respin of Ezequiel's series which adds GPU for RK3568 [0]:

Quoted 7 lines

I've decided to split the GPU off previous series:

https://lore.kernel.org/linux-rockchip/2147216.TLkxdtWsSY@diego/

This series now contains only the GPU support, as the VPU needs a tiny rework.

Quoted 7 lines

This is compiled tested only, in this case. Similar patches have been tested on a v5.10-based kernel, so I'd say it's good to go.

The mesa side is merged https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10771
and can be tested without a display, using something like weston --backend=headless-backend.so, which provides an environment for GL to work.

I hope to have resolved all DT-binding issues and added cooling map and trip points which can make the GPU a cooling device.

Tested with mesa 21.3.0 on quartz64-a board.

[0] https://patchwork.kernel.org/project/linux-rockchip/list/?series=526661

Alex Bee (2):
dt-bindings: gpu: mali-bifrost: Allow up to two clocks
arm64: dts: rockchip: Add cooling map / trip points for RK356x' GPU

Ezequiel Garcia (2):
arm64: dts: rockchip: Add GPU node for rk3568
arm64: dts: rockchip: Enable the GPU on Quartz64 Model A

 .../bindings/gpu/arm,mali-bifrost.yaml        | 20 ++++-
 .../boot/dts/rockchip/rk3566-quartz64-a.dts   |  5 ++
 arch/arm64/boot/dts/rockchip/rk356x.dtsi      | 77 +++++++++++++++++++
 3 files changed, 101 insertions(+), 1 deletion(-)
Signature · 7 lines
2.30.2


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
author
#1 lore raw

PATCH 1/4 dt-bindings: gpu: mali-bifrost: Allow up to two clocks

Commit b681af0bc1cc ("drm: panfrost: add optional bus_clock") added an optional bus_clock to support Allwinner H6 T-720 GPU. Increase the max clock items in the dt-binding to reflect this.

Bifrost GPU in Rockchip RK3568 SoCs also has a core and a bus clock and it gets added here in a (very) similar way it was done for allwinner,sun50i-h6-mali compatible in arm,mali-midgard binding.

---
 .../bindings/gpu/arm,mali-bifrost.yaml        | 20 ++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml +19 -1
index 6f98dd55fb4c..2849a7a97d73 100644
@@ -39,7 +39,14 @@ properties:
       - const: gpu
 
   clocks:
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
+
+  clock-names:
+    minItems: 1
+    items:
+      - const: core
+      - const: bus
 
   mali-supply: true
 
@@ -118,6 +125,17 @@ allOf:
         power-domains:
           maxItems: 1
         sram-supply: false
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: rockchip,rk3568-mali
+    then:
+      properties:
+        clocks:
+          minItems: 2
+      required:
+        - clock-names
 
 examples:
   - |
Signature · 7 lines
2.30.2


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
maintainer
#2 lore raw

Re: [PATCH 1/4] dt-bindings: gpu: mali-bifrost: Allow up to two clocks

Quoted 2 lines · Alex Bee

Commit b681af0bc1cc ("drm: panfrost: add optional bus_clock") added an optional bus_clock to support Allwinner H6 T-720 GPU.

That's midgard and this is bifrost... Driver changes are somewhat irrelevant.

Quoted 5 lines

Increase the max clock items in the dt-binding to reflect this.

Bifrost GPU in Rockchip RK3568 SoCs also has a core and a bus clock and it gets added here in a (very) similar way it was done for allwinner,sun50i-h6-mali compatible in arm,mali-midgard binding.

I guess that one is insufficient.

Quoted 29 lines
---
 .../bindings/gpu/arm,mali-bifrost.yaml        | 20 ++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml +8 -1
index 6f98dd55fb4c..2849a7a97d73 100644
@@ -39,7 +39,14 @@ properties:
       - const: gpu
 
   clocks:
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
+
+  clock-names:
+    minItems: 1
+    items:
+      - const: core
+      - const: bus
 
   mali-supply: true
 
@@ -118,6 +125,17 @@ allOf:
         power-domains:
           maxItems: 1

Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml allOf: · line 136

Quoted 10 lines
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml +9 -0
         sram-supply: false
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: rockchip,rk3568-mali
+    then:
+      properties:
+        clocks:
+          minItems: 2

clock-names:
minItems: 2

Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml allOf: · line 138

Quoted 2 lines
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml +2 -0
+      required:
+        - clock-names

else:
properties:
clocks:
maxItems: 1

clock-names:
maxItems: 1

Quoted 7 lines
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml +0 -0
 examples:
   - |
Signature · 1 line
2.30.2
author
#3 lore raw

PATCH 2/4 arm64: dts: rockchip: Add GPU node for rk3568

In reply to Alex Bee

From: Ezequiel Garcia <[email protected]>

Rockchip SoCs RK3566 and RK3568 have a Mali Gondul core which is based on the Bifrost architecture. It has one shader core and two execution engines.

Quoting the datasheet:

Mali-G52 1-Core-2EE
* Support 1600Mpix/s fill rate when 800MHz clock frequency
* Support 38.4GLOPs when 800MHz clock frequency

---
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 50 ++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +50 -0
index 46d9552f6028..3b314ccd6c94 100644
@@ -125,6 +125,40 @@ opp-1800000000 {
 		};
 	};
 
+	gpu_opp_table: opp-table-1 {
+		compatible = "operating-points-v2";
+
+		opp-200000000 {
+			opp-hz = /bits/ 64 <200000000>;
+			opp-microvolt = <825000>;
+		};
+
+		opp-300000000 {
+			opp-hz = /bits/ 64 <300000000>;
+			opp-microvolt = <825000>;
+		};
+
+		opp-400000000 {
+			opp-hz = /bits/ 64 <400000000>;
+			opp-microvolt = <825000>;
+		};
+
+		opp-600000000 {
+			opp-hz = /bits/ 64 <600000000>;
+			opp-microvolt = <825000>;
+		};
+
+		opp-700000000 {
+			opp-hz = /bits/ 64 <700000000>;
+			opp-microvolt = <900000>;
+		};
+
+		opp-800000000 {
+			opp-hz = /bits/ 64 <800000000>;
+			opp-microvolt = <1000000>;
+		};
+	};
+
 	firmware {
 		scmi: scmi {
 			compatible = "arm,scmi-smc";
@@ -386,6 +420,22 @@ power-domain@RK3568_PD_RKVENC {
 		};
 	};
 
+	gpu: gpu@fde60000 {
+		compatible = "rockchip,rk3568-mali", "arm,mali-bifrost";
+		reg = <0x0 0xfde60000 0x0 0x4000>;
+
+		interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-names = "job", "mmu", "gpu";
+		clocks = <&scmi_clk 1>, <&cru CLK_GPU>;
+		clock-names = "core", "bus";
+		operating-points-v2 = <&gpu_opp_table>;
+		#cooling-cells = <2>;
+		power-domains = <&power RK3568_PD_GPU>;
+		status = "disabled";
+	};
+
 	sdmmc2: mmc@fe000000 {
 		compatible = "rockchip,rk3568-dw-mshc", "rockchip,rk3288-dw-mshc";
 		reg = <0x0 0xfe000000 0x0 0x4000>;
Signature · 7 lines
2.30.2


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
author
#4 lore raw

PATCH 3/4 arm64: dts: rockchip: Add cooling map / trip points for RK356x' GPU

In reply to Alex Bee

RK356x SoCs have a second thermal sensor for the GPU:
This adds the cooling map / trip points for it to make use of it's contribution as a cooling device.

---
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 27 ++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +27 -0
index 3b314ccd6c94..a67c279c164d 100644
@@ -960,6 +960,33 @@ gpu_thermal: gpu-thermal {
 			polling-delay = <1000>; /* milliseconds */
 
 			thermal-sensors = <&tsadc 1>;
+
+			trips {
+				gpu_threshold: gpu-threshold {
+					temperature = <70000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				gpu_target: gpu-target {
+					temperature = <75000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				gpu_crit: gpu-crit {
+					temperature = <95000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map0 {
+					trip = <&gpu_target>;
+					cooling-device =
+						<&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+
 		};
 	};
 
Signature · 7 lines
2.30.2


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
author
#5 lore raw

PATCH 4/4 arm64: dts: rockchip: Enable the GPU on Quartz64 Model A

In reply to Alex Bee

From: Ezequiel Garcia <[email protected]>

Enable the GPU core on the Pine64 Quartz64 Model A.

---
 arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +5 -0
index 4d4b2a301b1a..625489c60622 100644
@@ -205,6 +205,11 @@ &gmac1m0_clkinout
 	status = "okay";
 };
 
+&gpu {
+	mali-supply = <&vdd_gpu>;
+	status = "okay";
+};
+
 &i2c0 {
 	status = "okay";
 
Signature · 7 lines
2.30.2


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#6 lore raw

Re: [PATCH 4/4] arm64: dts: rockchip: Enable the GPU on Quartz64 Model A

Quoted 22 lines

Wiadomość napisana przez Alex Bee <[email protected]> w dniu 26.11.2021, o godz. 16:17:

From: Ezequiel Garcia <[email protected]>

Enable the GPU core on the Pine64 Quartz64 Model A.

---
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts | 5 +++++

1 file changed, 5 insertions(+)
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +0 -0
index 4d4b2a301b1a..625489c60622 100644
@@ -205,6 +205,11 @@ &gmac1m0_clkinout
 	status = "okay";

arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts &gmac1m0_clkinout · line 215

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +5 -0
 };
 
+&gpu {
+	mali-supply = <&vdd_gpu>;
+	status = "okay";
+};
+
 &i2c0 {
 	status = "okay";
 

Alex, Ezequiel

I'm playing with 5.16 mainline on rk3566 based tvbox (x96-x6)

Box boots and I have working SD card, Eth, HDMI.

I applied this series as I want to get GPU working but I'm getting:

[    3.169144] panfrost fde60000.gpu: get clock failed -517
[    3.169646] panfrost fde60000.gpu: clk init failed -517
[    3.213653] panfrost fde60000.gpu: get clock failed -517
[    3.214156] panfrost fde60000.gpu: clk init failed -517
[    3.230505] panfrost fde60000.gpu: get clock failed -517
[    3.231006] panfrost fde60000.gpu: clk init failed -517
[    3.258072] panfrost fde60000.gpu: get clock failed -517
[    3.258575] panfrost fde60000.gpu: clk init failed -517

Maybe you have some hints here?

#7 lore raw

Re: [PATCH 4/4] arm64: dts: rockchip: Enable the GPU on Quartz64 Model A

Quoted 50 lines · Piotr Oniszczuk
Quoted 22 lines

Wiadomość napisana przez Alex Bee <[email protected]> w dniu 26.11.2021, o godz. 16:17:

From: Ezequiel Garcia <[email protected]>

Enable the GPU core on the Pine64 Quartz64 Model A.

---
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts | 5 +++++

1 file changed, 5 insertions(+)
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +0 -0
index 4d4b2a301b1a..625489c60622 100644
@@ -205,6 +205,11 @@ &gmac1m0_clkinout
 	status = "okay";

arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts &gmac1m0_clkinout · line 215

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +5 -0
 };
 
+&gpu {
+	mali-supply = <&vdd_gpu>;
+	status = "okay";
+};
+
 &i2c0 {
 	status = "okay";
 

Alex, Ezequiel

I'm playing with 5.16 mainline on rk3566 based tvbox (x96-x6)

Box boots and I have working SD card, Eth, HDMI.

I applied this series as I want to get GPU working but I'm getting:

[    3.169144] panfrost fde60000.gpu: get clock failed -517
[    3.169646] panfrost fde60000.gpu: clk init failed -517
[    3.213653] panfrost fde60000.gpu: get clock failed -517
[    3.214156] panfrost fde60000.gpu: clk init failed -517
[    3.230505] panfrost fde60000.gpu: get clock failed -517
[    3.231006] panfrost fde60000.gpu: clk init failed -517
[    3.258072] panfrost fde60000.gpu: get clock failed -517
[    3.258575] panfrost fde60000.gpu: clk init failed -517
Quoted 1 line

Maybe you have some hints here?

517 is EPROBE_DEFER, which implies it's waiting for the relevant clock provider to show up. I see from patch #2 that SCMI is involved, so I'd check that that's working and you have CONFIG_COMMON_CLOCK_SCMI enabled.

Robin.

#8 lore raw

Re: [PATCH 4/4] arm64: dts: rockchip: Enable the GPU on Quartz64 Model A

Quoted 9 lines

Wiadomość napisana przez Robin Murphy <[email protected]> w dniu 14.01.2022, o godz. 17:42:

Quoted 1 line

517 is EPROBE_DEFER, which implies it's waiting for the relevant clock provider to show up. I see from patch #2 that SCMI is involved, so I'd check that that's working and you have CONFIG_COMMON_CLOCK_SCMI enabled.

Robin.

Robin,

Many thx!
Indeed issue was with SCMi CLK.
Now i see:

[    3.092350] panfrost fde60000.gpu: clock rate = 594000000
[    3.092906] panfrost fde60000.gpu: bus_clock rate = 500000000
[    3.138340] panfrost fde60000.gpu: clock rate = 594000000
[    3.138904] panfrost fde60000.gpu: bus_clock rate = 500000000
[    3.171244] panfrost fde60000.gpu: clock rate = 594000000
[    3.171888] panfrost fde60000.gpu: bus_clock rate = 500000000

good.

(unfortunately mesa 21.3.4 still goes with llvmpipe but this seems to be other issue i need to investigate)

thx again!

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

maintainer
#10 lore raw
In reply to Alex Bee

Hi Alex,

Am Freitag, 26. November 2021, 16:17:25 CET schrieb Alex Bee:

Quoted 3 lines

This is a respin of Ezequiel's series which adds GPU for RK3568 [0]:

Quoted 1 line

I've decided to split the GPU off previous series:

do you plan on a respin for Rob's comments?

Thanks
Heiko

Quoted 35 lines
Quoted 6 lines

https://lore.kernel.org/linux-rockchip/2147216.TLkxdtWsSY@diego/

This series now contains only the GPU support, as the VPU needs a tiny rework.

Quoted 7 lines

This is compiled tested only, in this case. Similar patches have been tested on a v5.10-based kernel, so I'd say it's good to go.

The mesa side is merged https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10771
and can be tested without a display, using something like weston --backend=headless-backend.so, which provides an environment for GL to work.

I hope to have resolved all DT-binding issues and added cooling map and trip points which can make the GPU a cooling device.

Tested with mesa 21.3.0 on quartz64-a board.

[0] https://patchwork.kernel.org/project/linux-rockchip/list/?series=526661

Alex Bee (2):
dt-bindings: gpu: mali-bifrost: Allow up to two clocks
arm64: dts: rockchip: Add cooling map / trip points for RK356x' GPU

Ezequiel Garcia (2):
arm64: dts: rockchip: Add GPU node for rk3568
arm64: dts: rockchip: Enable the GPU on Quartz64 Model A

 .../bindings/gpu/arm,mali-bifrost.yaml        | 20 ++++-
 .../boot/dts/rockchip/rk3566-quartz64-a.dts   |  5 ++
 arch/arm64/boot/dts/rockchip/rk356x.dtsi      | 77 +++++++++++++++++++
 3 files changed, 101 insertions(+), 1 deletion(-)