Skip to contentSkip to conversation

Add Mali GPU support for Mediatek MT8370 SoC

PATCH Superseded Louis-Alexis Eyraud 3 participants 8 messages Jan 30, 2025 – Feb 4, 2025

Subsystems (5)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add Mali GPU support for Mediatek MT8370 SoC

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.

I've testing this patchset on a Mediatek Genio 510 EVK board, with a kernel based on linux-next (tag: next-20250113) plus [1] patchset.

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

[1] https://lore.kernel.org/linux-mediatek/[email protected]/

---
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/[email protected]

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

 Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 ++++-
 arch/arm64/boot/dts/mediatek/mt8370.dtsi                    | 9 +++++++++
 drivers/gpu/drm/panfrost/panfrost_drv.c                     | 1 +
 3 files changed, 14 insertions(+), 1 deletion(-)

---
base-commit: 37136bf5c3a6f6b686d74f41837a6406bec6b7bc
change-id: 20250115-mt8370-enable-gpu-3b6f595fa63d
prerequisite-change-id: 20250113-dts_mt8370-genio-510-3560b8010ba9:v2
prerequisite-patch-id: af53ae39240467340ac4c9cdbc8fdd949c5457a2
prerequisite-patch-id: ca07485956f81c1a40029b48d2b4bcf00d74fc13
prerequisite-patch-id: c34d9870b2c61d87ad8a6facba13d8970682e679
prerequisite-patch-id: 48784acdcdd8b886fdec9f21c9cb88abb327e2e1

Best regards,

Signature · 1 line
Louis-Alexis Eyraud <[email protected]>
#1 lore raw

PATCH v2 1/3 dt-bindings: gpu: mali-bifrost: Add compatible for MT8370 SoC

Adds a compatible for the MediaTek MT8370 SoC, with an integrated ARM Mali G57 MC2 GPU (Valhall-JM, dual core). This new compatible is needed for this SoC support, as the other existing compatibles for the same architecture (MT8188, MT8192) do not match the required power domain number.

---
 Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml +4 -1
index 735c7f06c24e632ab738d062f15378f754c8adaf..6f6211950bb495fa6bfcdfe8d1e27e5ce7aeeae0 100644
@@ -37,6 +37,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:
@@ -217,7 +218,9 @@ allOf:
       properties:
         compatible:
           contains:
-            const: mediatek,mt8186-mali
+            enum:
+              - mediatek,mt8186-mali
+              - mediatek,mt8370-mali
     then:
       properties:
         power-domains:
Signature · 1 line
2.48.1
#2 lore raw

Re: [PATCH v2 1/3] dt-bindings: gpu: mali-bifrost: Add compatible for MT8370 SoC

Quoted 5 lines · Louis-Alexis Eyraud

Adds a compatible for the MediaTek MT8370 SoC, with an integrated ARM Mali G57 MC2 GPU (Valhall-JM, dual core). This new compatible is needed for this SoC support, as the other existing compatibles for the same architecture (MT8188, MT8192) do not match the required power domain number.

That's the only different? So device is compatible with older ones.

Best regards,
Krzysztof

#3 lore raw

PATCH v2 2/3 drm/panfrost: Add support for Mali on the MT8370 SoC

In reply to Louis-Alexis Eyraud

Add a compatible for the MediaTek MT8370 SoC, with an integrated ARM Mali G57 MC2 GPU (Valhall-JM, dual core), with the same platform data as MT8186 (one regulator, two power domains).

---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/panfrost/panfrost_drv.c +1 -0
index 0f3935556ac761adcd80197d87e8e478df436fd5..7b7e9f6f620659a7fdcb5d907ebc4f01eca876e0 100644
@@ -859,6 +859,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_mt8186_data },
 	{}
 };
 MODULE_DEVICE_TABLE(of, dt_match);
Signature · 1 line
2.48.1
#4 lore raw

Re: [PATCH v2 2/3] drm/panfrost: Add support for Mali on the MT8370 SoC

Quoted 16 lines · Louis-Alexis Eyraud

Add a compatible for the MediaTek MT8370 SoC, with an integrated ARM Mali G57 MC2 GPU (Valhall-JM, dual core), with the same platform data as MT8186 (one regulator, two power domains).

---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/panfrost/panfrost_drv.c +0 -0
index 0f3935556ac761adcd80197d87e8e478df436fd5..7b7e9f6f620659a7fdcb5d907ebc4f01eca876e0 100644

drivers/gpu/drm/panfrost/panfrost_drv.c static const struct of_device_id dt_match[] = { · line 862

Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_drv.c +1 -0
@@ -859,6 +859,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_mt8186_data },

Nothing improved here. All my previous comments still stand.

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH v2 2/3] drm/panfrost: Add support for Mali on the MT8370 SoC

Quoted 32 lines · Krzysztof Kozlowski
Quoted 27 lines · Louis-Alexis Eyraud

Add a compatible for the MediaTek MT8370 SoC, with an integrated ARM Mali G57 MC2 GPU (Valhall-JM, dual core), with the same platform data as MT8186 (one regulator, two power domains).

Signed-off-by Louis-Alexis Eyraud

<[email protected]>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 1 +

 1 file changed, 1 insertion(+)
drivers/gpu/drm/panfrost/panfrost_drv.c +0 -0

index 0f3935556ac761adcd80197d87e8e478df436fd5..7b7e9f6f620659a7fdcb5d907 ebc4f01eca876e0 100644

drivers/gpu/drm/panfrost/panfrost_drv.c +0 -0
@@ -859,6 +859,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 },

drivers/gpu/drm/panfrost/panfrost_drv.c +1 -0
+	{ .compatible = "mediatek,mt8370-mali", .data =
Quoted 1 line

&mediatek_mt8186_data },

Nothing improved here. All my previous comments still stand.

Quoted 2 lines

Best regards,
Krzysztof

Hi,

I'll reword this commit message in V3 to add that despite GPU architecture difference (making them being not compatible), the MT8186 platform data can still be used for MT8370 too because it only describes supplies, domains and enablement of power management features in the driver.

Regards,
Louis-Alexis

#6 lore raw

PATCH v2 3/3 arm64: dts: mediatek: mt8370: Enable gpu support

In reply to 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
```
---
 arch/arm64/boot/dts/mediatek/mt8370.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/mediatek/mt8370.dtsi +9 -0
index cf1a3759451ff899ce9e63e5a00f192fb483f6e5..2f27f7e7ab813b97f869297ae360f69854e966e1 100644
@@ -59,6 +59,15 @@ &cpu_little3_cooling_map0 {
 				<&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
 };
 
+&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>;
 };
Signature · 1 line
2.48.1
#7 lore raw
In reply to Louis-Alexis Eyraud
Quoted 49 lines · Louis-Alexis Eyraud

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.

I've testing this patchset on a Mediatek Genio 510 EVK board, with a kernel based on linux-next (tag: next-20250113) plus [1] patchset.

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

[1] https://lore.kernel.org/linux-mediatek/[email protected]/

---
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/[email protected]

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

 Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 ++++-
 arch/arm64/boot/dts/mediatek/mt8370.dtsi                    | 9 +++++++++
 drivers/gpu/drm/panfrost/panfrost_drv.c                     | 1 +
 3 files changed, 14 insertions(+), 1 deletion(-)

---
base-commit: 37136bf5c3a6f6b686d74f41837a6406bec6b7bc
change-id: 20250115-mt8370-enable-gpu-3b6f595fa63d
prerequisite-change-id: 20250113-dts_mt8370-genio-510-3560b8010ba9:v2
prerequisite-patch-id: af53ae39240467340ac4c9cdbc8fdd949c5457a2
prerequisite-patch-id: ca07485956f81c1a40029b48d2b4bcf00d74fc13
prerequisite-patch-id: c34d9870b2c61d87ad8a6facba13d8970682e679
prerequisite-patch-id: 48784acdcdd8b886fdec9f21c9cb88abb327e2e1

Quoted 6 lines

Best regards,
--
Louis-Alexis Eyraud <[email protected]>

My bot found new DTB warnings on the .dts files added or changed in this series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:

  pip3 install dtschema --upgrade

New warnings running 'make CHECK_DTBS=y for arch/arm64/boot/dts/mediatek/' for [email protected]:

arch/arm64/boot/dts/mediatek/mt8370-genio-510-evk.dtb: pinctrl@10005000: 'pcie-default' does not match any of the regexes: '-pins$', 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/pinctrl/mediatek,mt8188-pinctrl.yaml#
arch/arm64/boot/dts/mediatek/mt8370-genio-510-evk.dtb: pmic: regulators: 'compatible' is a required property
from schema $id: http://devicetree.org/schemas/mfd/mediatek,mt6397.yaml#
arch/arm64/boot/dts/mediatek/mt8370-genio-510-evk.dtb: pmic: '#sound-dai-cells', 'mt6359codec', 'mt6359rtc' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/mfd/mediatek,mt6397.yaml#
arch/arm64/boot/dts/mediatek/mt8370-genio-510-evk.dtb: mailbox@10320000: 'clock-names' is a required property
from schema $id: http://devicetree.org/schemas/mailbox/mediatek,gce-mailbox.yaml#
arch/arm64/boot/dts/mediatek/mt8370-genio-510-evk.dtb: jpeg-decoder@1a040000: iommus: [[123, 685], [123, 686], [123, 690], [123, 691], [123, 692], [123, 693]] is too long
from schema $id: http://devicetree.org/schemas/media/mediatek-jpeg-decoder.yaml#