Subject: [PATCH v2 00/10] Panfrost: Improve and add MediaTek SoCs support

Changes in v2:
- Add power-domain-names commit from Chen-Yu to the series
- Kept sram-supply in base schema, overridden for non-MediaTek
- Added Reviewed-by tags from Steven Price to the driver commits
(as released in reply to v1's cover letter - thanks!)

This series adds support for new MediaTek SoCs (MT8186/MT8192/MT8195)
and improves MT8183 support: since the mtk-regulator-coupler driver
was picked, it is now useless for Panfrost to look for, and manage,
two regulators (GPU Vcore and GPU SRAM) on MediaTek;

The aforementioned driver will take care of keeping the voltage
relation (/constraints) of the two regulators on its own when a
voltage change request is sent to the Vcore, solving the old time
issue with not working DVFS on Panfrost+MediaTek (due to devfreq
supporting only single regulator).

In the specific case of MT8183, in order to not break the ABI, it
was necessary to add a new compatible for enabling DVFS.

Alyssa Rosenzweig (3):
drm/panfrost: Increase MAX_PM_DOMAINS to 5
drm/panfrost: Add the MT8192 GPU ID
drm/panfrost: Add mediatek,mt8192-mali compatible

AngeloGioacchino Del Regno (6):
dt-bindings: gpu: mali-bifrost: Split out MediaTek power-domains
variation
dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192
dt-bindings: gpu: mali-bifrost: Add compatible for MT8195 SoC
dt-bindings: gpu: mali-bifrost: Add new MT8183 compatible
dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186
drm/panfrost: Add new compatible for Mali on the MT8183 SoC

Chen-Yu Tsai (1):
dt-bindings: gpu: mali-bifrost: Add power-domain-names to base schema

.../bindings/gpu/arm,mali-bifrost.yaml | 67 ++++++++++++++++++-
drivers/gpu/drm/panfrost/panfrost_device.h | 2 +-
drivers/gpu/drm/panfrost/panfrost_drv.c | 28 ++++++++
drivers/gpu/drm/panfrost/panfrost_gpu.c | 8 +++
4 files changed, 101 insertions(+), 4 deletions(-)

--
2.39.2



Subject: [PATCH v2 01/10] dt-bindings: gpu: mali-bifrost: Add power-domain-names to base schema

From: Chen-Yu Tsai <[email protected]>

In commit a7a596cd3115 ("dt-bindings: gpu: mali-bifrost: Add Mediatek
MT8183"), "power-domain-names" was added to the mt8183-mali sub-schema,
but was not added to the base mali-bifrost schema. Because validation
happens for the base schema and any sub-schemas separately, this causes
errors to be emitted when validating the MT8183 device trees.

Add power-domain-names to the base schema to silence the error.

Fixes: a7a596cd3115 ("dt-bindings: gpu: mali-bifrost: Add Mediatek MT8183")
Signed-off-by: Chen-Yu Tsai <[email protected]>
Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 3 +++
1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
index 78964c140b46..02699d389be1 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
@@ -65,6 +65,8 @@ properties:
minItems: 1
maxItems: 3

+ power-domain-names: true
+
resets:
minItems: 1
maxItems: 3
@@ -166,6 +168,7 @@ allOf:
properties:
power-domains:
maxItems: 1
+ power-domain-names: false
sram-supply: false
- if:
properties:
--
2.39.2


Subject: [PATCH v2 02/10] dt-bindings: gpu: mali-bifrost: Split out MediaTek power-domains variation

In preparation for adding new bindings for new MediaTek SoCs, split out
the power-domain-names and power-domainsvariation from the `else` in
the current mediatek,mt8183-mali conditional.

The sram-supply part is left in place to be disallowed for anything
that is not compatible with "mediatek,mt8183-mali" as this regulator
is MediaTek-specific and it is, and will ever be, used only for this
specific string due to the addition of the mediatek-regulator-coupler
driver.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
.../devicetree/bindings/gpu/arm,mali-bifrost.yaml | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
index 02699d389be1..ac174c17e25f 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
@@ -145,6 +145,18 @@ allOf:
- power-domains
- resets
- reset-names
+ - if:
+ not:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - mediatek,mt8183-mali
+ then:
+ properties:
+ power-domains:
+ maxItems: 1
+ power-domain-names: false
- if:
properties:
compatible:
@@ -166,9 +178,6 @@ allOf:
- power-domain-names
else:
properties:
- power-domains:
- maxItems: 1
- power-domain-names: false
sram-supply: false
- if:
properties:
--
2.39.2


Subject: [PATCH v2 03/10] dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192

MediaTek MT8192 (and similar) needs five power domains for the
Mali GPU and no sram-supply: change the binding to allow so.

Fixes: 5d82e74a97c2 ("dt-bindings: Add compatible for Mali Valhall (JM)")
Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---
.../bindings/gpu/arm,mali-bifrost.yaml | 22 ++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
index ac174c17e25f..65fe139ceb83 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
@@ -63,7 +63,7 @@ properties:

power-domains:
minItems: 1
- maxItems: 3
+ maxItems: 5

power-domain-names: true

@@ -152,6 +152,7 @@ allOf:
contains:
enum:
- mediatek,mt8183-mali
+ - mediatek,mt8192-mali
then:
properties:
power-domains:
@@ -179,6 +180,25 @@ allOf:
else:
properties:
sram-supply: false
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: mediatek,mt8192-mali
+ then:
+ properties:
+ power-domains:
+ minItems: 5
+ power-domain-names:
+ items:
+ - const: core0
+ - const: core1
+ - const: core2
+ - const: core3
+ - const: core4
+ required:
+ - power-domains
+ - power-domain-names
- if:
properties:
compatible:
--
2.39.2


Subject: [PATCH v2 04/10] dt-bindings: gpu: mali-bifrost: Add compatible for MT8195 SoC

The MediaTek MT8195 SoC has a Mali G57 MC5 (Valhall-JM) and has the
same number of power domains and requirements as MT8192 in terms of
bindings.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
index 65fe139ceb83..4d9ab4702582 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
@@ -25,6 +25,11 @@ properties:
- rockchip,px30-mali
- rockchip,rk3568-mali
- const: arm,mali-bifrost # Mali Bifrost GPU model/revision is fully discoverable
+ - items:
+ - enum:
+ - mediatek,mt8195-mali
+ - const: mediatek,mt8192-mali
+ - const: arm,mali-valhall-jm # Mali Valhall GPU model/revision is fully discoverable
- items:
- enum:
- mediatek,mt8192-mali
--
2.39.2


Subject: [PATCH v2 05/10] dt-bindings: gpu: mali-bifrost: Add new MT8183 compatible

Since new platform data was required in Panfrost for getting GPU DVFS
finally working on MediaTek SoCs, add a new "mediatek,mt8183b-mali"
compatible.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---
.../bindings/gpu/arm,mali-bifrost.yaml | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
index 4d9ab4702582..be18b161959b 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
@@ -19,6 +19,7 @@ properties:
- enum:
- amlogic,meson-g12a-mali
- mediatek,mt8183-mali
+ - mediatek,mt8183b-mali
- realtek,rtd1619-mali
- renesas,r9a07g044-mali
- renesas,r9a07g054-mali
@@ -157,6 +158,7 @@ allOf:
contains:
enum:
- mediatek,mt8183-mali
+ - mediatek,mt8183b-mali
- mediatek,mt8192-mali
then:
properties:
@@ -185,6 +187,23 @@ allOf:
else:
properties:
sram-supply: false
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: mediatek,mt8183b-mali
+ then:
+ properties:
+ power-domains:
+ minItems: 3
+ power-domain-names:
+ items:
+ - const: core0
+ - const: core1
+ - const: core2
+ required:
+ - power-domains
+ - power-domain-names
- if:
properties:
compatible:
--
2.39.2


Subject: [PATCH v2 07/10] drm/panfrost: Increase MAX_PM_DOMAINS to 5

From: Alyssa Rosenzweig <[email protected]>

Increase the MAX_PM_DOMAINS constant from 3 to 5, to support the
extra power domains required by the Mali-G57 on the MT8192.

Signed-off-by: Alyssa Rosenzweig <[email protected]>
Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
Reviewed-by: Steven Price <[email protected]>
---
drivers/gpu/drm/panfrost/panfrost_device.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h
index d9ba68cffb77..b0126b9fbadc 100644
--- a/drivers/gpu/drm/panfrost/panfrost_device.h
+++ b/drivers/gpu/drm/panfrost/panfrost_device.h
@@ -23,7 +23,7 @@ struct panfrost_job;
struct panfrost_perfcnt;

#define NUM_JOB_SLOTS 3
-#define MAX_PM_DOMAINS 3
+#define MAX_PM_DOMAINS 5

struct panfrost_features {
u16 id;
--
2.39.2


Subject: [PATCH v2 06/10] dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186

Get GPU support on MT8186 by adding its compatible.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
index be18b161959b..43a841d4e94d 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
@@ -15,6 +15,11 @@ properties:

compatible:
oneOf:
+ - items:
+ - enum:
+ - mediatek,mt8186-mali
+ - const: mediatek,mt8183b-mali
+ - const: arm,mali-bifrost # Mali Bifrost GPU model/revision is fully discoverable
- items:
- enum:
- amlogic,meson-g12a-mali
--
2.39.2


Subject: [PATCH v2 08/10] drm/panfrost: Add the MT8192 GPU ID

From: Alyssa Rosenzweig <[email protected]>

MediaTek MT8192 has a Mali-G57 with a special GPU ID. Add its GPU ID,
but treat it as otherwise identical to a standard Mali-G57.

We do _not_ fix up the GPU ID here -- userspace needs to be aware of the
special GPU ID, in case we find functional differences between
MediaTek's implementation and the standard Mali-G57 down the line.

Signed-off-by: Alyssa Rosenzweig <[email protected]>
Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
Reviewed-by: Steven Price <[email protected]>
---
drivers/gpu/drm/panfrost/panfrost_gpu.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c
index 6452e4e900dd..d28b99732dde 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
@@ -204,6 +204,14 @@ static const struct panfrost_model gpu_models[] = {

GPU_MODEL(g57, 0x9001,
GPU_REV(g57, 0, 0)),
+
+ /* MediaTek MT8192 has a Mali-G57 with a different GPU ID from the
+ * standard. Arm's driver does not appear to handle this model.
+ * ChromeOS has a hack downstream for it. Treat it as equivalent to
+ * standard Mali-G57 for now.
+ */
+ GPU_MODEL(g57, 0x9003,
+ GPU_REV(g57, 0, 0)),
};

static void panfrost_gpu_init_features(struct panfrost_device *pfdev)
--
2.39.2


Subject: [PATCH v2 09/10] drm/panfrost: Add mediatek,mt8192-mali compatible

From: Alyssa Rosenzweig <[email protected]>

Required for Mali-G57 on the Mediatek MT8192 and MT8195, which
uses even more power domains than the MT8183 before it.

Signed-off-by: Alyssa Rosenzweig <[email protected]>
[Angelo: Removed unneeded "sram" supply, added mt8195 to commit description]
Co-developed-by: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
Reviewed-by: Steven Price <[email protected]>
---
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 abb0dadd8f63..5d25e77e1037 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -663,6 +663,16 @@ static const struct panfrost_compatible mediatek_mt8183_data = {
.pm_domain_names = mediatek_mt8183_pm_domains,
};

+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_pm_domains = ARRAY_SIZE(mediatek_mt8192_pm_domains),
+ .pm_domain_names = mediatek_mt8192_pm_domains,
+};
+
static const struct of_device_id dt_match[] = {
/* Set first to probe before the generic compatibles */
{ .compatible = "amlogic,meson-gxm-mali",
@@ -681,6 +691,7 @@ static const struct of_device_id dt_match[] = {
{ .compatible = "arm,mali-bifrost", .data = &default_data, },
{ .compatible = "arm,mali-valhall-jm", .data = &default_data, },
{ .compatible = "mediatek,mt8183-mali", .data = &mediatek_mt8183_data },
+ { .compatible = "mediatek,mt8192-mali", .data = &mediatek_mt8192_data },
{}
};
MODULE_DEVICE_TABLE(of, dt_match);
--
2.39.2


Subject: [PATCH v2 10/10] drm/panfrost: Add new compatible for Mali on the MT8183 SoC

The "mediatek,mt8183-mali" compatible uses platform data that calls for
getting (and managing) two regulators ("mali" and "sram") but devfreq
does not support this usecase, resulting in DVFS not working.

Since a lot of MediaTek SoCs need to set the voltages for the GPU SRAM
regulator in a specific relation to the GPU VCORE regulator, a MediaTek
SoC specific driver was introduced to automatically satisfy, through
coupling, these constraints: this means that there is at all no need to
manage both regulators in panfrost but to otherwise just manage the main
"mali" (-> gpu vcore) regulator instead.

Keeping in mind that we cannot break the ABI, the most sensible route
(avoiding hacks and uselessly overcomplicated code) to get a MT8183
node with one power supply was to add a new "mediatek,mt8183b-mali"
compatible, which effectively deprecates the former.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
Reviewed-by: Steven Price <[email protected]>
---
drivers/gpu/drm/panfrost/panfrost_drv.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 5d25e77e1037..14cdeaeeb5c4 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -654,6 +654,14 @@ static const struct panfrost_compatible amlogic_data = {
.vendor_quirk = panfrost_gpu_amlogic_quirk,
};

+/*
+ * The old data with two power supplies for MT8183 is here only to
+ * keep retro-compatibility with older devicetrees, as DVFS will
+ * not work with this one.
+ *
+ * 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 mediatek_mt8183_pm_domains[] = { "core0", "core1", "core2" };
static const struct panfrost_compatible mediatek_mt8183_data = {
@@ -663,6 +671,14 @@ static const struct panfrost_compatible mediatek_mt8183_data = {
.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_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
+ .pm_domain_names = mediatek_mt8183_pm_domains,
+};
+
static const char * const mediatek_mt8192_supplies[] = { "mali", NULL };
static const char * const mediatek_mt8192_pm_domains[] = { "core0", "core1", "core2",
"core3", "core4" };
@@ -691,6 +707,7 @@ static const struct of_device_id dt_match[] = {
{ .compatible = "arm,mali-bifrost", .data = &default_data, },
{ .compatible = "arm,mali-valhall-jm", .data = &default_data, },
{ .compatible = "mediatek,mt8183-mali", .data = &mediatek_mt8183_data },
+ { .compatible = "mediatek,mt8183b-mali", .data = &mediatek_mt8183_b_data },
{ .compatible = "mediatek,mt8192-mali", .data = &mediatek_mt8192_data },
{}
};
--
2.39.2


2023-02-22 04:11:35

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v2 08/10] drm/panfrost: Add the MT8192 GPU ID

On Tue, Feb 21, 2023 at 11:37 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> From: Alyssa Rosenzweig <[email protected]>
>
> MediaTek MT8192 has a Mali-G57 with a special GPU ID. Add its GPU ID,
> but treat it as otherwise identical to a standard Mali-G57.
>
> We do _not_ fix up the GPU ID here -- userspace needs to be aware of the
> special GPU ID, in case we find functional differences between
> MediaTek's implementation and the standard Mali-G57 down the line.

> Signed-off-by: Alyssa Rosenzweig <[email protected]>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> Reviewed-by: Steven Price <[email protected]>

Reviewed-by: Chen-Yu Tsai <[email protected]>

FYI MT8195 has a minor revision for Mali-G57. See https://crrev.com/c/2834981
The commit doesn't say what issues were resolved or still linger though.

> ---
> drivers/gpu/drm/panfrost/panfrost_gpu.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c
> index 6452e4e900dd..d28b99732dde 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
> @@ -204,6 +204,14 @@ static const struct panfrost_model gpu_models[] = {
>
> GPU_MODEL(g57, 0x9001,
> GPU_REV(g57, 0, 0)),
> +
> + /* MediaTek MT8192 has a Mali-G57 with a different GPU ID from the
> + * standard. Arm's driver does not appear to handle this model.
> + * ChromeOS has a hack downstream for it. Treat it as equivalent to
> + * standard Mali-G57 for now.
> + */
> + GPU_MODEL(g57, 0x9003,
> + GPU_REV(g57, 0, 0)),
> };
>
> static void panfrost_gpu_init_features(struct panfrost_device *pfdev)
> --
> 2.39.2
>

2023-02-22 04:39:04

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v2 07/10] drm/panfrost: Increase MAX_PM_DOMAINS to 5

On Tue, Feb 21, 2023 at 11:37 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> From: Alyssa Rosenzweig <[email protected]>
>
> Increase the MAX_PM_DOMAINS constant from 3 to 5, to support the
> extra power domains required by the Mali-G57 on the MT8192.
>
> Signed-off-by: Alyssa Rosenzweig <[email protected]>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> Reviewed-by: Steven Price <[email protected]>

Reviewed-by: Chen-Yu Tsai <[email protected]>

2023-02-22 04:39:23

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v2 09/10] drm/panfrost: Add mediatek,mt8192-mali compatible

On Tue, Feb 21, 2023 at 11:37 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> From: Alyssa Rosenzweig <[email protected]>
>
> Required for Mali-G57 on the Mediatek MT8192 and MT8195, which
> uses even more power domains than the MT8183 before it.
>
> Signed-off-by: Alyssa Rosenzweig <[email protected]>
> [Angelo: Removed unneeded "sram" supply, added mt8195 to commit description]
> Co-developed-by: AngeloGioacchino Del Regno <[email protected]>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> Reviewed-by: Steven Price <[email protected]>

Reviewed-by: Chen-Yu Tsai <[email protected]>

2023-02-22 07:07:10

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v2 10/10] drm/panfrost: Add new compatible for Mali on the MT8183 SoC

On Tue, Feb 21, 2023 at 11:37 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> The "mediatek,mt8183-mali" compatible uses platform data that calls for
> getting (and managing) two regulators ("mali" and "sram") but devfreq
> does not support this usecase, resulting in DVFS not working.
>
> Since a lot of MediaTek SoCs need to set the voltages for the GPU SRAM
> regulator in a specific relation to the GPU VCORE regulator, a MediaTek
> SoC specific driver was introduced to automatically satisfy, through
> coupling, these constraints: this means that there is at all no need to
> manage both regulators in panfrost but to otherwise just manage the main
> "mali" (-> gpu vcore) regulator instead.
>
> Keeping in mind that we cannot break the ABI, the most sensible route
> (avoiding hacks and uselessly overcomplicated code) to get a MT8183
> node with one power supply was to add a new "mediatek,mt8183b-mali"
> compatible, which effectively deprecates the former.
>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> Reviewed-by: Steven Price <[email protected]>

Reviewed-by: Chen-Yu Tsai <[email protected]>

2023-02-22 07:56:01

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v2 00/10] Panfrost: Improve and add MediaTek SoCs support

On Tue, Feb 21, 2023 at 04:37:30PM +0100, AngeloGioacchino Del Regno wrote:
> Changes in v2:
> - Add power-domain-names commit from Chen-Yu to the series
> - Kept sram-supply in base schema, overridden for non-MediaTek
> - Added Reviewed-by tags from Steven Price to the driver commits
> (as released in reply to v1's cover letter - thanks!)
>
> This series adds support for new MediaTek SoCs (MT8186/MT8192/MT8195)
> and improves MT8183 support: since the mtk-regulator-coupler driver
> was picked, it is now useless for Panfrost to look for, and manage,
> two regulators (GPU Vcore and GPU SRAM) on MediaTek;
>
> The aforementioned driver will take care of keeping the voltage
> relation (/constraints) of the two regulators on its own when a
> voltage change request is sent to the Vcore, solving the old time
> issue with not working DVFS on Panfrost+MediaTek (due to devfreq
> supporting only single regulator).
>
> In the specific case of MT8183, in order to not break the ABI, it
> was necessary to add a new compatible for enabling DVFS.
>
> Alyssa Rosenzweig (3):
> drm/panfrost: Increase MAX_PM_DOMAINS to 5
> drm/panfrost: Add the MT8192 GPU ID
> drm/panfrost: Add mediatek,mt8192-mali compatible
>
> AngeloGioacchino Del Regno (6):
> dt-bindings: gpu: mali-bifrost: Split out MediaTek power-domains
> variation
> dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192
> dt-bindings: gpu: mali-bifrost: Add compatible for MT8195 SoC
> dt-bindings: gpu: mali-bifrost: Add new MT8183 compatible
> dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186
> drm/panfrost: Add new compatible for Mali on the MT8183 SoC
>
> Chen-Yu Tsai (1):
> dt-bindings: gpu: mali-bifrost: Add power-domain-names to base schema
>
> .../bindings/gpu/arm,mali-bifrost.yaml | 67 ++++++++++++++++++-
> drivers/gpu/drm/panfrost/panfrost_device.h | 2 +-
> drivers/gpu/drm/panfrost/panfrost_drv.c | 28 ++++++++
> drivers/gpu/drm/panfrost/panfrost_gpu.c | 8 +++
> 4 files changed, 101 insertions(+), 4 deletions(-)

Tested-by: Chen-Yu Tsai <[email protected]>

on MT8183, MT8186, MT8192, MT8195 with glmark2.

2023-02-22 07:58:49

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v2 02/10] dt-bindings: gpu: mali-bifrost: Split out MediaTek power-domains variation

On Tue, Feb 21, 2023 at 11:37 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> In preparation for adding new bindings for new MediaTek SoCs, split out
> the power-domain-names and power-domainsvariation from the `else` in

^ missing space

Otherwise,

Reviewed-by: Chen-Yu Tsai <[email protected]>

> the current mediatek,mt8183-mali conditional.
>
> The sram-supply part is left in place to be disallowed for anything
> that is not compatible with "mediatek,mt8183-mali" as this regulator
> is MediaTek-specific and it is, and will ever be, used only for this
> specific string due to the addition of the mediatek-regulator-coupler
> driver.
>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> ---
> .../devicetree/bindings/gpu/arm,mali-bifrost.yaml | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> index 02699d389be1..ac174c17e25f 100644
> --- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> +++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> @@ -145,6 +145,18 @@ allOf:
> - power-domains
> - resets
> - reset-names
> + - if:
> + not:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - mediatek,mt8183-mali
> + then:
> + properties:
> + power-domains:
> + maxItems: 1
> + power-domain-names: false
> - if:
> properties:
> compatible:
> @@ -166,9 +178,6 @@ allOf:
> - power-domain-names
> else:
> properties:
> - power-domains:
> - maxItems: 1
> - power-domain-names: false
> sram-supply: false
> - if:
> properties:
> --
> 2.39.2
>

2023-02-22 08:00:40

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v2 03/10] dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192

On Tue, Feb 21, 2023 at 11:37 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> MediaTek MT8192 (and similar) needs five power domains for the
> Mali GPU and no sram-supply: change the binding to allow so.
>
> Fixes: 5d82e74a97c2 ("dt-bindings: Add compatible for Mali Valhall (JM)")
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> Reviewed-by: Rob Herring <[email protected]>

Reviewed-by: Chen-Yu Tsai <[email protected]>

2023-02-22 08:01:58

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v2 04/10] dt-bindings: gpu: mali-bifrost: Add compatible for MT8195 SoC

On Tue, Feb 21, 2023 at 11:37 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> The MediaTek MT8195 SoC has a Mali G57 MC5 (Valhall-JM) and has the
> same number of power domains and requirements as MT8192 in terms of
> bindings.
>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> Reviewed-by: Rob Herring <[email protected]>

Reviewed-by: Chen-Yu Tsai <[email protected]>

For future reference, the Mali G57 in the MT8195 has a minor revision of 1,
while in the MT8192 the minor revision number is 0.

2023-02-22 08:02:09

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v2 05/10] dt-bindings: gpu: mali-bifrost: Add new MT8183 compatible

On Tue, Feb 21, 2023 at 11:37 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> Since new platform data was required in Panfrost for getting GPU DVFS
> finally working on MediaTek SoCs, add a new "mediatek,mt8183b-mali"
> compatible.
>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> Reviewed-by: Rob Herring <[email protected]>

Reviewed-by: Chen-Yu Tsai <[email protected]>

2023-02-22 08:38:02

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v2 06/10] dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186

On Tue, Feb 21, 2023 at 11:37 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> Get GPU support on MT8186 by adding its compatible.
>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> ---
> Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> index be18b161959b..43a841d4e94d 100644
> --- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> +++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> @@ -15,6 +15,11 @@ properties:
>
> compatible:
> oneOf:
> + - items:
> + - enum:
> + - mediatek,mt8186-mali
> + - const: mediatek,mt8183b-mali
> + - const: arm,mali-bifrost # Mali Bifrost GPU model/revision is fully discoverable

The MT8186 has Mali-G52 MC2 2EE, while the MT8183 has Mali-G72 MP3.
So we actually need a new entry with two power domains.

Our downstream Mali driver & DT use just that.

ChenYu

2023-02-22 08:39:38

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v2 00/10] Panfrost: Improve and add MediaTek SoCs support

On Wed, Feb 22, 2023 at 3:55 PM Chen-Yu Tsai <[email protected]> wrote:
>
> On Tue, Feb 21, 2023 at 04:37:30PM +0100, AngeloGioacchino Del Regno wrote:
> > Changes in v2:
> > - Add power-domain-names commit from Chen-Yu to the series
> > - Kept sram-supply in base schema, overridden for non-MediaTek
> > - Added Reviewed-by tags from Steven Price to the driver commits
> > (as released in reply to v1's cover letter - thanks!)
> >
> > This series adds support for new MediaTek SoCs (MT8186/MT8192/MT8195)
> > and improves MT8183 support: since the mtk-regulator-coupler driver
> > was picked, it is now useless for Panfrost to look for, and manage,
> > two regulators (GPU Vcore and GPU SRAM) on MediaTek;
> >
> > The aforementioned driver will take care of keeping the voltage
> > relation (/constraints) of the two regulators on its own when a
> > voltage change request is sent to the Vcore, solving the old time
> > issue with not working DVFS on Panfrost+MediaTek (due to devfreq
> > supporting only single regulator).
> >
> > In the specific case of MT8183, in order to not break the ABI, it
> > was necessary to add a new compatible for enabling DVFS.
> >
> > Alyssa Rosenzweig (3):
> > drm/panfrost: Increase MAX_PM_DOMAINS to 5
> > drm/panfrost: Add the MT8192 GPU ID
> > drm/panfrost: Add mediatek,mt8192-mali compatible
> >
> > AngeloGioacchino Del Regno (6):
> > dt-bindings: gpu: mali-bifrost: Split out MediaTek power-domains
> > variation
> > dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192
> > dt-bindings: gpu: mali-bifrost: Add compatible for MT8195 SoC
> > dt-bindings: gpu: mali-bifrost: Add new MT8183 compatible
> > dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186
> > drm/panfrost: Add new compatible for Mali on the MT8183 SoC
> >
> > Chen-Yu Tsai (1):
> > dt-bindings: gpu: mali-bifrost: Add power-domain-names to base schema
> >
> > .../bindings/gpu/arm,mali-bifrost.yaml | 67 ++++++++++++++++++-
> > drivers/gpu/drm/panfrost/panfrost_device.h | 2 +-
> > drivers/gpu/drm/panfrost/panfrost_drv.c | 28 ++++++++
> > drivers/gpu/drm/panfrost/panfrost_gpu.c | 8 +++
> > 4 files changed, 101 insertions(+), 4 deletions(-)
>
> Tested-by: Chen-Yu Tsai <[email protected]>
>
> on MT8183, MT8186, MT8192, MT8195 with glmark2.

Note: the MT8186 was tested with incorrect bindings with one extra power
domain, but that doesn't affect functionality.

Subject: Re: [PATCH v2 06/10] dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186

Il 22/02/23 09:37, Chen-Yu Tsai ha scritto:
> On Tue, Feb 21, 2023 at 11:37 PM AngeloGioacchino Del Regno
> <[email protected]> wrote:
>>
>> Get GPU support on MT8186 by adding its compatible.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
>> ---
>> Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
>> index be18b161959b..43a841d4e94d 100644
>> --- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
>> +++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
>> @@ -15,6 +15,11 @@ properties:
>>
>> compatible:
>> oneOf:
>> + - items:
>> + - enum:
>> + - mediatek,mt8186-mali
>> + - const: mediatek,mt8183b-mali
>> + - const: arm,mali-bifrost # Mali Bifrost GPU model/revision is fully discoverable
>
> The MT8186 has Mali-G52 MC2 2EE, while the MT8183 has Mali-G72 MP3.

Keeping in mind the obvious - which is that G52 and G72 are both Bifrost....

> So we actually need a new entry with two power domains.
>

...This is my node for MT8186:

gpu: gpu@13040000 {
compatible = "mediatek,mt8186-mali",
"mediatek,mt8183b-mali",
"arm,mali-bifrost";
reg = <0 0x13040000 0 0x4000>;

clocks = <&mfgsys CLK_MFG_BG3D>;
interrupts = <GIC_SPI 276 IRQ_TYPE_LEVEL_HIGH 0>,
<GIC_SPI 275 IRQ_TYPE_LEVEL_HIGH 0>,
<GIC_SPI 274 IRQ_TYPE_LEVEL_HIGH 0>;
interrupt-names = "job", "mmu", "gpu";
power-domains = <&spm MT8186_POWER_DOMAIN_MFG1>,
<&spm MT8186_POWER_DOMAIN_MFG2>,
<&spm MT8186_POWER_DOMAIN_MFG3>;
power-domain-names = "core0", "core1", "core2";

/* Please ignore speedbin, that's for another time :-) */
nvmem-cells = <&gpu_volt_bin>;
nvmem-cell-names = "speed-bin";
#cooling-cells = <2>;
};

There are three MFG power domains... MFG2 and MFG3 are parents of MFG1, on that
I agree, but we can avoid adding a new entry just for MT8186 and use the MT8183-b
one while still being technically correct.

Besides, Mali G52 and Mali G72 are both Bifrost... so I don't think that this
commit is incorrect. For the sake of simplicity, I would push on getting this
one picked.

Unless there are any real-strong opinions against...

Regards,
Angelo

> Our downstream Mali driver & DT use just that.
>
> ChenYu



2023-02-23 02:44:34

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v2 06/10] dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186

On Wed, Feb 22, 2023 at 5:13 PM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> Il 22/02/23 09:37, Chen-Yu Tsai ha scritto:
> > On Tue, Feb 21, 2023 at 11:37 PM AngeloGioacchino Del Regno
> > <[email protected]> wrote:
> >>
> >> Get GPU support on MT8186 by adding its compatible.
> >>
> >> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> >> ---
> >> Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 +++++
> >> 1 file changed, 5 insertions(+)
> >>
> >> diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> >> index be18b161959b..43a841d4e94d 100644
> >> --- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> >> +++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> >> @@ -15,6 +15,11 @@ properties:
> >>
> >> compatible:
> >> oneOf:
> >> + - items:
> >> + - enum:
> >> + - mediatek,mt8186-mali
> >> + - const: mediatek,mt8183b-mali
> >> + - const: arm,mali-bifrost # Mali Bifrost GPU model/revision is fully discoverable
> >
> > The MT8186 has Mali-G52 MC2 2EE, while the MT8183 has Mali-G72 MP3.
>
> Keeping in mind the obvious - which is that G52 and G72 are both Bifrost....
>
> > So we actually need a new entry with two power domains.
> >
>
> ...This is my node for MT8186:
>
> gpu: gpu@13040000 {
> compatible = "mediatek,mt8186-mali",
> "mediatek,mt8183b-mali",
> "arm,mali-bifrost";
> reg = <0 0x13040000 0 0x4000>;
>
> clocks = <&mfgsys CLK_MFG_BG3D>;
> interrupts = <GIC_SPI 276 IRQ_TYPE_LEVEL_HIGH 0>,
> <GIC_SPI 275 IRQ_TYPE_LEVEL_HIGH 0>,
> <GIC_SPI 274 IRQ_TYPE_LEVEL_HIGH 0>;
> interrupt-names = "job", "mmu", "gpu";
> power-domains = <&spm MT8186_POWER_DOMAIN_MFG1>,
> <&spm MT8186_POWER_DOMAIN_MFG2>,
> <&spm MT8186_POWER_DOMAIN_MFG3>;
> power-domain-names = "core0", "core1", "core2";
>
> /* Please ignore speedbin, that's for another time :-) */
> nvmem-cells = <&gpu_volt_bin>;
> nvmem-cell-names = "speed-bin";
> #cooling-cells = <2>;
> };
>
> There are three MFG power domains... MFG2 and MFG3 are parents of MFG1, on that
> I agree, but we can avoid adding a new entry just for MT8186 and use the MT8183-b
> one while still being technically correct.
>
> Besides, Mali G52 and Mali G72 are both Bifrost... so I don't think that this
> commit is incorrect. For the sake of simplicity, I would push on getting this
> one picked.

I'm aware. In case it wasn't obvious, Mali-G52 MC2 2EE has 2 cores, while
Mali-G72 MP3 has 3 cores. I think that is reason enough to do a new entry.
Otherwise you are describing power domains for 3 cores for a GPU that only
has two.

> Unless there are any real-strong opinions against...

Yes.

ChenYu

Subject: Re: [PATCH v2 06/10] dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186

Il 23/02/23 03:43, Chen-Yu Tsai ha scritto:
> On Wed, Feb 22, 2023 at 5:13 PM AngeloGioacchino Del Regno
> <[email protected]> wrote:
>>
>> Il 22/02/23 09:37, Chen-Yu Tsai ha scritto:
>>> On Tue, Feb 21, 2023 at 11:37 PM AngeloGioacchino Del Regno
>>> <[email protected]> wrote:
>>>>
>>>> Get GPU support on MT8186 by adding its compatible.
>>>>
>>>> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
>>>> ---
>>>> Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 +++++
>>>> 1 file changed, 5 insertions(+)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
>>>> index be18b161959b..43a841d4e94d 100644
>>>> --- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
>>>> +++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
>>>> @@ -15,6 +15,11 @@ properties:
>>>>
>>>> compatible:
>>>> oneOf:
>>>> + - items:
>>>> + - enum:
>>>> + - mediatek,mt8186-mali
>>>> + - const: mediatek,mt8183b-mali
>>>> + - const: arm,mali-bifrost # Mali Bifrost GPU model/revision is fully discoverable
>>>
>>> The MT8186 has Mali-G52 MC2 2EE, while the MT8183 has Mali-G72 MP3.
>>
>> Keeping in mind the obvious - which is that G52 and G72 are both Bifrost....
>>
>>> So we actually need a new entry with two power domains.
>>>
>>
>> ...This is my node for MT8186:
>>
>> gpu: gpu@13040000 {
>> compatible = "mediatek,mt8186-mali",
>> "mediatek,mt8183b-mali",
>> "arm,mali-bifrost";
>> reg = <0 0x13040000 0 0x4000>;
>>
>> clocks = <&mfgsys CLK_MFG_BG3D>;
>> interrupts = <GIC_SPI 276 IRQ_TYPE_LEVEL_HIGH 0>,
>> <GIC_SPI 275 IRQ_TYPE_LEVEL_HIGH 0>,
>> <GIC_SPI 274 IRQ_TYPE_LEVEL_HIGH 0>;
>> interrupt-names = "job", "mmu", "gpu";
>> power-domains = <&spm MT8186_POWER_DOMAIN_MFG1>,
>> <&spm MT8186_POWER_DOMAIN_MFG2>,
>> <&spm MT8186_POWER_DOMAIN_MFG3>;
>> power-domain-names = "core0", "core1", "core2";
>>
>> /* Please ignore speedbin, that's for another time :-) */
>> nvmem-cells = <&gpu_volt_bin>;
>> nvmem-cell-names = "speed-bin";
>> #cooling-cells = <2>;
>> };
>>
>> There are three MFG power domains... MFG2 and MFG3 are parents of MFG1, on that
>> I agree, but we can avoid adding a new entry just for MT8186 and use the MT8183-b
>> one while still being technically correct.
>>
>> Besides, Mali G52 and Mali G72 are both Bifrost... so I don't think that this
>> commit is incorrect. For the sake of simplicity, I would push on getting this
>> one picked.
>
> I'm aware. In case it wasn't obvious, Mali-G52 MC2 2EE has 2 cores, while
> Mali-G72 MP3 has 3 cores. I think that is reason enough to do a new entry.
> Otherwise you are describing power domains for 3 cores for a GPU that only
> has two.
>
>> Unless there are any real-strong opinions against...
>
> Yes.
>

Ok, I will do that for v3!

Cheers,
Angelo

> ChenYu