linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/5] Add Mali GPU support for Mediatek MT8370 SoC
@ 2025-05-09 10:12 Louis-Alexis Eyraud
  2025-05-09 10:12 ` [PATCH v6 1/5] dt-bindings: gpu: mali-bifrost: Add compatible for " Louis-Alexis Eyraud
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Louis-Alexis Eyraud @ 2025-05-09 10:12 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've tested this patchset on a Mediatek Genio 510 EVK board,
with a kernel based on linux-next (tag: next-20250502).

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 v6:
- Add two new patches to commonize and drop duplicated data related to 
  the power domain and supplies definitions for Mediatek SoC
- Remove useless comment and rework MT8370 platform data to use
  mediatek_pm_domains and default_supplies arrays in 'drm/panfrost: Add
  support for Mali on the MT8370 SoC'
- Update code-review trailer
- Link to v5: https://lore.kernel.org/r/20250502-mt8370-enable-gpu-v5-0-98e247b30151@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 (5):
      dt-bindings: gpu: mali-bifrost: Add compatible for MT8370 SoC
      drm/panfrost: Drop duplicated Mediatek supplies arrays
      drm/panfrost: Commonize Mediatek power domain array definitions
      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            | 61 ++++++++++++----------
 3 files changed, 53 insertions(+), 29 deletions(-)
---
base-commit: 1c51b1ba38c07e4f999802eb708bf798dd5f5d1b
change-id: 20250115-mt8370-enable-gpu-3b6f595fa63d

Best regards,
-- 
Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v6 1/5] dt-bindings: gpu: mali-bifrost: Add compatible for MT8370 SoC
  2025-05-09 10:12 [PATCH v6 0/5] Add Mali GPU support for Mediatek MT8370 SoC Louis-Alexis Eyraud
@ 2025-05-09 10:12 ` Louis-Alexis Eyraud
  2025-05-09 10:12 ` [PATCH v6 2/5] drm/panfrost: Drop duplicated Mediatek supplies arrays Louis-Alexis Eyraud
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Louis-Alexis Eyraud @ 2025-05-09 10:12 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] 9+ messages in thread

* [PATCH v6 2/5] drm/panfrost: Drop duplicated Mediatek supplies arrays
  2025-05-09 10:12 [PATCH v6 0/5] Add Mali GPU support for Mediatek MT8370 SoC Louis-Alexis Eyraud
  2025-05-09 10:12 ` [PATCH v6 1/5] dt-bindings: gpu: mali-bifrost: Add compatible for " Louis-Alexis Eyraud
@ 2025-05-09 10:12 ` Louis-Alexis Eyraud
  2025-05-09 10:59   ` Steven Price
  2025-05-09 10:12 ` [PATCH v6 3/5] drm/panfrost: Commonize Mediatek power domain array definitions Louis-Alexis Eyraud
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Louis-Alexis Eyraud @ 2025-05-09 10:12 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

In the panfrost driver, the platform data of several Mediatek SoC
declares and uses custom supplies array definitions
(mediatek_mt8192_supplies, mediatek_mt8183_b_supplies), that are the
same as default_supplies (used by default platform data).

So drop these duplicated definitions and use default_supplies instead.
Also, rename mediatek_mt8183_supplies to a more generic name too
(legacy_supplies).

Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index f1ec3b02f15a0029d20c7d81046ded59854e885c..7b899a9b2120c608e61dab9ca831ab8e907e8139 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -797,19 +797,18 @@ static const struct panfrost_compatible amlogic_data = {
  * On new devicetrees please use the _b variant with a single and
  * coupled regulators instead.
  */
-static const char * const mediatek_mt8183_supplies[] = { "mali", "sram", NULL };
+static const char * const legacy_supplies[] = { "mali", "sram", NULL };
 static const char * const mediatek_mt8183_pm_domains[] = { "core0", "core1", "core2" };
 static const struct panfrost_compatible mediatek_mt8183_data = {
-	.num_supplies = ARRAY_SIZE(mediatek_mt8183_supplies) - 1,
-	.supply_names = mediatek_mt8183_supplies,
+	.num_supplies = ARRAY_SIZE(legacy_supplies) - 1,
+	.supply_names = legacy_supplies,
 	.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
 	.pm_domain_names = mediatek_mt8183_pm_domains,
 };
 
-static const char * const mediatek_mt8183_b_supplies[] = { "mali", NULL };
 static const struct panfrost_compatible mediatek_mt8183_b_data = {
-	.num_supplies = ARRAY_SIZE(mediatek_mt8183_b_supplies) - 1,
-	.supply_names = mediatek_mt8183_b_supplies,
+	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
+	.supply_names = default_supplies,
 	.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
 	.pm_domain_names = mediatek_mt8183_pm_domains,
 	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
@@ -817,8 +816,8 @@ static const struct panfrost_compatible mediatek_mt8183_b_data = {
 
 static const char * const mediatek_mt8186_pm_domains[] = { "core0", "core1" };
 static const struct panfrost_compatible mediatek_mt8186_data = {
-	.num_supplies = ARRAY_SIZE(mediatek_mt8183_b_supplies) - 1,
-	.supply_names = mediatek_mt8183_b_supplies,
+	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
+	.supply_names = default_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),
@@ -826,20 +825,19 @@ static const struct panfrost_compatible mediatek_mt8186_data = {
 
 /* MT8188 uses the same power domains and power supplies as MT8183 */
 static const struct panfrost_compatible mediatek_mt8188_data = {
-	.num_supplies = ARRAY_SIZE(mediatek_mt8183_b_supplies) - 1,
-	.supply_names = mediatek_mt8183_b_supplies,
+	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
+	.supply_names = default_supplies,
 	.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
 	.pm_domain_names = mediatek_mt8183_pm_domains,
 	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
 	.gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
 };
 
-static const char * const mediatek_mt8192_supplies[] = { "mali", NULL };
 static const char * const mediatek_mt8192_pm_domains[] = { "core0", "core1", "core2",
 							   "core3", "core4" };
 static const struct panfrost_compatible mediatek_mt8192_data = {
-	.num_supplies = ARRAY_SIZE(mediatek_mt8192_supplies) - 1,
-	.supply_names = mediatek_mt8192_supplies,
+	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
+	.supply_names = default_supplies,
 	.num_pm_domains = ARRAY_SIZE(mediatek_mt8192_pm_domains),
 	.pm_domain_names = mediatek_mt8192_pm_domains,
 	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),

-- 
2.49.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v6 3/5] drm/panfrost: Commonize Mediatek power domain array definitions
  2025-05-09 10:12 [PATCH v6 0/5] Add Mali GPU support for Mediatek MT8370 SoC Louis-Alexis Eyraud
  2025-05-09 10:12 ` [PATCH v6 1/5] dt-bindings: gpu: mali-bifrost: Add compatible for " Louis-Alexis Eyraud
  2025-05-09 10:12 ` [PATCH v6 2/5] drm/panfrost: Drop duplicated Mediatek supplies arrays Louis-Alexis Eyraud
@ 2025-05-09 10:12 ` Louis-Alexis Eyraud
  2025-05-09 10:59   ` Steven Price
  2025-05-09 10:12 ` [PATCH v6 4/5] drm/panfrost: Add support for Mali on the MT8370 SoC Louis-Alexis Eyraud
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Louis-Alexis Eyraud @ 2025-05-09 10:12 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

In the panfrost driver, the platform data of several Mediatek SoC
declares and uses several different power domains arrays according to
GPU core number present in the SoC:
- mediatek_mt8186_pm_domains (2 cores)
- mediatek_mt8183_pm_domains (3 cores)
- mediatek_mt8192_pm_domains (5 cores)

As they all are fixed arrays, starting with the same entries and the
platform data also has a power domains array length field
(num_pm_domains), they can be replaced by a single array, containing
all entries, if the num_pm_domains field of the platform data is also
set to the matching core number.

So, create a generic power domain array (mediatek_pm_domains) and use
it in the mt8183(b), mt8186, mt8188 and mt8192 platform data instead.

Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 7b899a9b2120c608e61dab9ca831ab8e907e8139..21b28bef84015793d9dba6b1e585891dc0dfcb6d 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -789,6 +789,8 @@ static const struct panfrost_compatible amlogic_data = {
 	.vendor_quirk = panfrost_gpu_amlogic_quirk,
 };
 
+static const char * const mediatek_pm_domains[] = { "core0", "core1", "core2",
+						    "core3", "core4" };
 /*
  * The old data with two power supplies for MT8183 is here only to
  * keep retro-compatibility with older devicetrees, as DVFS will
@@ -798,48 +800,43 @@ static const struct panfrost_compatible amlogic_data = {
  * coupled regulators instead.
  */
 static const char * const legacy_supplies[] = { "mali", "sram", NULL };
-static const char * const mediatek_mt8183_pm_domains[] = { "core0", "core1", "core2" };
 static const struct panfrost_compatible mediatek_mt8183_data = {
 	.num_supplies = ARRAY_SIZE(legacy_supplies) - 1,
 	.supply_names = legacy_supplies,
-	.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
-	.pm_domain_names = mediatek_mt8183_pm_domains,
+	.num_pm_domains = 3,
+	.pm_domain_names = mediatek_pm_domains,
 };
 
 static const struct panfrost_compatible mediatek_mt8183_b_data = {
 	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
 	.supply_names = default_supplies,
-	.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
-	.pm_domain_names = mediatek_mt8183_pm_domains,
+	.num_pm_domains = 3,
+	.pm_domain_names = mediatek_pm_domains,
 	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
 };
 
-static const char * const mediatek_mt8186_pm_domains[] = { "core0", "core1" };
 static const struct panfrost_compatible mediatek_mt8186_data = {
 	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
 	.supply_names = default_supplies,
-	.num_pm_domains = ARRAY_SIZE(mediatek_mt8186_pm_domains),
-	.pm_domain_names = mediatek_mt8186_pm_domains,
+	.num_pm_domains = 2,
+	.pm_domain_names = mediatek_pm_domains,
 	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
 };
 
-/* MT8188 uses the same power domains and power supplies as MT8183 */
 static const struct panfrost_compatible mediatek_mt8188_data = {
 	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
 	.supply_names = default_supplies,
-	.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
-	.pm_domain_names = mediatek_mt8183_pm_domains,
+	.num_pm_domains = 3,
+	.pm_domain_names = mediatek_pm_domains,
 	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
 	.gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
 };
 
-static const char * const mediatek_mt8192_pm_domains[] = { "core0", "core1", "core2",
-							   "core3", "core4" };
 static const struct panfrost_compatible mediatek_mt8192_data = {
 	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
 	.supply_names = default_supplies,
-	.num_pm_domains = ARRAY_SIZE(mediatek_mt8192_pm_domains),
-	.pm_domain_names = mediatek_mt8192_pm_domains,
+	.num_pm_domains = 5,
+	.pm_domain_names = mediatek_pm_domains,
 	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
 	.gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
 };

-- 
2.49.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v6 4/5] drm/panfrost: Add support for Mali on the MT8370 SoC
  2025-05-09 10:12 [PATCH v6 0/5] Add Mali GPU support for Mediatek MT8370 SoC Louis-Alexis Eyraud
                   ` (2 preceding siblings ...)
  2025-05-09 10:12 ` [PATCH v6 3/5] drm/panfrost: Commonize Mediatek power domain array definitions Louis-Alexis Eyraud
@ 2025-05-09 10:12 ` Louis-Alexis Eyraud
  2025-05-09 10:12 ` [PATCH v6 5/5] arm64: dts: mediatek: mt8370: Enable gpu support Louis-Alexis Eyraud
  2025-06-20 14:58 ` [PATCH v6 0/5] Add Mali GPU support for Mediatek MT8370 SoC Steven Price
  5 siblings, 0 replies; 9+ messages in thread
From: Louis-Alexis Eyraud @ 2025-05-09 10:12 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.

Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 21b28bef84015793d9dba6b1e585891dc0dfcb6d..07cd67baa81bfccabf3b1a29f7d78702038bb2cd 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -841,6 +841,15 @@ static const struct panfrost_compatible mediatek_mt8192_data = {
 	.gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
 };
 
+static const struct panfrost_compatible mediatek_mt8370_data = {
+	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
+	.supply_names = default_supplies,
+	.num_pm_domains = 2,
+	.pm_domain_names = mediatek_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",
@@ -863,6 +872,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] 9+ messages in thread

* [PATCH v6 5/5] arm64: dts: mediatek: mt8370: Enable gpu support
  2025-05-09 10:12 [PATCH v6 0/5] Add Mali GPU support for Mediatek MT8370 SoC Louis-Alexis Eyraud
                   ` (3 preceding siblings ...)
  2025-05-09 10:12 ` [PATCH v6 4/5] drm/panfrost: Add support for Mali on the MT8370 SoC Louis-Alexis Eyraud
@ 2025-05-09 10:12 ` Louis-Alexis Eyraud
  2025-06-20 14:58 ` [PATCH v6 0/5] Add Mali GPU support for Mediatek MT8370 SoC Steven Price
  5 siblings, 0 replies; 9+ messages in thread
From: Louis-Alexis Eyraud @ 2025-05-09 10:12 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] 9+ messages in thread

* Re: [PATCH v6 2/5] drm/panfrost: Drop duplicated Mediatek supplies arrays
  2025-05-09 10:12 ` [PATCH v6 2/5] drm/panfrost: Drop duplicated Mediatek supplies arrays Louis-Alexis Eyraud
@ 2025-05-09 10:59   ` Steven Price
  0 siblings, 0 replies; 9+ messages in thread
From: Steven Price @ 2025-05-09 10:59 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 09/05/2025 11:12, Louis-Alexis Eyraud wrote:
> In the panfrost driver, the platform data of several Mediatek SoC
> declares and uses custom supplies array definitions
> (mediatek_mt8192_supplies, mediatek_mt8183_b_supplies), that are the
> same as default_supplies (used by default platform data).
> 
> So drop these duplicated definitions and use default_supplies instead.
> Also, rename mediatek_mt8183_supplies to a more generic name too
> (legacy_supplies).
> 
> Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>

Thanks for doing this.

Reviewed-by: Steven Price <steven.price@arm.com>

> ---
>  drivers/gpu/drm/panfrost/panfrost_drv.c | 24 +++++++++++-------------
>  1 file changed, 11 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index f1ec3b02f15a0029d20c7d81046ded59854e885c..7b899a9b2120c608e61dab9ca831ab8e907e8139 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -797,19 +797,18 @@ static const struct panfrost_compatible amlogic_data = {
>   * On new devicetrees please use the _b variant with a single and
>   * coupled regulators instead.
>   */
> -static const char * const mediatek_mt8183_supplies[] = { "mali", "sram", NULL };
> +static const char * const legacy_supplies[] = { "mali", "sram", NULL };
>  static const char * const mediatek_mt8183_pm_domains[] = { "core0", "core1", "core2" };
>  static const struct panfrost_compatible mediatek_mt8183_data = {
> -	.num_supplies = ARRAY_SIZE(mediatek_mt8183_supplies) - 1,
> -	.supply_names = mediatek_mt8183_supplies,
> +	.num_supplies = ARRAY_SIZE(legacy_supplies) - 1,
> +	.supply_names = legacy_supplies,
>  	.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
>  	.pm_domain_names = mediatek_mt8183_pm_domains,
>  };
>  
> -static const char * const mediatek_mt8183_b_supplies[] = { "mali", NULL };
>  static const struct panfrost_compatible mediatek_mt8183_b_data = {
> -	.num_supplies = ARRAY_SIZE(mediatek_mt8183_b_supplies) - 1,
> -	.supply_names = mediatek_mt8183_b_supplies,
> +	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
> +	.supply_names = default_supplies,
>  	.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
>  	.pm_domain_names = mediatek_mt8183_pm_domains,
>  	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
> @@ -817,8 +816,8 @@ static const struct panfrost_compatible mediatek_mt8183_b_data = {
>  
>  static const char * const mediatek_mt8186_pm_domains[] = { "core0", "core1" };
>  static const struct panfrost_compatible mediatek_mt8186_data = {
> -	.num_supplies = ARRAY_SIZE(mediatek_mt8183_b_supplies) - 1,
> -	.supply_names = mediatek_mt8183_b_supplies,
> +	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
> +	.supply_names = default_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),
> @@ -826,20 +825,19 @@ static const struct panfrost_compatible mediatek_mt8186_data = {
>  
>  /* MT8188 uses the same power domains and power supplies as MT8183 */
>  static const struct panfrost_compatible mediatek_mt8188_data = {
> -	.num_supplies = ARRAY_SIZE(mediatek_mt8183_b_supplies) - 1,
> -	.supply_names = mediatek_mt8183_b_supplies,
> +	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
> +	.supply_names = default_supplies,
>  	.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
>  	.pm_domain_names = mediatek_mt8183_pm_domains,
>  	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
>  	.gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
>  };
>  
> -static const char * const mediatek_mt8192_supplies[] = { "mali", NULL };
>  static const char * const mediatek_mt8192_pm_domains[] = { "core0", "core1", "core2",
>  							   "core3", "core4" };
>  static const struct panfrost_compatible mediatek_mt8192_data = {
> -	.num_supplies = ARRAY_SIZE(mediatek_mt8192_supplies) - 1,
> -	.supply_names = mediatek_mt8192_supplies,
> +	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
> +	.supply_names = default_supplies,
>  	.num_pm_domains = ARRAY_SIZE(mediatek_mt8192_pm_domains),
>  	.pm_domain_names = mediatek_mt8192_pm_domains,
>  	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v6 3/5] drm/panfrost: Commonize Mediatek power domain array definitions
  2025-05-09 10:12 ` [PATCH v6 3/5] drm/panfrost: Commonize Mediatek power domain array definitions Louis-Alexis Eyraud
@ 2025-05-09 10:59   ` Steven Price
  0 siblings, 0 replies; 9+ messages in thread
From: Steven Price @ 2025-05-09 10:59 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 09/05/2025 11:12, Louis-Alexis Eyraud wrote:
> In the panfrost driver, the platform data of several Mediatek SoC
> declares and uses several different power domains arrays according to
> GPU core number present in the SoC:
> - mediatek_mt8186_pm_domains (2 cores)
> - mediatek_mt8183_pm_domains (3 cores)
> - mediatek_mt8192_pm_domains (5 cores)
> 
> As they all are fixed arrays, starting with the same entries and the
> platform data also has a power domains array length field
> (num_pm_domains), they can be replaced by a single array, containing
> all entries, if the num_pm_domains field of the platform data is also
> set to the matching core number.
> 
> So, create a generic power domain array (mediatek_pm_domains) and use
> it in the mt8183(b), mt8186, mt8188 and mt8192 platform data instead.
> 
> Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>

Reviewed-by: Steven Price <steven.price@arm.com>

> ---
>  drivers/gpu/drm/panfrost/panfrost_drv.c | 27 ++++++++++++---------------
>  1 file changed, 12 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index 7b899a9b2120c608e61dab9ca831ab8e907e8139..21b28bef84015793d9dba6b1e585891dc0dfcb6d 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -789,6 +789,8 @@ static const struct panfrost_compatible amlogic_data = {
>  	.vendor_quirk = panfrost_gpu_amlogic_quirk,
>  };
>  
> +static const char * const mediatek_pm_domains[] = { "core0", "core1", "core2",
> +						    "core3", "core4" };
>  /*
>   * The old data with two power supplies for MT8183 is here only to
>   * keep retro-compatibility with older devicetrees, as DVFS will
> @@ -798,48 +800,43 @@ static const struct panfrost_compatible amlogic_data = {
>   * coupled regulators instead.
>   */
>  static const char * const legacy_supplies[] = { "mali", "sram", NULL };
> -static const char * const mediatek_mt8183_pm_domains[] = { "core0", "core1", "core2" };
>  static const struct panfrost_compatible mediatek_mt8183_data = {
>  	.num_supplies = ARRAY_SIZE(legacy_supplies) - 1,
>  	.supply_names = legacy_supplies,
> -	.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
> -	.pm_domain_names = mediatek_mt8183_pm_domains,
> +	.num_pm_domains = 3,
> +	.pm_domain_names = mediatek_pm_domains,
>  };
>  
>  static const struct panfrost_compatible mediatek_mt8183_b_data = {
>  	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
>  	.supply_names = default_supplies,
> -	.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
> -	.pm_domain_names = mediatek_mt8183_pm_domains,
> +	.num_pm_domains = 3,
> +	.pm_domain_names = mediatek_pm_domains,
>  	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
>  };
>  
> -static const char * const mediatek_mt8186_pm_domains[] = { "core0", "core1" };
>  static const struct panfrost_compatible mediatek_mt8186_data = {
>  	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
>  	.supply_names = default_supplies,
> -	.num_pm_domains = ARRAY_SIZE(mediatek_mt8186_pm_domains),
> -	.pm_domain_names = mediatek_mt8186_pm_domains,
> +	.num_pm_domains = 2,
> +	.pm_domain_names = mediatek_pm_domains,
>  	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
>  };
>  
> -/* MT8188 uses the same power domains and power supplies as MT8183 */
>  static const struct panfrost_compatible mediatek_mt8188_data = {
>  	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
>  	.supply_names = default_supplies,
> -	.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
> -	.pm_domain_names = mediatek_mt8183_pm_domains,
> +	.num_pm_domains = 3,
> +	.pm_domain_names = mediatek_pm_domains,
>  	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
>  	.gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
>  };
>  
> -static const char * const mediatek_mt8192_pm_domains[] = { "core0", "core1", "core2",
> -							   "core3", "core4" };
>  static const struct panfrost_compatible mediatek_mt8192_data = {
>  	.num_supplies = ARRAY_SIZE(default_supplies) - 1,
>  	.supply_names = default_supplies,
> -	.num_pm_domains = ARRAY_SIZE(mediatek_mt8192_pm_domains),
> -	.pm_domain_names = mediatek_mt8192_pm_domains,
> +	.num_pm_domains = 5,
> +	.pm_domain_names = mediatek_pm_domains,
>  	.pm_features = BIT(GPU_PM_CLK_DIS) | BIT(GPU_PM_VREG_OFF),
>  	.gpu_quirks = BIT(GPU_QUIRK_FORCE_AARCH64_PGTABLE),
>  };
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v6 0/5] Add Mali GPU support for Mediatek MT8370 SoC
  2025-05-09 10:12 [PATCH v6 0/5] Add Mali GPU support for Mediatek MT8370 SoC Louis-Alexis Eyraud
                   ` (4 preceding siblings ...)
  2025-05-09 10:12 ` [PATCH v6 5/5] arm64: dts: mediatek: mt8370: Enable gpu support Louis-Alexis Eyraud
@ 2025-06-20 14:58 ` Steven Price
  5 siblings, 0 replies; 9+ messages in thread
From: Steven Price @ 2025-06-20 14:58 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, Conor Dooley

All 5 patches push to drm-misc-next.

Thanks,
Steve

On 09/05/2025 11:12, Louis-Alexis Eyraud wrote:
> 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've tested this patchset on a Mediatek Genio 510 EVK board,
> with a kernel based on linux-next (tag: next-20250502).
> 
> 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 v6:
> - Add two new patches to commonize and drop duplicated data related to 
>   the power domain and supplies definitions for Mediatek SoC
> - Remove useless comment and rework MT8370 platform data to use
>   mediatek_pm_domains and default_supplies arrays in 'drm/panfrost: Add
>   support for Mali on the MT8370 SoC'
> - Update code-review trailer
> - Link to v5: https://lore.kernel.org/r/20250502-mt8370-enable-gpu-v5-0-98e247b30151@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 (5):
>       dt-bindings: gpu: mali-bifrost: Add compatible for MT8370 SoC
>       drm/panfrost: Drop duplicated Mediatek supplies arrays
>       drm/panfrost: Commonize Mediatek power domain array definitions
>       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            | 61 ++++++++++++----------
>  3 files changed, 53 insertions(+), 29 deletions(-)
> ---
> base-commit: 1c51b1ba38c07e4f999802eb708bf798dd5f5d1b
> change-id: 20250115-mt8370-enable-gpu-3b6f595fa63d
> 
> Best regards,



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-06-20 15:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-09 10:12 [PATCH v6 0/5] Add Mali GPU support for Mediatek MT8370 SoC Louis-Alexis Eyraud
2025-05-09 10:12 ` [PATCH v6 1/5] dt-bindings: gpu: mali-bifrost: Add compatible for " Louis-Alexis Eyraud
2025-05-09 10:12 ` [PATCH v6 2/5] drm/panfrost: Drop duplicated Mediatek supplies arrays Louis-Alexis Eyraud
2025-05-09 10:59   ` Steven Price
2025-05-09 10:12 ` [PATCH v6 3/5] drm/panfrost: Commonize Mediatek power domain array definitions Louis-Alexis Eyraud
2025-05-09 10:59   ` Steven Price
2025-05-09 10:12 ` [PATCH v6 4/5] drm/panfrost: Add support for Mali on the MT8370 SoC Louis-Alexis Eyraud
2025-05-09 10:12 ` [PATCH v6 5/5] arm64: dts: mediatek: mt8370: Enable gpu support Louis-Alexis Eyraud
2025-06-20 14:58 ` [PATCH v6 0/5] Add Mali GPU support for Mediatek MT8370 SoC Steven Price

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).