2021-11-26 15:23:18

by Alex Bee

[permalink] [raw]
Subject: [PATCH 0/4] add GPU for RK356x SoCs

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

> 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.
>
> 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(-)

--
2.30.2



2021-11-26 15:23:25

by Alex Bee

[permalink] [raw]
Subject: [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.

Signed-off-by: Alex Bee <[email protected]>
---
.../bindings/gpu/arm,mali-bifrost.yaml | 20 ++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
index 6f98dd55fb4c..2849a7a97d73 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
@@ -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:
- |
--
2.30.2


2021-11-26 15:23:36

by Alex Bee

[permalink] [raw]
Subject: [PATCH 2/4] arm64: dts: rockchip: Add GPU node for rk3568

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

Signed-off-by: Ezequiel Garcia <[email protected]>
Signed-off-by: Alex Bee <[email protected]>
---
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 50 ++++++++++++++++++++++++
1 file changed, 50 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
index 46d9552f6028..3b314ccd6c94 100644
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
@@ -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>;
--
2.30.2


2021-11-26 15:23:38

by Alex Bee

[permalink] [raw]
Subject: [PATCH 3/4] arm64: dts: rockchip: Add cooling map / trip points for RK356x' GPU

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.

Signed-off-by: Alex Bee <[email protected]>
---
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 27 ++++++++++++++++++++++++
1 file changed, 27 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
index 3b314ccd6c94..a67c279c164d 100644
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
@@ -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>;
+ };
+ };
+
};
};

--
2.30.2


2021-11-26 15:23:48

by Alex Bee

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

From: Ezequiel Garcia <[email protected]>

Enable the GPU core on the Pine64 Quartz64 Model A.

Signed-off-by: Ezequiel Garcia <[email protected]>
Signed-off-by: Alex Bee <[email protected]>
---
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts b/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
index 4d4b2a301b1a..625489c60622 100644
--- a/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
@@ -205,6 +205,11 @@ &gmac1m0_clkinout
status = "okay";
};

+&gpu {
+ mali-supply = <&vdd_gpu>;
+ status = "okay";
+};
+
&i2c0 {
status = "okay";

--
2.30.2


2021-11-29 13:36:59

by Ezequiel Garcia

[permalink] [raw]
Subject: Re: [PATCH 0/4] add GPU for RK356x SoCs

Hi Alex,

On Fri, 26 Nov 2021 at 12:17, Alex Bee <[email protected]> wrote:
>
> This is a respin of Ezequiel's series which adds GPU for RK3568 [0]:
>

Thanks for picking this up!

Ezequiel

2021-12-01 23:32:03

by Rob Herring (Arm)

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

On Fri, Nov 26, 2021 at 04:17:26PM +0100, Alex Bee wrote:
> 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.

> 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.

>
> Signed-off-by: Alex Bee <[email protected]>
> ---
> .../bindings/gpu/arm,mali-bifrost.yaml | 20 ++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> index 6f98dd55fb4c..2849a7a97d73 100644
> --- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> +++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> @@ -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

clock-names:
minItems: 2

> + required:
> + - clock-names

else:
properties:
clocks:
maxItems: 1

clock-names:
maxItems: 1

>
> examples:
> - |
> --
> 2.30.2
>
>

2022-01-14 22:49:31

by Piotr Oniszczuk

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



> 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.
>
> Signed-off-by: Ezequiel Garcia <[email protected]>
> Signed-off-by: Alex Bee <[email protected]>
> ---
> arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts b/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
> index 4d4b2a301b1a..625489c60622 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
> +++ b/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
> @@ -205,6 +205,11 @@ &gmac1m0_clkinout
> status = "okay";
> };
>
> +&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?


2022-01-14 22:52:57

by Robin Murphy

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

On 2022-01-14 16:25, Piotr Oniszczuk wrote:
>
>
>> 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.
>>
>> Signed-off-by: Ezequiel Garcia <[email protected]>
>> Signed-off-by: Alex Bee <[email protected]>
>> ---
>> arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts b/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
>> index 4d4b2a301b1a..625489c60622 100644
>> --- a/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
>> +++ b/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
>> @@ -205,6 +205,11 @@ &gmac1m0_clkinout
>> status = "okay";
>> };
>>
>> +&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?

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.

2022-01-14 23:01:47

by Piotr Oniszczuk

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



> Wiadomość napisana przez Robin Murphy <[email protected]> w dniu 14.01.2022, o godz. 17:42:
>
>>
>
> 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!



2022-01-20 14:24:33

by Heiko Stuebner

[permalink] [raw]
Subject: Re: [PATCH 0/4] add GPU for RK356x SoCs

Hi Alex,

Am Freitag, 26. November 2021, 16:17:25 CET schrieb Alex Bee:
> This is a respin of Ezequiel's series which adds GPU for RK3568 [0]:
>
> > I've decided to split the GPU off previous series:

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

Thanks
Heiko

> >
> > https://lore.kernel.org/linux-rockchip/2147216.TLkxdtWsSY@diego/
> >
> > This series now contains only the GPU support, as the VPU
> > needs a tiny rework.
> >
> > 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(-)
>
>