* [PATCH v5 0/3] Add Mali GPU support for Mediatek MT8370 SoC
@ 2025-05-02 12:17 Louis-Alexis Eyraud
2025-05-02 12:17 ` [PATCH v5 1/3] dt-bindings: gpu: mali-bifrost: Add compatible for " Louis-Alexis Eyraud
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Louis-Alexis Eyraud @ 2025-05-02 12:17 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Matthias Brugger, AngeloGioacchino Del Regno, Boris Brezillon,
Steven Price
Cc: kernel, dri-devel, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, Louis-Alexis Eyraud, Conor Dooley
This patchset adds the support of the ARM Mali G57 MC2 GPU (Valhall-JM,
dual core), integrated in the Mediatek MT8370 SoC, to the panfrost
driver and to the mt8370.dtsi include file.
Since v4 patchset was sent, the [1] patchset adds in panfrost driver
the AARCH64_4K page table format support and enablement for Mediatek
SoC with integrated Arm Mali-G57, already supported in panfrost driver
(like MT8188, MT8192, MT8195, MT8390, MT8395...).
As MT8370 SoC is a less powerful variant of MT8390 (same GPU but with
one less core for MT8370), I've reworked the second patch
('drm/panfrost: Add support for Mali on the MT8370 SoC') to enable the
AARCH64_4K mode on this SoC as well by adding specific MT8370 platform
data to set the needed flag.
The previous patch revision uses MT8186 platform data because despite
having different GPU architecture (Mali G52 2EE MC2 for MT8186, making
them not compatible), using the same plaform data, for describing the
same power management features only, was okay.
But now, the platform data also contains the GPU configuration quirk
bitfield that needs to be modified to enable the AARCH64_4K page table
format, and in order not to change MT8186 behaviour, I add specific
MT8370 platform data.
I also dropped previous code-review trailers that this patch got
previously.
I've tested this patchset on a Mediatek Genio 510 EVK board,
with a kernel based on linux-next (tag: next-20250501).
The panfrost driver probed with the following messages:
```
panfrost 13000000.gpu: clock rate = 390000000
panfrost 13000000.gpu: mali-g57 id 0x9093 major 0x0 minor 0x0 status 0x0
panfrost 13000000.gpu: features: 00000000,000019f7, issues: 00000003,
80000400
panfrost 13000000.gpu: Features: L2:0x08130206 Shader:0x00000000
Tiler:0x00000809 Mem:0x1 MMU:0x00002830 AS:0xff JS:0x7
panfrost 13000000.gpu: shader_present=0x5 l2_present=0x1
[drm] Initialized panfrost 1.3.0 for 13000000.gpu on minor 0
```
Running glmark2-es2-drm is also OK:
```
=======================================================
glmark2 2023.01
=======================================================
OpenGL Information
GL_VENDOR: Mesa
GL_RENDERER: Mali-G57 (Panfrost)
GL_VERSION: OpenGL ES 3.1 Mesa 25.0.3-1
Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
Surface Size: 1200x1920 fullscreen
=======================================================
[build] use-vbo=false: FPS: 952 FrameTime: 1.051 ms
[build] use-vbo=true: FPS: 983 FrameTime: 1.018 ms
[texture] texture-filter=nearest: FPS: 906 FrameTime: 1.105 ms
[texture] texture-filter=linear: FPS: 908 FrameTime: 1.102 ms
[texture] texture-filter=mipmap: FPS: 883 FrameTime: 1.134 ms
[shading] shading=gouraud: FPS: 838 FrameTime: 1.194 ms
[shading] shading=blinn-phong-inf: FPS: 778 FrameTime: 1.287 ms
[shading] shading=phong: FPS: 583 FrameTime: 1.717 ms
[shading] shading=cel: FPS: 553 FrameTime: 1.809 ms
[bump] bump-render=high-poly: FPS: 573 FrameTime: 1.747 ms
[bump] bump-render=normals: FPS: 868 FrameTime: 1.153 ms
[bump] bump-render=height: FPS: 707 FrameTime: 1.415 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 454 FrameTime: 2.204 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 172 FrameTime:
5.843 ms
[pulsar] light=false:quads=5:texture=false: FPS: 770 FrameTime:
1.300 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4:
FPS: 161 FrameTime: 6.235 ms
[desktop] effect=shadow:windows=4: FPS: 484 FrameTime: 2.069 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction
=0.5:update-method=map: FPS: 512 FrameTime: 1.955 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction
=0.5:update-method=subdata: FPS: 513 FrameTime: 1.952 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction
=0.5:update-method=map: FPS: 577 FrameTime: 1.735 ms
[ideas] speed=duration: FPS: 448 FrameTime: 2.235 ms
[jellyfish] <default>: FPS: 226 FrameTime: 4.440 ms
[terrain] <default>: FPS: 38 FrameTime: 26.861 ms
[shadow] <default>: FPS: 328 FrameTime: 3.051 ms
[refract] <default>: FPS: 72 FrameTime: 13.937 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 844 FrameTime:
1.186 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 685 FrameTime:
1.462 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 833 FrameTime:
1.201 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 830 FrameTime:
1.205 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 525 FrameTime:
1.905 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 837
FrameTime: 1.195 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 835
FrameTime: 1.199 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 550
FrameTime: 1.820 ms
=======================================================
glmark2 Score: 611
=======================================================
```
[1] https://lore.kernel.org/dri-devel/20250324185801.168664-1-ariel.dalessandro@collabora.com/
Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
---
Changes in v5:
- Rebase on linux-next (tqg: next-2020501)
- Rework 'drm/panfrost: Add support for Mali on the MT8370 SoC' patch
to have MT8370 support with its AARCH64_4K page table format support enabled
- Drop code-review trailers from 'drm/panfrost: Add support for Mali on
the MT8370 SoC' patch due to major changes in content and commit message
- Add ack trailer for 'dt-bindings: gpu: mali-bifrost: Add compatible
for MT8370 SoC' patch
- Add glmark2-es2-drm benchmark results in cover letter
- Link to v4: https://lore.kernel.org/r/20250211-mt8370-enable-gpu-v4-0-77deb7a75c23@collabora.com
Changes in v4:
- Add warning comment in mt8370.dtsi about GPU node override
- Reword "dt-bindings: gpu: mali-bifrost: Add compatible for MT8370
SoC" commit message
- Add code-review trailers
- Link to v3: https://lore.kernel.org/r/20250207-mt8370-enable-gpu-v3-0-75e9b902f9c1@collabora.com
Changes in v3:
- Rebased on linux-next (tag: next-20250207)
- Remove prerequisite change/patch ids
- Reword commit messages to better explicit compatible needs
- Link to v2: https://lore.kernel.org/r/20250130-mt8370-enable-gpu-v2-0-c154d0815db5@collabora.com
Changes in v2:
- Rework "drm/panfrost: Add support for Mali on the MT8370 SoC" to avoid
data structure duplication, as requested by Krzysztof Kozlowski
- Reword commit messages to use imperative mood and make new compatible
need more explicit
- Link to v1: https://lore.kernel.org/r/20250116-mt8370-enable-gpu-v1-0-0a6b78e925c8@collabora.com
---
Louis-Alexis Eyraud (3):
dt-bindings: gpu: mali-bifrost: Add compatible for MT8370 SoC
drm/panfrost: Add support for Mali on the MT8370 SoC
arm64: dts: mediatek: mt8370: Enable gpu support
.../devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 ++++-
arch/arm64/boot/dts/mediatek/mt8370.dtsi | 16 ++++++++++++++++
drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++
3 files changed, 31 insertions(+), 1 deletion(-)
---
base-commit: 1c51b1ba38c07e4f999802eb708bf798dd5f5d1b
change-id: 20250115-mt8370-enable-gpu-3b6f595fa63d
Best regards,
--
Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v5 1/3] dt-bindings: gpu: mali-bifrost: Add compatible for MT8370 SoC
2025-05-02 12:17 [PATCH v5 0/3] Add Mali GPU support for Mediatek MT8370 SoC Louis-Alexis Eyraud
@ 2025-05-02 12:17 ` Louis-Alexis Eyraud
2025-05-02 12:17 ` [PATCH v5 2/3] drm/panfrost: Add support for Mali on the " Louis-Alexis Eyraud
2025-05-02 12:17 ` [PATCH v5 3/3] arm64: dts: mediatek: mt8370: Enable gpu support Louis-Alexis Eyraud
2 siblings, 0 replies; 7+ messages in thread
From: Louis-Alexis Eyraud @ 2025-05-02 12:17 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Matthias Brugger, AngeloGioacchino Del Regno, Boris Brezillon,
Steven Price
Cc: kernel, dri-devel, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, Louis-Alexis Eyraud, Conor Dooley
Add a compatible for the MediaTek MT8370 SoC, with an
integrated ARM Mali G57 MC2 GPU (Valhall-JM, dual core).
None of the already existing SoC specific compatibles is usable as
fallback, as those either do not match the number of cores (and number
of power domains), or are for a different GPU architecture.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
---
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
index 019bd28a29f19bb4f7a9c32434b208b6d04db221..5726b79fd0f9de8914f724929f462409e088ec31 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
@@ -40,6 +40,7 @@ properties:
- enum:
- mediatek,mt8188-mali
- mediatek,mt8192-mali
+ - mediatek,mt8370-mali
- const: arm,mali-valhall-jm # Mali Valhall GPU model/revision is fully discoverable
reg:
@@ -221,7 +222,9 @@ allOf:
properties:
compatible:
contains:
- const: mediatek,mt8186-mali
+ enum:
+ - mediatek,mt8186-mali
+ - mediatek,mt8370-mali
then:
properties:
power-domains:
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v5 2/3] drm/panfrost: Add support for Mali on the MT8370 SoC
2025-05-02 12:17 [PATCH v5 0/3] Add Mali GPU support for Mediatek MT8370 SoC Louis-Alexis Eyraud
2025-05-02 12:17 ` [PATCH v5 1/3] dt-bindings: gpu: mali-bifrost: Add compatible for " Louis-Alexis Eyraud
@ 2025-05-02 12:17 ` Louis-Alexis Eyraud
2025-05-06 8:28 ` AngeloGioacchino Del Regno
2025-05-07 14:06 ` Steven Price
2025-05-02 12:17 ` [PATCH v5 3/3] arm64: dts: mediatek: mt8370: Enable gpu support Louis-Alexis Eyraud
2 siblings, 2 replies; 7+ messages in thread
From: Louis-Alexis Eyraud @ 2025-05-02 12:17 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Matthias Brugger, AngeloGioacchino Del Regno, Boris Brezillon,
Steven Price
Cc: kernel, dri-devel, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, Louis-Alexis Eyraud
Add a compatible for the MediaTek MT8370 SoC, with an integrated ARM
Mali G57 MC2 GPU (Valhall-JM, dual core), with new platform data for
its support in the panfrost driver.
It uses the same data as MT8186 for the power management features to
describe power supplies, pm_domains and enablement (one regulator, two
power domains) but also sets the FORCE_AARCH64_PGTABLE flag in the GPU
configuration quirks bitfield to enable AARCH64 4K page table format
mode.
As MT8186 and MT8370 SoC have different GPU architecture (Mali G52 2EE
MC2 for MT8186), making them not compatible, and this mode is only
enabled for Mediatek SoC that are Mali G57 based (compatible with
mediatek,mali-mt8188 or mediatek,mali-8192), having specific platform
data allows to set this flag for MT8370 without modifying MT8186
configuration and behaviour.
Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
---
drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index f1ec3b02f15a0029d20c7d81046ded59854e885c..8e0a1ae6940c73b7b60233950ae3abdfa843cc8e 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -846,6 +846,16 @@ static const struct panfrost_compatible mediatek_mt8192_data = {
.gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
};
+/* MT8370 uses the same power domains and power supplies as MT8186 */
+static const struct panfrost_compatible mediatek_mt8370_data = {
+ .num_supplies = ARRAY_SIZE(mediatek_mt8183_b_supplies) - 1,
+ .supply_names = mediatek_mt8183_b_supplies,
+ .num_pm_domains = ARRAY_SIZE(mediatek_mt8186_pm_domains),
+ .pm_domain_names = mediatek_mt8186_pm_domains,
+ .pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
+ .gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
+};
+
static const struct of_device_id dt_match[] = {
/* Set first to probe before the generic compatibles */
{ .compatible = "amlogic,meson-gxm-mali",
@@ -868,6 +878,7 @@ static const struct of_device_id dt_match[] = {
{ .compatible = "mediatek,mt8186-mali", .data = &mediatek_mt8186_data },
{ .compatible = "mediatek,mt8188-mali", .data = &mediatek_mt8188_data },
{ .compatible = "mediatek,mt8192-mali", .data = &mediatek_mt8192_data },
+ { .compatible = "mediatek,mt8370-mali", .data = &mediatek_mt8370_data },
{ .compatible = "allwinner,sun50i-h616-mali", .data = &allwinner_h616_data },
{}
};
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v5 3/3] arm64: dts: mediatek: mt8370: Enable gpu support
2025-05-02 12:17 [PATCH v5 0/3] Add Mali GPU support for Mediatek MT8370 SoC Louis-Alexis Eyraud
2025-05-02 12:17 ` [PATCH v5 1/3] dt-bindings: gpu: mali-bifrost: Add compatible for " Louis-Alexis Eyraud
2025-05-02 12:17 ` [PATCH v5 2/3] drm/panfrost: Add support for Mali on the " Louis-Alexis Eyraud
@ 2025-05-02 12:17 ` Louis-Alexis Eyraud
2 siblings, 0 replies; 7+ messages in thread
From: Louis-Alexis Eyraud @ 2025-05-02 12:17 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Matthias Brugger, AngeloGioacchino Del Regno, Boris Brezillon,
Steven Price
Cc: kernel, dri-devel, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek, Louis-Alexis Eyraud
Add a new gpu node in mt8370.dtsi to enable support for the
ARM Mali G57 MC2 GPU (Valhall-JM) found on the MT8370 SoC, using the
Panfrost driver.
On a Mediatek Genio 510 EVK board, the panfrost driver probed with the
following message:
```
panfrost 13000000.gpu: clock rate = 390000000
panfrost 13000000.gpu: mali-g57 id 0x9093 major 0x0 minor 0x0 status 0x0
panfrost 13000000.gpu: features: 00000000,000019f7, issues: 00000003,
80000400
panfrost 13000000.gpu: Features: L2:0x08130206 Shader:0x00000000
Tiler:0x00000809 Mem:0x1 MMU:0x00002830 AS:0xff JS:0x7
panfrost 13000000.gpu: shader_present=0x5 l2_present=0x1
[drm] Initialized panfrost 1.3.0 for 13000000.gpu on minor 0
```
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
---
arch/arm64/boot/dts/mediatek/mt8370.dtsi | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt8370.dtsi b/arch/arm64/boot/dts/mediatek/mt8370.dtsi
index cf1a3759451ff899ce9e63e5a00f192fb483f6e5..7ac8b8d0349455922a73f35db607b2b27cad23d7 100644
--- a/arch/arm64/boot/dts/mediatek/mt8370.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8370.dtsi
@@ -59,6 +59,22 @@ &cpu_little3_cooling_map0 {
<&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
};
+/*
+ * Please note that overriding compatibles is a discouraged practice and is a
+ * clear indication of nodes not being, well, compatible!
+ *
+ * This is a special case, where the GPU is the same as MT8188, but with one
+ * of the cores fused out in this lower-binned SoC.
+ */
+&gpu {
+ compatible = "mediatek,mt8370-mali", "arm,mali-valhall-jm";
+
+ power-domains = <&spm MT8188_POWER_DOMAIN_MFG2>,
+ <&spm MT8188_POWER_DOMAIN_MFG3>;
+
+ power-domain-names = "core0", "core1";
+};
+
&ppi_cluster0 {
affinity = <&cpu0 &cpu1 &cpu2 &cpu3>;
};
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v5 2/3] drm/panfrost: Add support for Mali on the MT8370 SoC
2025-05-02 12:17 ` [PATCH v5 2/3] drm/panfrost: Add support for Mali on the " Louis-Alexis Eyraud
@ 2025-05-06 8:28 ` AngeloGioacchino Del Regno
2025-05-07 14:06 ` Steven Price
1 sibling, 0 replies; 7+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-05-06 8:28 UTC (permalink / raw)
To: Louis-Alexis Eyraud, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
Boris Brezillon, Steven Price
Cc: kernel, dri-devel, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek
Il 02/05/25 14:17, Louis-Alexis Eyraud ha scritto:
> Add a compatible for the MediaTek MT8370 SoC, with an integrated ARM
> Mali G57 MC2 GPU (Valhall-JM, dual core), with new platform data for
> its support in the panfrost driver.
> It uses the same data as MT8186 for the power management features to
> describe power supplies, pm_domains and enablement (one regulator, two
> power domains) but also sets the FORCE_AARCH64_PGTABLE flag in the GPU
> configuration quirks bitfield to enable AARCH64 4K page table format
> mode.
> As MT8186 and MT8370 SoC have different GPU architecture (Mali G52 2EE
> MC2 for MT8186), making them not compatible, and this mode is only
> enabled for Mediatek SoC that are Mali G57 based (compatible with
> mediatek,mali-mt8188 or mediatek,mali-8192), having specific platform
> data allows to set this flag for MT8370 without modifying MT8186
> configuration and behaviour.
>
> Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v5 2/3] drm/panfrost: Add support for Mali on the MT8370 SoC
2025-05-02 12:17 ` [PATCH v5 2/3] drm/panfrost: Add support for Mali on the " Louis-Alexis Eyraud
2025-05-06 8:28 ` AngeloGioacchino Del Regno
@ 2025-05-07 14:06 ` Steven Price
2025-05-07 15:16 ` Louis-Alexis Eyraud
1 sibling, 1 reply; 7+ messages in thread
From: Steven Price @ 2025-05-07 14:06 UTC (permalink / raw)
To: Louis-Alexis Eyraud, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno, Boris Brezillon
Cc: kernel, dri-devel, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek
On 02/05/2025 13:17, Louis-Alexis Eyraud wrote:
> Add a compatible for the MediaTek MT8370 SoC, with an integrated ARM
> Mali G57 MC2 GPU (Valhall-JM, dual core), with new platform data for
> its support in the panfrost driver.
> It uses the same data as MT8186 for the power management features to
> describe power supplies, pm_domains and enablement (one regulator, two
> power domains) but also sets the FORCE_AARCH64_PGTABLE flag in the GPU
> configuration quirks bitfield to enable AARCH64 4K page table format
> mode.
> As MT8186 and MT8370 SoC have different GPU architecture (Mali G52 2EE
> MC2 for MT8186), making them not compatible, and this mode is only
> enabled for Mediatek SoC that are Mali G57 based (compatible with
> mediatek,mali-mt8188 or mediatek,mali-8192), having specific platform
> data allows to set this flag for MT8370 without modifying MT8186
> configuration and behaviour.
>
> Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
With one minor comment fixed below:
Reviewed-by: Steven Price <steven.price@arm.com>
> ---
> drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index f1ec3b02f15a0029d20c7d81046ded59854e885c..8e0a1ae6940c73b7b60233950ae3abdfa843cc8e 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -846,6 +846,16 @@ static const struct panfrost_compatible mediatek_mt8192_data = {
> .gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
> };
>
> +/* MT8370 uses the same power domains and power supplies as MT8186 */
This comment is not correct - you've got the power domains of MT8186,
but the supplies of MT8183. The comment doesn't actually add much so you
could just drop it.
If you're feeling adventurous then one option here is to actually clean
up the mediatek entries a little. Instead of referring to particular
part numbers we could have:
static const char * const mediatek_2_pm_domains[] = { "core0", "core1" };
static const char * const mediatek_3_pm_domains[] = { "core0", "core1", "core2" };
static const char * const mediatek_5_pm_domains[] = { "core0", "core1", "core2",
"core3", "core4" };
Or even just have the mediatek_5_domains[] array (dropping the '5' in
the name) and not use ARRAY_SIZE().
Equally the supplies arrays could be renamed. We have the one with
"sram" for legacy and everything else uses {"mali", NULL} but we have
two definitions for it (mt8183_b and mt8192).
Thanks,
Steve
> +static const struct panfrost_compatible mediatek_mt8370_data = {
> + .num_supplies = ARRAY_SIZE(mediatek_mt8183_b_supplies) - 1,
> + .supply_names = mediatek_mt8183_b_supplies,
> + .num_pm_domains = ARRAY_SIZE(mediatek_mt8186_pm_domains),
> + .pm_domain_names = mediatek_mt8186_pm_domains,
> + .pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
> + .gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
> +};
> +
> static const struct of_device_id dt_match[] = {
> /* Set first to probe before the generic compatibles */
> { .compatible = "amlogic,meson-gxm-mali",
> @@ -868,6 +878,7 @@ static const struct of_device_id dt_match[] = {
> { .compatible = "mediatek,mt8186-mali", .data = &mediatek_mt8186_data },
> { .compatible = "mediatek,mt8188-mali", .data = &mediatek_mt8188_data },
> { .compatible = "mediatek,mt8192-mali", .data = &mediatek_mt8192_data },
> + { .compatible = "mediatek,mt8370-mali", .data = &mediatek_mt8370_data },
> { .compatible = "allwinner,sun50i-h616-mali", .data = &allwinner_h616_data },
> {}
> };
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v5 2/3] drm/panfrost: Add support for Mali on the MT8370 SoC
2025-05-07 14:06 ` Steven Price
@ 2025-05-07 15:16 ` Louis-Alexis Eyraud
0 siblings, 0 replies; 7+ messages in thread
From: Louis-Alexis Eyraud @ 2025-05-07 15:16 UTC (permalink / raw)
To: Steven Price, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
Boris Brezillon
Cc: kernel, dri-devel, devicetree, linux-kernel, linux-arm-kernel,
linux-mediatek
Hi,
On Wed, 2025-05-07 at 15:06 +0100, Steven Price wrote:
> On 02/05/2025 13:17, Louis-Alexis Eyraud wrote:
> > Add a compatible for the MediaTek MT8370 SoC, with an integrated
> > ARM
> > Mali G57 MC2 GPU (Valhall-JM, dual core), with new platform data
> > for
> > its support in the panfrost driver.
> > It uses the same data as MT8186 for the power management features
> > to
> > describe power supplies, pm_domains and enablement (one regulator,
> > two
> > power domains) but also sets the FORCE_AARCH64_PGTABLE flag in the
> > GPU
> > configuration quirks bitfield to enable AARCH64 4K page table
> > format
> > mode.
> > As MT8186 and MT8370 SoC have different GPU architecture (Mali G52
> > 2EE
> > MC2 for MT8186), making them not compatible, and this mode is only
> > enabled for Mediatek SoC that are Mali G57 based (compatible with
> > mediatek,mali-mt8188 or mediatek,mali-8192), having specific
> > platform
> > data allows to set this flag for MT8370 without modifying MT8186
> > configuration and behaviour.
> >
> > Signed-off-by: Louis-Alexis Eyraud
> > <louisalexis.eyraud@collabora.com>
>
> With one minor comment fixed below:
>
> Reviewed-by: Steven Price <steven.price@arm.com>
>
> > ---
> > drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c
> > b/drivers/gpu/drm/panfrost/panfrost_drv.c
> > index
> > f1ec3b02f15a0029d20c7d81046ded59854e885c..8e0a1ae6940c73b7b60233950
> > ae3abdfa843cc8e 100644
> > --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> > +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> > @@ -846,6 +846,16 @@ static const struct panfrost_compatible
> > mediatek_mt8192_data = {
> > .gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
> > };
> >
> > +/* MT8370 uses the same power domains and power supplies as MT8186
> > */
>
> This comment is not correct - you've got the power domains of MT8186,
> but the supplies of MT8183. The comment doesn't actually add much so
> you
> could just drop it.
>
I'll remove it.
> If you're feeling adventurous then one option here is to actually
> clean
> up the mediatek entries a little. Instead of referring to particular
> part numbers we could have:
>
> static const char * const mediatek_2_pm_domains[] = { "core0",
> "core1" };
> static const char * const mediatek_3_pm_domains[] = { "core0",
> "core1", "core2" };
> static const char * const mediatek_5_pm_domains[] = { "core0",
> "core1", "core2",
> "core3",
> "core4" };
>
> Or even just have the mediatek_5_domains[] array (dropping the '5' in
> the name) and not use ARRAY_SIZE().
>
> Equally the supplies arrays could be renamed. We have the one with
> "sram" for legacy and everything else uses {"mali", NULL} but we have
> two definitions for it (mt8183_b and mt8192).
>
> Thanks,
> Steve
I'll do the array cleaning as well in a separate patch in the v6.
Regards,
Louis-Alexis
>
> > +static const struct panfrost_compatible mediatek_mt8370_data = {
> > + .num_supplies = ARRAY_SIZE(mediatek_mt8183_b_supplies) -
> > 1,
> > + .supply_names = mediatek_mt8183_b_supplies,
> > + .num_pm_domains = ARRAY_SIZE(mediatek_mt8186_pm_domains),
> > + .pm_domain_names = mediatek_mt8186_pm_domains,
> > + .pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
> > + .gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
> > +};
> > +
> > static const struct of_device_id dt_match[] = {
> > /* Set first to probe before the generic compatibles */
> > { .compatible = "amlogic,meson-gxm-mali",
> > @@ -868,6 +878,7 @@ static const struct of_device_id dt_match[] = {
> > { .compatible = "mediatek,mt8186-mali", .data =
> > &mediatek_mt8186_data },
> > { .compatible = "mediatek,mt8188-mali", .data =
> > &mediatek_mt8188_data },
> > { .compatible = "mediatek,mt8192-mali", .data =
> > &mediatek_mt8192_data },
> > + { .compatible = "mediatek,mt8370-mali", .data =
> > &mediatek_mt8370_data },
> > { .compatible = "allwinner,sun50i-h616-mali", .data =
> > &allwinner_h616_data },
> > {}
> > };
> >
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-05-07 15:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-02 12:17 [PATCH v5 0/3] Add Mali GPU support for Mediatek MT8370 SoC Louis-Alexis Eyraud
2025-05-02 12:17 ` [PATCH v5 1/3] dt-bindings: gpu: mali-bifrost: Add compatible for " Louis-Alexis Eyraud
2025-05-02 12:17 ` [PATCH v5 2/3] drm/panfrost: Add support for Mali on the " Louis-Alexis Eyraud
2025-05-06 8:28 ` AngeloGioacchino Del Regno
2025-05-07 14:06 ` Steven Price
2025-05-07 15:16 ` Louis-Alexis Eyraud
2025-05-02 12:17 ` [PATCH v5 3/3] arm64: dts: mediatek: mt8370: Enable gpu support Louis-Alexis Eyraud
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox