Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/5] powervr: MT8173 GPU support
@ 2026-07-27  9:15 Chen-Yu Tsai
  2026-07-27  9:15 ` [PATCH v3 1/5] dt-bindings: clock: mediatek: Add mt8173 mfgtop Chen-Yu Tsai
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Chen-Yu Tsai @ 2026-07-27  9:15 UTC (permalink / raw)
  To: Stephen Boyd, Brian Masney, Matthias Brugger,
	AngeloGioacchino Del Regno, Alessio Belle, Luigi Santivetti,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: Dan Carpenter, Chen-Yu Tsai, David Airlie, Simona Vetter,
	linux-clk, devicetree, linux-mediatek, linux-arm-kernel,
	imagination, dri-devel, linux-kernel, Icenowy Zheng,
	YoungJoon Lee

Hi everyone,

This is v3 of my MT8173 PowerVR GPU support series.

I got another inquiry on the status of this patch series, so I thought
I'd dig it out, fix all the issues and send another version.

This time around Mesa was ready for basic testing, using both vulkanmark
and glmark2-es2-drm (with Zink). Details below.

Changes since v2 (all in the clk driver patch):
- Made COMMON_CLK_MT8173_MFGTOP depend on PM
  - Needed since the driver implements PM domains using the generic PM
    domain library, which also depends on PM
  - Fixes build breakage (kernel test robot)
- Fixed "RST_DELAY_CNT" name (Brian)
- Dropped unused mfg_desc (Brian)
- Added check of clk_prepare_enable()'s return value in
  clk_mt8173_mfgtop_power_on() (Brian)
- Saved error value for return in IS_ERR(data->clk_26m) branch
  (Dan Carpenter / kernel test robot w/ smatch)

Changes since v1:
- Adapted to changed DT bindings
- Dropped driver change
- Use same power domain for "a" and "b" GPU power domains


This series enables the PowerVR GPU found in the MT8173 SoC, found in
some Chromebooks.

This version is different from the initial powervr driver submission [1]
in that it splits out the GPU glue layer support out of the powervr
driver and into a separate clock and power domain driver. The glue code
is otherwise the same, and also the same as found in the ChromeOS
kernels, with some extra comments and macro names added where possible.

Patch 1 adds a binding for the glue layer, called mfgtop. The glue layer
contains clock and power controls for the GPU.

Patch 2 adds a driver for the glue layer, implemented as a clock driver
that also provides power domains.

Patch 3 adds an entry for the MT8173 GPU and 6XT series to the PowerVR
binding.

Patch 4 corrects the clock for the GPU (called MFG) power domain.

Patch 5 adds device nodes for the GPU and glue layer to the MT8173 dtsi
file.

The kernel driver successfully probes the hardware and loads the
"rogue_4.40.2.51_v1.fw" firmware provided by Imagination Technologies [2].
The "exp_hw_support" module parameter needs to be set for the driver to
probe successfully.

This was tested with Mesa 26.1.5 from Debian Forky. With this version
vkmark and glmark2-es2 (over Zink) both run fine. Mesa spits out a bunch
of warnings since the GX6250 core is not officially supported.

    # PVR_I_WANT_A_BROKEN_VULKAN_DRIVER=1 vkmark
    WARNING: powervr is not a conformant Vulkan implementation, testing use only.
    WARNING: powervr is not a conformant Vulkan implementation, testing use only.
    MESA: warning: ../src/imagination/vulkan/pvr_arch_job_context.c:73: FINISHME: Missing reset support for brn51764
    MESA: warning: ../src/imagination/vulkan/pvr_arch_job_context.c:76: FINISHME: Missing reset support for brn58839
    MESA: warning: ../src/imagination/vulkan/pvr_arch_job_context.c:523: FINISHME: Missing support for brn62269
    MESA: warning: ../src/imagination/vulkan/pvr_arch_border.c:244: FINISHME: Devices without tpu_border_colour_enhanced require entries for compressed formats to be stored in the table pre-compressed.
    WARNING: powervr is not a conformant Vulkan implementation, testing use only.
    =======================================================
	vkmark 2025.01
    =======================================================
	Vendor ID:      0x1010
	Device ID:      0x6250
	Device Name:    PowerVR Rogue GX6250
	Driver Version: 109056005
	Device UUID:    d04cd6f3a25fd4900f89c151bccfdfcf
    =======================================================
    [vertex] device-local=true: FPS: 251 FrameTime: 3.984 ms
    [vertex] device-local=false: FPS: 220 FrameTime: 4.545 ms
    [texture] anisotropy=0:^C FPS: 223 FrameTime: 4.484 ms
    =======================================================
				       vkmark Score: 231
    =======================================================

    # PVR_I_WANT_A_BROKEN_VULKAN_DRIVER=1 glmark2-es2-drm
    WARNING: powervr is not a conformant Vulkan implementation, testing use only.
    MESA: warning: ../src/imagination/vulkan/pvr_arch_job_context.c:73: FINISHME: Missing reset support for brn51764
    MESA: warning: ../src/imagination/vulkan/pvr_arch_job_context.c:76: FINISHME: Missing reset support for brn58839
    MESA: warning: ../src/imagination/vulkan/pvr_arch_job_context.c:523: FINISHME: Missing support for brn62269
    MESA: warning: ../src/imagination/vulkan/pvr_arch_border.c:244: FINISHME: Devices without tpu_border_colour_enhanced require entries for compressed formats to be stored in the table pre-compressed.
    Warning: DRM_CAP_ASYNC_PAGE_FLIP not supported, falling back to 'mailbox' mode for SwapInterval(0).
    =======================================================
	glmark2 2023.01
    =======================================================
	OpenGL Information
	GL_VENDOR:      Mesa
	GL_RENDERER:    zink Vulkan 1.2(PowerVR Rogue GX6250 (IMAGINATION_OPEN_SOURCE_MESA))
	GL_VERSION:     OpenGL ES 2.0 Mesa 26.1.5-1
	Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
	Surface Size:   1366x768 fullscreen
    =======================================================
    [build] use-vbo=false: FPS: 49 FrameTime: 20.473 ms
    [build] use-vbo=true: FPS: 45 FrameTime: 22.660 ms
    [texture] texture-filter=nearest: FPS: 45 FrameTime: 22.642 ms
    [texture] texture-filter=linear:^C FPS: 50 FrameTime: 20.172 ms
    =======================================================
				      glmark2 Score: 46
    =======================================================


Please have a look.

Thanks
ChenYu

[1] https://lore.kernel.org/dri-devel/20220815165156.118212-2-sarah.walker@imgtec.com/
[2] https://gitlab.freedesktop.org/imagination/linux-firmware/-/tree/powervr

Chen-Yu Tsai (5):
  dt-bindings: clock: mediatek: Add mt8173 mfgtop
  clk: mediatek: Add mt8173-mfgtop driver
  dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU
  arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock
  arm64: dts: mediatek: mt8173: Add GPU device nodes

 .../clock/mediatek,mt8173-mfgtop.yaml         |  70 +++++
 .../bindings/gpu/img,powervr-rogue.yaml       |   1 +
 arch/arm64/boot/dts/mediatek/mt8173.dtsi      |  33 ++-
 drivers/clk/mediatek/Kconfig                  |  10 +
 drivers/clk/mediatek/Makefile                 |   1 +
 drivers/clk/mediatek/clk-mt8173-mfgtop.c      | 241 ++++++++++++++++++
 include/dt-bindings/clock/mt8173-clk.h        |   7 +
 7 files changed, 362 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml
 create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c

-- 
2.55.0.229.g6434b31f56-goog



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

* [PATCH v3 1/5] dt-bindings: clock: mediatek: Add mt8173 mfgtop
  2026-07-27  9:15 [PATCH v3 0/5] powervr: MT8173 GPU support Chen-Yu Tsai
@ 2026-07-27  9:15 ` Chen-Yu Tsai
  2026-07-27 11:26   ` AngeloGioacchino Del Regno
  2026-07-27  9:15 ` [PATCH v3 2/5] clk: mediatek: Add mt8173-mfgtop driver Chen-Yu Tsai
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Chen-Yu Tsai @ 2026-07-27  9:15 UTC (permalink / raw)
  To: Stephen Boyd, Brian Masney, Matthias Brugger,
	AngeloGioacchino Del Regno, Alessio Belle, Luigi Santivetti,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: Dan Carpenter, Chen-Yu Tsai, David Airlie, Simona Vetter,
	linux-clk, devicetree, linux-mediatek, linux-arm-kernel,
	imagination, dri-devel, linux-kernel, Icenowy Zheng,
	YoungJoon Lee, Conor Dooley

The MFG (GPU) block on the MT8173 has a small glue layer, named MFG_TOP
in the datasheet, that contains clock gates, some power sequence signal
delays, and other unknown registers that get toggled when the GPU is
powered on.

The clock gates are exposed as clocks provided by a clock controller,
while the power sequencing bits are exposed as one singular power domain.

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 .../clock/mediatek,mt8173-mfgtop.yaml         | 70 +++++++++++++++++++
 include/dt-bindings/clock/mt8173-clk.h        |  7 ++
 2 files changed, 77 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml

diff --git a/Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml b/Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml
new file mode 100644
index 000000000000..03db1ee9e594
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+
+$id: http://devicetree.org/schemas/clock/mediatek,mt8173-mfgtop.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek MT8173 MFG TOP controller
+
+maintainers:
+  - AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+
+description:
+  The MFG TOP glue layer controls various signals going to the MFG (GPU)
+  block on the MT8173.
+
+properties:
+  compatible:
+    const: mediatek,mt8173-mfgtop
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 4
+
+  clock-names:
+    items:
+      - const: sys
+      - const: mem
+      - const: core
+      - const: clk26m
+
+  power-domains:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 1
+
+  '#power-domain-cells':
+    const: 0
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - power-domains
+  - '#clock-cells'
+  - '#power-domain-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+        #include <dt-bindings/clock/mt8173-clk.h>
+        #include <dt-bindings/power/mt8173-power.h>
+
+        clock-controller@13fff000 {
+            compatible = "mediatek,mt8173-mfgtop";
+            reg = <0x13fff000 0x1000>;
+            clocks = <&topckgen CLK_TOP_AXI_MFG_IN_SEL>,
+                     <&topckgen CLK_TOP_MEM_MFG_IN_SEL>,
+                     <&topckgen CLK_TOP_MFG_SEL>,
+                     <&clk26m>;
+            clock-names = "sys", "mem", "core", "clk26m";
+            power-domains = <&spm MT8173_POWER_DOMAIN_MFG>;
+            #clock-cells = <1>;
+            #power-domain-cells = <0>;
+        };
diff --git a/include/dt-bindings/clock/mt8173-clk.h b/include/dt-bindings/clock/mt8173-clk.h
index 3d00c98b9654..89e982f771db 100644
--- a/include/dt-bindings/clock/mt8173-clk.h
+++ b/include/dt-bindings/clock/mt8173-clk.h
@@ -243,6 +243,13 @@
 #define CLK_IMG_FD			7
 #define CLK_IMG_NR_CLK			8
 
+/* MFG_SYS */
+
+#define CLK_MFG_AXI			0
+#define CLK_MFG_MEM			1
+#define CLK_MFG_G3D			2
+#define CLK_MFG_26M			3
+
 /* MM_SYS */
 
 #define CLK_MM_SMI_COMMON		1
-- 
2.55.0.229.g6434b31f56-goog



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

* [PATCH v3 2/5] clk: mediatek: Add mt8173-mfgtop driver
  2026-07-27  9:15 [PATCH v3 0/5] powervr: MT8173 GPU support Chen-Yu Tsai
  2026-07-27  9:15 ` [PATCH v3 1/5] dt-bindings: clock: mediatek: Add mt8173 mfgtop Chen-Yu Tsai
@ 2026-07-27  9:15 ` Chen-Yu Tsai
  2026-07-27 11:26   ` AngeloGioacchino Del Regno
  2026-07-27 16:16   ` Brian Masney
  2026-07-27  9:15 ` [PATCH v3 3/5] dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU Chen-Yu Tsai
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 10+ messages in thread
From: Chen-Yu Tsai @ 2026-07-27  9:15 UTC (permalink / raw)
  To: Stephen Boyd, Brian Masney, Matthias Brugger,
	AngeloGioacchino Del Regno, Alessio Belle, Luigi Santivetti,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: Dan Carpenter, Chen-Yu Tsai, David Airlie, Simona Vetter,
	linux-clk, devicetree, linux-mediatek, linux-arm-kernel,
	imagination, dri-devel, linux-kernel, Icenowy Zheng,
	YoungJoon Lee

The MFG (GPU) block on the MT8173 has a small glue layer, named MFG_TOP
in the datasheet, that contains clock gates, some power sequence signal
delays, and other unknown registers that get toggled when the GPU is
powered on.

The clock gates are exposed as clocks provided by a clock controller,
while the power sequencing bits are exposed as one singular power domain.

Tested-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
Changes since v2:
- Made COMMON_CLK_MT8173_MFGTOP depend on PM
  - Needed since the driver implements PM domains using the generic PM
    domain library, which also depends on PM
  - Fixes build breakage (kernel test robot)
- Fixed "RST_DELAY_CNT" name (Brian)
- Dropped unused mfg_desc (Brian)
- Added check of clk_prepare_enable()'s return value in
  clk_mt8173_mfgtop_power_on() (Brian)
- Saved error value for return in IS_ERR(data->clk_26m) branch
  (Dan Carpenter / kernel test robot w/ smatch)
---
 drivers/clk/mediatek/Kconfig             |  10 +
 drivers/clk/mediatek/Makefile            |   1 +
 drivers/clk/mediatek/clk-mt8173-mfgtop.c | 241 +++++++++++++++++++++++
 3 files changed, 252 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c

diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
index 2c09fd729bab..8eea3766a910 100644
--- a/drivers/clk/mediatek/Kconfig
+++ b/drivers/clk/mediatek/Kconfig
@@ -537,6 +537,16 @@ config COMMON_CLK_MT8173_IMGSYS
 	help
 	  This driver supports MediaTek MT8173 imgsys clocks.
 
+config COMMON_CLK_MT8173_MFGTOP
+	tristate "Clock and power driver for MediaTek MT8173 mfgtop"
+	depends on COMMON_CLK_MT8173
+	depends on PM
+	default COMMON_CLK_MT8173
+	select PM_GENERIC_DOMAINS
+	select PM_GENERIC_DOMAINS_OF
+	help
+	  This driver supports MediaTek MT8173 mfgtop clocks and power domain.
+
 config COMMON_CLK_MT8173_MMSYS
        tristate "Clock driver for MediaTek MT8173 mmsys"
        depends on COMMON_CLK_MT8173
diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
index d8736a060dbd..892a54eeb281 100644
--- a/drivers/clk/mediatek/Makefile
+++ b/drivers/clk/mediatek/Makefile
@@ -82,6 +82,7 @@ obj-$(CONFIG_COMMON_CLK_MT8167_VDECSYS) += clk-mt8167-vdec.o
 obj-$(CONFIG_COMMON_CLK_MT8173) += clk-mt8173-apmixedsys.o clk-mt8173-infracfg.o \
 				   clk-mt8173-pericfg.o clk-mt8173-topckgen.o
 obj-$(CONFIG_COMMON_CLK_MT8173_IMGSYS) += clk-mt8173-img.o
+obj-$(CONFIG_COMMON_CLK_MT8173_MFGTOP) += clk-mt8173-mfgtop.o
 obj-$(CONFIG_COMMON_CLK_MT8173_MMSYS) += clk-mt8173-mm.o
 obj-$(CONFIG_COMMON_CLK_MT8173_VDECSYS) += clk-mt8173-vdecsys.o
 obj-$(CONFIG_COMMON_CLK_MT8173_VENCSYS) += clk-mt8173-vencsys.o
diff --git a/drivers/clk/mediatek/clk-mt8173-mfgtop.c b/drivers/clk/mediatek/clk-mt8173-mfgtop.c
new file mode 100644
index 000000000000..a724d0cd5017
--- /dev/null
+++ b/drivers/clk/mediatek/clk-mt8173-mfgtop.c
@@ -0,0 +1,241 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2024 Google LLC
+ * Author: Chen-Yu Tsai <wenst@chromium.org>
+ *
+ * Based on driver in downstream ChromeOS v5.15 kernel.
+ *
+ * Copyright (c) 2014 MediaTek Inc.
+ * Author: Chiawen Lee <chiawen.lee@mediatek.com>
+ */
+
+#include <dt-bindings/clock/mt8173-clk.h>
+
+#include <linux/bitfield.h>
+#include <linux/clk.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/pm_domain.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+
+#include "clk-gate.h"
+#include "clk-mtk.h"
+
+static const struct mtk_gate_regs mfg_cg_regs = {
+	.sta_ofs = 0x0000,
+	.clr_ofs = 0x0008,
+	.set_ofs = 0x0004,
+};
+
+#define GATE_MFG(_id, _name, _parent, _shift, _flags)	\
+	GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, _shift, &mtk_clk_gate_ops_setclr, _flags)
+
+/* TODO: The block actually has dividers for the core and mem clocks. */
+static const struct mtk_gate mfg_clks[] = {
+	GATE_MFG(CLK_MFG_AXI, "mfg_axi", "axi_mfg_in_sel", 0, CLK_SET_RATE_PARENT),
+	GATE_MFG(CLK_MFG_MEM, "mfg_mem", "mem_mfg_in_sel", 1, CLK_SET_RATE_PARENT),
+	GATE_MFG(CLK_MFG_G3D, "mfg_g3d", "mfg_sel", 2, CLK_SET_RATE_PARENT),
+	GATE_MFG(CLK_MFG_26M, "mfg_26m", "clk26m", 3, 0),
+};
+
+struct mt8173_mfgtop_data {
+	struct clk_hw_onecell_data *clk_data;
+	struct regmap *regmap;
+	struct generic_pm_domain genpd;
+	struct of_phandle_args parent_pd, child_pd;
+	struct clk *clk_26m;
+};
+
+/* Delay count in clock cycles */
+#define MFG_ACTIVE_POWER_CON0	0x24
+ #define RST_B_DELAY_CNT	GENMASK(7, 0)	/* pwr_rst_b de-assert delay during power-up */
+ #define CLK_EN_DELAY_CNT	GENMASK(15, 8)	/* CLK_DIS deassert delay during power-up */
+ #define CLK_DIS_DELAY_CNT	GENMASK(23, 16)	/* CLK_DIS assert delay during power-down */
+ #define FORCE_ABORT		BIT(30)		/* write 1 to force abort a power event */
+ #define ACTIVE_PWRCTL_EN	BIT(31)		/* enable ACTIVE_POWER */
+
+#define MFG_ACTIVE_POWER_CON1	0x28
+ #define PWR_ON_S_DELAY_CNT	GENMASK(7, 0)	/* pwr_on_s assert delay during power-up */
+ #define ISO_DELAY_CNT		GENMASK(15, 8)	/* ISO assert delay during power-down */
+ #define ISOOFF_DELAY_CNT	GENMASK(23, 16)	/* ISO de-assert delay during power-up */
+ #define RST_DELAY_CNT		GENMASK(31, 24) /* pwr_rsb_b assert delay during power-down */
+
+static int clk_mt8173_mfgtop_power_on(struct generic_pm_domain *domain)
+{
+	struct mt8173_mfgtop_data *data = container_of(domain, struct mt8173_mfgtop_data, genpd);
+	int ret;
+
+	/* drives internal power management */
+	ret = clk_prepare_enable(data->clk_26m);
+	if (ret)
+		return ret;
+
+	/* Power on/off delays for various signals */
+	regmap_write(data->regmap, MFG_ACTIVE_POWER_CON0,
+		     FIELD_PREP(RST_B_DELAY_CNT, 77) |
+		     FIELD_PREP(CLK_EN_DELAY_CNT, 61) |
+		     FIELD_PREP(CLK_DIS_DELAY_CNT, 60) |
+		     FIELD_PREP(ACTIVE_PWRCTL_EN, 0));
+	regmap_write(data->regmap, MFG_ACTIVE_POWER_CON1,
+		     FIELD_PREP(PWR_ON_S_DELAY_CNT, 11) |
+		     FIELD_PREP(ISO_DELAY_CNT, 68) |
+		     FIELD_PREP(ISOOFF_DELAY_CNT, 69) |
+		     FIELD_PREP(RST_DELAY_CNT, 77));
+
+	/* Magic numbers related to core switch sequence and delays */
+	regmap_write(data->regmap, 0xe0, 0x7a710184);
+	regmap_write(data->regmap, 0xe4, 0x835f6856);
+	regmap_write(data->regmap, 0xe8, 0x002b0234);
+	regmap_write(data->regmap, 0xec, 0x80000000);
+	regmap_write(data->regmap, 0xa0, 0x08000000);
+
+	return 0;
+}
+
+static int clk_mt8173_mfgtop_power_off(struct generic_pm_domain *domain)
+{
+	struct mt8173_mfgtop_data *data = container_of(domain, struct mt8173_mfgtop_data, genpd);
+
+	/* Magic numbers related to core switch sequence and delays */
+	regmap_write(data->regmap, 0xec, 0);
+
+	/* drives internal power management */
+	clk_disable_unprepare(data->clk_26m);
+
+	return 0;
+}
+
+static int clk_mt8173_mfgtop_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *node = dev->of_node;
+	struct mt8173_mfgtop_data *data;
+	int ret;
+
+	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, data);
+
+	data->clk_data = mtk_devm_alloc_clk_data(dev, ARRAY_SIZE(mfg_clks));
+	if (!data->clk_data)
+		return -ENOMEM;
+
+	/* MTK clock gates also uses regmap */
+	data->regmap = device_node_to_regmap(node);
+	if (IS_ERR(data->regmap))
+		return dev_err_probe(dev, PTR_ERR(data->regmap), "Failed to get regmap\n");
+
+	data->child_pd.np = node;
+	data->child_pd.args_count = 0;
+	ret = of_parse_phandle_with_args(node, "power-domains", "#power-domain-cells", 0,
+					 &data->parent_pd);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to parse power domain\n");
+
+	devm_pm_runtime_enable(dev);
+	/*
+	 * Do a pm_runtime_resume_and_get() to workaround a possible
+	 * deadlock between clk_register() and the genpd framework.
+	 */
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret) {
+		dev_err_probe(dev, ret, "Failed to runtime resume device\n");
+		goto put_of_node;
+	}
+
+	ret = mtk_clk_register_gates(dev, node, mfg_clks, ARRAY_SIZE(mfg_clks),
+				     data->clk_data);
+	if (ret) {
+		dev_err_probe(dev, ret, "Failed to register clock gates\n");
+		goto put_pm_runtime;
+	}
+
+	data->clk_26m = clk_hw_get_clk(data->clk_data->hws[CLK_MFG_26M], "26m");
+	if (IS_ERR(data->clk_26m)) {
+		ret = dev_err_probe(dev, PTR_ERR(data->clk_26m), "Failed to get 26 MHz clock\n");
+		goto unregister_clks;
+	}
+
+	ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, data->clk_data);
+	if (ret) {
+		dev_err_probe(dev, ret, "Failed to add clk OF provider\n");
+		goto put_26m_clk;
+	}
+
+	data->genpd.name = "mfg-top";
+	data->genpd.power_on = clk_mt8173_mfgtop_power_on;
+	data->genpd.power_off = clk_mt8173_mfgtop_power_off;
+	ret = pm_genpd_init(&data->genpd, NULL, true);
+	if (ret) {
+		dev_err_probe(dev, ret, "Failed to add power domain\n");
+		goto del_clk_provider;
+	}
+
+	ret = of_genpd_add_provider_simple(node, &data->genpd);
+	if (ret) {
+		dev_err_probe(dev, ret, "Failed to add power domain OF provider\n");
+		goto remove_pd;
+	}
+
+	ret = of_genpd_add_subdomain(&data->parent_pd, &data->child_pd);
+	if (ret) {
+		dev_err_probe(dev, ret, "Failed to link PM domains\n");
+		goto del_pd_provider;
+	}
+
+	pm_runtime_put(dev);
+	return 0;
+
+del_pd_provider:
+	of_genpd_del_provider(node);
+remove_pd:
+	pm_genpd_remove(&data->genpd);
+del_clk_provider:
+	of_clk_del_provider(node);
+put_26m_clk:
+	clk_put(data->clk_26m);
+unregister_clks:
+	mtk_clk_unregister_gates(mfg_clks, ARRAY_SIZE(mfg_clks), data->clk_data);
+put_pm_runtime:
+	pm_runtime_put(dev);
+put_of_node:
+	of_node_put(data->parent_pd.np);
+	return ret;
+}
+
+static void clk_mt8173_mfgtop_remove(struct platform_device *pdev)
+{
+	struct mt8173_mfgtop_data *data = platform_get_drvdata(pdev);
+	struct device_node *node = pdev->dev.of_node;
+
+	of_genpd_remove_subdomain(&data->parent_pd, &data->child_pd);
+	of_genpd_del_provider(node);
+	pm_genpd_remove(&data->genpd);
+	of_clk_del_provider(node);
+	clk_put(data->clk_26m);
+	mtk_clk_unregister_gates(mfg_clks, ARRAY_SIZE(mfg_clks), data->clk_data);
+}
+
+static const struct of_device_id of_match_clk_mt8173_mfgtop[] = {
+	{ .compatible = "mediatek,mt8173-mfgtop" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, of_match_clk_mt8173_mfgtop);
+
+static struct platform_driver clk_mt8173_mfgtop_drv = {
+	.probe = clk_mt8173_mfgtop_probe,
+	.remove = clk_mt8173_mfgtop_remove,
+	.driver = {
+		.name = "clk-mt8173-mfgtop",
+		.of_match_table = of_match_clk_mt8173_mfgtop,
+	},
+};
+module_platform_driver(clk_mt8173_mfgtop_drv);
+
+MODULE_DESCRIPTION("MediaTek MT8173 mfgtop clock driver");
+MODULE_LICENSE("GPL");
-- 
2.55.0.229.g6434b31f56-goog



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

* [PATCH v3 3/5] dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU
  2026-07-27  9:15 [PATCH v3 0/5] powervr: MT8173 GPU support Chen-Yu Tsai
  2026-07-27  9:15 ` [PATCH v3 1/5] dt-bindings: clock: mediatek: Add mt8173 mfgtop Chen-Yu Tsai
  2026-07-27  9:15 ` [PATCH v3 2/5] clk: mediatek: Add mt8173-mfgtop driver Chen-Yu Tsai
@ 2026-07-27  9:15 ` Chen-Yu Tsai
  2026-07-27  9:15 ` [PATCH v3 4/5] arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock Chen-Yu Tsai
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Chen-Yu Tsai @ 2026-07-27  9:15 UTC (permalink / raw)
  To: Stephen Boyd, Brian Masney, Matthias Brugger,
	AngeloGioacchino Del Regno, Alessio Belle, Luigi Santivetti,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: Dan Carpenter, Chen-Yu Tsai, David Airlie, Simona Vetter,
	linux-clk, devicetree, linux-mediatek, linux-arm-kernel,
	imagination, dri-devel, linux-kernel, Icenowy Zheng,
	YoungJoon Lee, Conor Dooley

The MediaTek MT8173 comes with a PowerVR Rogue GX6250, which is one
of the Series6XT GPUs, another sub-family of the Rogue family.

This was part of the very first few versions of the PowerVR submission,
but was later dropped.

[1] https://lore.kernel.org/dri-devel/6eeccb26e09aad67fb30ffcd523c793a43c79c2a.camel@imgtec.com/

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml b/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
index a6bccb600a57..e9218e0f363d 100644
--- a/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
+++ b/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
@@ -16,6 +16,7 @@ properties:
     oneOf:
       - items:
           - enum:
+              - mediatek,mt8173-gpu
               - renesas,r8a7796-gpu
               - renesas,r8a77961-gpu
           - const: img,img-gx6250
-- 
2.55.0.229.g6434b31f56-goog



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

* [PATCH v3 4/5] arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock
  2026-07-27  9:15 [PATCH v3 0/5] powervr: MT8173 GPU support Chen-Yu Tsai
                   ` (2 preceding siblings ...)
  2026-07-27  9:15 ` [PATCH v3 3/5] dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU Chen-Yu Tsai
@ 2026-07-27  9:15 ` Chen-Yu Tsai
  2026-07-27  9:15 ` [PATCH v3 5/5] arm64: dts: mediatek: mt8173: Add GPU device nodes Chen-Yu Tsai
  2026-07-27 15:48 ` [PATCH v3 0/5] powervr: MT8173 GPU support YoungJoon Lee
  5 siblings, 0 replies; 10+ messages in thread
From: Chen-Yu Tsai @ 2026-07-27  9:15 UTC (permalink / raw)
  To: Stephen Boyd, Brian Masney, Matthias Brugger,
	AngeloGioacchino Del Regno, Alessio Belle, Luigi Santivetti,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: Dan Carpenter, Chen-Yu Tsai, David Airlie, Simona Vetter,
	linux-clk, devicetree, linux-mediatek, linux-arm-kernel,
	imagination, dri-devel, linux-kernel, Icenowy Zheng,
	YoungJoon Lee

The MFG_ASYNC domain, which is likely associated to the whole MFG block,
currently specifies clk26m as its domain clock. This is bogus, since the
clock is an external crystal with no controls. Also, the MFG block has
a independent CLK_TOP_AXI_MFG_IN_SEL clock, which according to the block
diagram, gates access to the hardware registers. Having this one as the
domain clock makes much more sense. This also fixes access to the MFGTOP
registers.

Change the MFG_ASYNC domain clock to CLK_TOP_AXI_MFG_IN_SEL.

Fixes: 8b6562644df9 ("arm64: dts: mediatek: Add mt8173 power domain controller")
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index 78c2ccd5be13..556e806b7787 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -505,7 +505,7 @@ power-domain@MT8173_POWER_DOMAIN_USB {
 				};
 				mfg_async: power-domain@MT8173_POWER_DOMAIN_MFG_ASYNC {
 					reg = <MT8173_POWER_DOMAIN_MFG_ASYNC>;
-					clocks = <&clk26m>;
+					clocks = <&topckgen CLK_TOP_AXI_MFG_IN_SEL>;
 					clock-names = "mfg";
 					#address-cells = <1>;
 					#size-cells = <0>;
-- 
2.55.0.229.g6434b31f56-goog



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

* [PATCH v3 5/5] arm64: dts: mediatek: mt8173: Add GPU device nodes
  2026-07-27  9:15 [PATCH v3 0/5] powervr: MT8173 GPU support Chen-Yu Tsai
                   ` (3 preceding siblings ...)
  2026-07-27  9:15 ` [PATCH v3 4/5] arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock Chen-Yu Tsai
@ 2026-07-27  9:15 ` Chen-Yu Tsai
  2026-07-27 15:48 ` [PATCH v3 0/5] powervr: MT8173 GPU support YoungJoon Lee
  5 siblings, 0 replies; 10+ messages in thread
From: Chen-Yu Tsai @ 2026-07-27  9:15 UTC (permalink / raw)
  To: Stephen Boyd, Brian Masney, Matthias Brugger,
	AngeloGioacchino Del Regno, Alessio Belle, Luigi Santivetti,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann
  Cc: Dan Carpenter, Chen-Yu Tsai, David Airlie, Simona Vetter,
	linux-clk, devicetree, linux-mediatek, linux-arm-kernel,
	imagination, dri-devel, linux-kernel, Icenowy Zheng,
	YoungJoon Lee

The MediaTek MT8173 comes with a PowerVR Rogue GX6250, which is part
of the Series6XT, another variation of the Rogue family of GPUs.

On top of the GPU is a glue layer that handles some clock and power
signals.

Add device nodes for both. While there is supposed to be two different
power domains to the GPU, MediaTek does not have any information on how
this is integrated internally. Assign the same GPU power domain to both.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi | 31 ++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index 556e806b7787..169ba4fd183e 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -1002,6 +1002,37 @@ u2port1: usb-phy@11291000 {
 			};
 		};
 
+		gpu: gpu@13000000 {
+			compatible = "mediatek,mt8173-gpu", "img,img-gx6250",
+				     "img,img-rogue";
+			reg = <0 0x13000000 0 0x10000>;
+			interrupts = <GIC_SPI 217 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&mfgtop CLK_MFG_G3D>,
+				 <&mfgtop CLK_MFG_MEM>,
+				 <&mfgtop CLK_MFG_AXI>;
+			clock-names = "core", "mem", "sys";
+			/*
+			 * Binding and GPU core HW have two power domain
+			 * inputs, but MediaTek does not have information
+			 * on how this is done internally.
+			 */
+			power-domains = <&mfgtop>, <&mfgtop>;
+			power-domain-names = "a", "b";
+		};
+
+		mfgtop: clock-controller@13fff000 {
+			compatible = "mediatek,mt8173-mfgtop";
+			reg = <0 0x13fff000 0 0x1000>;
+			clocks = <&topckgen CLK_TOP_AXI_MFG_IN_SEL>,
+				 <&topckgen CLK_TOP_MEM_MFG_IN_SEL>,
+				 <&topckgen CLK_TOP_MFG_SEL>,
+				 <&clk26m>;
+			clock-names = "sys", "mem", "core", "clk26m";
+			power-domains = <&spm MT8173_POWER_DOMAIN_MFG>;
+			#clock-cells = <1>;
+			#power-domain-cells = <0>;
+		};
+
 		mmsys: syscon@14000000 {
 			compatible = "mediatek,mt8173-mmsys", "syscon";
 			reg = <0 0x14000000 0 0x1000>;
-- 
2.55.0.229.g6434b31f56-goog



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

* Re: [PATCH v3 1/5] dt-bindings: clock: mediatek: Add mt8173 mfgtop
  2026-07-27  9:15 ` [PATCH v3 1/5] dt-bindings: clock: mediatek: Add mt8173 mfgtop Chen-Yu Tsai
@ 2026-07-27 11:26   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 10+ messages in thread
From: AngeloGioacchino Del Regno @ 2026-07-27 11:26 UTC (permalink / raw)
  To: Chen-Yu Tsai, Stephen Boyd, Brian Masney, Matthias Brugger,
	Alessio Belle, Luigi Santivetti, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: Dan Carpenter, David Airlie, Simona Vetter, linux-clk, devicetree,
	linux-mediatek, linux-arm-kernel, imagination, dri-devel,
	linux-kernel, Icenowy Zheng, YoungJoon Lee, Conor Dooley

On 7/27/26 11:15, Chen-Yu Tsai wrote:
> The MFG (GPU) block on the MT8173 has a small glue layer, named MFG_TOP
> in the datasheet, that contains clock gates, some power sequence signal
> delays, and other unknown registers that get toggled when the GPU is
> powered on.
> 
> The clock gates are exposed as clocks provided by a clock controller,
> while the power sequencing bits are exposed as one singular power domain.
> 
> Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>



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

* Re: [PATCH v3 2/5] clk: mediatek: Add mt8173-mfgtop driver
  2026-07-27  9:15 ` [PATCH v3 2/5] clk: mediatek: Add mt8173-mfgtop driver Chen-Yu Tsai
@ 2026-07-27 11:26   ` AngeloGioacchino Del Regno
  2026-07-27 16:16   ` Brian Masney
  1 sibling, 0 replies; 10+ messages in thread
From: AngeloGioacchino Del Regno @ 2026-07-27 11:26 UTC (permalink / raw)
  To: Chen-Yu Tsai, Stephen Boyd, Brian Masney, Matthias Brugger,
	Alessio Belle, Luigi Santivetti, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: Dan Carpenter, David Airlie, Simona Vetter, linux-clk, devicetree,
	linux-mediatek, linux-arm-kernel, imagination, dri-devel,
	linux-kernel, Icenowy Zheng, YoungJoon Lee

On 7/27/26 11:15, Chen-Yu Tsai wrote:
> The MFG (GPU) block on the MT8173 has a small glue layer, named MFG_TOP
> in the datasheet, that contains clock gates, some power sequence signal
> delays, and other unknown registers that get toggled when the GPU is
> powered on.
> 
> The clock gates are exposed as clocks provided by a clock controller,
> while the power sequencing bits are exposed as one singular power domain.
> 
> Tested-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

> ---
> Changes since v2:
> - Made COMMON_CLK_MT8173_MFGTOP depend on PM
>    - Needed since the driver implements PM domains using the generic PM
>      domain library, which also depends on PM
>    - Fixes build breakage (kernel test robot)
> - Fixed "RST_DELAY_CNT" name (Brian)
> - Dropped unused mfg_desc (Brian)
> - Added check of clk_prepare_enable()'s return value in
>    clk_mt8173_mfgtop_power_on() (Brian)
> - Saved error value for return in IS_ERR(data->clk_26m) branch
>    (Dan Carpenter / kernel test robot w/ smatch)


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

* Re: [PATCH v3 0/5] powervr: MT8173 GPU support
  2026-07-27  9:15 [PATCH v3 0/5] powervr: MT8173 GPU support Chen-Yu Tsai
                   ` (4 preceding siblings ...)
  2026-07-27  9:15 ` [PATCH v3 5/5] arm64: dts: mediatek: mt8173: Add GPU device nodes Chen-Yu Tsai
@ 2026-07-27 15:48 ` YoungJoon Lee
  5 siblings, 0 replies; 10+ messages in thread
From: YoungJoon Lee @ 2026-07-27 15:48 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Stephen Boyd, Brian Masney, Matthias Brugger,
	AngeloGioacchino Del Regno, Alessio Belle, Luigi Santivetti,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Dan Carpenter, David Airlie, Simona Vetter, linux-clk, devicetree,
	linux-mediatek, linux-arm-kernel, imagination, dri-devel,
	linux-kernel, Icenowy Zheng

Hello,

I tested patches 1/5 through 5/5 from the MT8173 PowerVR v3 series on
an Acer Chromebook R13 (Google Elm), which uses an MT8173 SoC and a
PowerVR Rogue GX6250 GPU with BVNC 4.40.2.51.

For clarity, I applied the five actual patches numbered 1/5 through
5/5. The 0/5 cover letter itself was not applied.

Kernel:
  Linux 7.1.3-stb-cbm-pvr-v3

Relevant kernel configuration:
  CONFIG_DRM_POWERVR=m
  CONFIG_COMMON_CLK_MT8173_MFGTOP=y

Kernel command line:
  powervr.exp_hw_support=1

Firmware:
  powervr/rogue_4.40.2.51_v1.fw

The driver probes successfully, loads the firmware, and initializes the
DRM device:

  [    6.110569] powervr 13000000.gpu:
                 [drm] Running on unknown hardware; expect issues.
  [    6.117454] powervr 13000000.gpu:
                 [drm] loaded firmware
                 powervr/rogue_4.40.2.51_v1.fw
  [    6.118010] powervr 13000000.gpu:
                 [drm] FW version v1.0 (build 6476056 OS)
  [    6.122992] [drm] Initialized powervr 1.0.0
                 for 13000000.gpu on minor 1

The following DRM device nodes are created:

  /dev/dri/card0
  /dev/dri/card1
  /dev/dri/renderD128

However, on a clean boot, without manually running vulkaninfo, vkcube,
or another Vulkan application, the driver reports that the GPU has been
lost approximately six seconds after DRM initialization:

  [   12.084078] powervr 13000000.gpu:
                [drm] *ERROR* GPU device lost

The relevant boot sequence is therefore:

  [    6.110569] PowerVR probe begins
  [    6.117454] Firmware is loaded
  [    6.118010] Firmware version is reported
  [    6.122992] DRM initialization completes
  [   12.084078] GPU device lost

The unused-regulator shutdown occurs considerably later:

  [   31.712124] vgpu: disabling

Therefore, the later "vgpu: disabling" message does not appear to be
the immediate cause of the device loss. The GPU is reported lost about
20 seconds before that regulator shutdown message.

After the failure, regulator_summary reports:

  vgpu  0  0  0  normal  1000mV  0mA  700mV  1350mV

This output was collected after the GPU had already been reported lost,
so I do not know whether the regulator state was different during probe
or immediately before the failure.

The PowerVR-related clocks appear enabled in clk_summary:

  mfg_26m       26000000 Hz

  mem_mfg_in_sel
    rate:       455000000 Hz
    enable:     1
    prepare:    1

  mfg_mem
    rate:       455000000 Hz
    enable:     1
    prepare:    1
    consumer:   13000000.gpu
    clock name: mem

  mfg_sel
    rate:       455000000 Hz
    enable:     1
    prepare:    1

  mfg_g3d
    rate:       455000000 Hz
    enable:     1
    prepare:    1
    consumer:   13000000.gpu
    clock name: core

  axi_mfg_in_sel
    rate:       208000000 Hz
    enable:     2
    prepare:    2
    consumer:   power-domain@7

  mfg_axi
    rate:       208000000 Hz
    enable:     1
    prepare:    1
    consumer:   13000000.gpu
    clock name: sys

I also installed Mesa 26.1.5 and vulkan-powervr 26.1.5 and tested the
Vulkan ICD with:

  PVR_I_WANT_A_BROKEN_VULKAN_DRIVER=1 \
  VK_DRIVER_FILES=/usr/share/vulkan/icd.d/powervr_mesa_icd.json \
  vulkaninfo --summary

The PowerVR ICD was found and loaded. Before hanging, Mesa printed:

  WARNING: powervr is not a conformant Vulkan implementation,
           testing use only.

  FINISHME: Missing reset support for brn51764
  FINISHME: Missing reset support for brn58839
  FINISHME: Missing support for brn62269
  FINISHME: Devices without tpu_border_colour_enhanced require entries
            for compressed formats to be stored in the table
            pre-compressed.

The vulkaninfo process then remained in uninterruptible sleep:

  PID   STAT  WCHAN             COMMAND
  3244  Dl+   synchronize_srcu  vulkaninfo --summary

It could not be terminated normally while in that state, and a reboot
was required.

However, the clean-boot log shows that "GPU device lost" occurs even
without starting vulkaninfo manually. The vulkaninfo hang may therefore
be a consequence of the GPU already being in the lost state, rather than
the original cause of the failure.

At this point, the following parts appear to work:

  - MT8173 GPU device-tree node probing
  - MFGTOP clock registration
  - PowerVR kernel module probing
  - Firmware loading
  - Firmware version reporting
  - DRM device initialization
  - Creation of card1 and renderD128

The remaining problem is that the GPU becomes lost approximately six
seconds after initialization.

Could this be related to an interrupt not being delivered, firmware
heartbeat handling, reset sequencing, runtime PM, a missing regulator
consumer relationship, or another MT8173-specific power-domain
requirement?

Please let me know which additional kernel debug options, DRM debug
settings, tracepoints, interrupt statistics, register dumps, or test
patches would be useful. I have physical access to the device and can
build and test further kernel changes.

Thank you for working on MT8173 support.

Best regards,
YoungJoon Lee

2026年7月27日(月) 18:16 Chen-Yu Tsai <wenst@chromium.org>:
>
> Hi everyone,
>
> This is v3 of my MT8173 PowerVR GPU support series.
>
> I got another inquiry on the status of this patch series, so I thought
> I'd dig it out, fix all the issues and send another version.
>
> This time around Mesa was ready for basic testing, using both vulkanmark
> and glmark2-es2-drm (with Zink). Details below.
>
> Changes since v2 (all in the clk driver patch):
> - Made COMMON_CLK_MT8173_MFGTOP depend on PM
>   - Needed since the driver implements PM domains using the generic PM
>     domain library, which also depends on PM
>   - Fixes build breakage (kernel test robot)
> - Fixed "RST_DELAY_CNT" name (Brian)
> - Dropped unused mfg_desc (Brian)
> - Added check of clk_prepare_enable()'s return value in
>   clk_mt8173_mfgtop_power_on() (Brian)
> - Saved error value for return in IS_ERR(data->clk_26m) branch
>   (Dan Carpenter / kernel test robot w/ smatch)
>
> Changes since v1:
> - Adapted to changed DT bindings
> - Dropped driver change
> - Use same power domain for "a" and "b" GPU power domains
>
>
> This series enables the PowerVR GPU found in the MT8173 SoC, found in
> some Chromebooks.
>
> This version is different from the initial powervr driver submission [1]
> in that it splits out the GPU glue layer support out of the powervr
> driver and into a separate clock and power domain driver. The glue code
> is otherwise the same, and also the same as found in the ChromeOS
> kernels, with some extra comments and macro names added where possible.
>
> Patch 1 adds a binding for the glue layer, called mfgtop. The glue layer
> contains clock and power controls for the GPU.
>
> Patch 2 adds a driver for the glue layer, implemented as a clock driver
> that also provides power domains.
>
> Patch 3 adds an entry for the MT8173 GPU and 6XT series to the PowerVR
> binding.
>
> Patch 4 corrects the clock for the GPU (called MFG) power domain.
>
> Patch 5 adds device nodes for the GPU and glue layer to the MT8173 dtsi
> file.
>
> The kernel driver successfully probes the hardware and loads the
> "rogue_4.40.2.51_v1.fw" firmware provided by Imagination Technologies [2].
> The "exp_hw_support" module parameter needs to be set for the driver to
> probe successfully.
>
> This was tested with Mesa 26.1.5 from Debian Forky. With this version
> vkmark and glmark2-es2 (over Zink) both run fine. Mesa spits out a bunch
> of warnings since the GX6250 core is not officially supported.
>
>     # PVR_I_WANT_A_BROKEN_VULKAN_DRIVER=1 vkmark
>     WARNING: powervr is not a conformant Vulkan implementation, testing use only.
>     WARNING: powervr is not a conformant Vulkan implementation, testing use only.
>     MESA: warning: ../src/imagination/vulkan/pvr_arch_job_context.c:73: FINISHME: Missing reset support for brn51764
>     MESA: warning: ../src/imagination/vulkan/pvr_arch_job_context.c:76: FINISHME: Missing reset support for brn58839
>     MESA: warning: ../src/imagination/vulkan/pvr_arch_job_context.c:523: FINISHME: Missing support for brn62269
>     MESA: warning: ../src/imagination/vulkan/pvr_arch_border.c:244: FINISHME: Devices without tpu_border_colour_enhanced require entries for compressed formats to be stored in the table pre-compressed.
>     WARNING: powervr is not a conformant Vulkan implementation, testing use only.
>     =======================================================
>         vkmark 2025.01
>     =======================================================
>         Vendor ID:      0x1010
>         Device ID:      0x6250
>         Device Name:    PowerVR Rogue GX6250
>         Driver Version: 109056005
>         Device UUID:    d04cd6f3a25fd4900f89c151bccfdfcf
>     =======================================================
>     [vertex] device-local=true: FPS: 251 FrameTime: 3.984 ms
>     [vertex] device-local=false: FPS: 220 FrameTime: 4.545 ms
>     [texture] anisotropy=0:^C FPS: 223 FrameTime: 4.484 ms
>     =======================================================
>                                        vkmark Score: 231
>     =======================================================
>
>     # PVR_I_WANT_A_BROKEN_VULKAN_DRIVER=1 glmark2-es2-drm
>     WARNING: powervr is not a conformant Vulkan implementation, testing use only.
>     MESA: warning: ../src/imagination/vulkan/pvr_arch_job_context.c:73: FINISHME: Missing reset support for brn51764
>     MESA: warning: ../src/imagination/vulkan/pvr_arch_job_context.c:76: FINISHME: Missing reset support for brn58839
>     MESA: warning: ../src/imagination/vulkan/pvr_arch_job_context.c:523: FINISHME: Missing support for brn62269
>     MESA: warning: ../src/imagination/vulkan/pvr_arch_border.c:244: FINISHME: Devices without tpu_border_colour_enhanced require entries for compressed formats to be stored in the table pre-compressed.
>     Warning: DRM_CAP_ASYNC_PAGE_FLIP not supported, falling back to 'mailbox' mode for SwapInterval(0).
>     =======================================================
>         glmark2 2023.01
>     =======================================================
>         OpenGL Information
>         GL_VENDOR:      Mesa
>         GL_RENDERER:    zink Vulkan 1.2(PowerVR Rogue GX6250 (IMAGINATION_OPEN_SOURCE_MESA))
>         GL_VERSION:     OpenGL ES 2.0 Mesa 26.1.5-1
>         Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
>         Surface Size:   1366x768 fullscreen
>     =======================================================
>     [build] use-vbo=false: FPS: 49 FrameTime: 20.473 ms
>     [build] use-vbo=true: FPS: 45 FrameTime: 22.660 ms
>     [texture] texture-filter=nearest: FPS: 45 FrameTime: 22.642 ms
>     [texture] texture-filter=linear:^C FPS: 50 FrameTime: 20.172 ms
>     =======================================================
>                                       glmark2 Score: 46
>     =======================================================
>
>
> Please have a look.
>
> Thanks
> ChenYu
>
> [1] https://lore.kernel.org/dri-devel/20220815165156.118212-2-sarah.walker@imgtec.com/
> [2] https://gitlab.freedesktop.org/imagination/linux-firmware/-/tree/powervr
>
> Chen-Yu Tsai (5):
>   dt-bindings: clock: mediatek: Add mt8173 mfgtop
>   clk: mediatek: Add mt8173-mfgtop driver
>   dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU
>   arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock
>   arm64: dts: mediatek: mt8173: Add GPU device nodes
>
>  .../clock/mediatek,mt8173-mfgtop.yaml         |  70 +++++
>  .../bindings/gpu/img,powervr-rogue.yaml       |   1 +
>  arch/arm64/boot/dts/mediatek/mt8173.dtsi      |  33 ++-
>  drivers/clk/mediatek/Kconfig                  |  10 +
>  drivers/clk/mediatek/Makefile                 |   1 +
>  drivers/clk/mediatek/clk-mt8173-mfgtop.c      | 241 ++++++++++++++++++
>  include/dt-bindings/clock/mt8173-clk.h        |   7 +
>  7 files changed, 362 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8173-mfgtop.yaml
>  create mode 100644 drivers/clk/mediatek/clk-mt8173-mfgtop.c
>
> --
> 2.55.0.229.g6434b31f56-goog
>


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

* Re: [PATCH v3 2/5] clk: mediatek: Add mt8173-mfgtop driver
  2026-07-27  9:15 ` [PATCH v3 2/5] clk: mediatek: Add mt8173-mfgtop driver Chen-Yu Tsai
  2026-07-27 11:26   ` AngeloGioacchino Del Regno
@ 2026-07-27 16:16   ` Brian Masney
  1 sibling, 0 replies; 10+ messages in thread
From: Brian Masney @ 2026-07-27 16:16 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Stephen Boyd, Matthias Brugger, AngeloGioacchino Del Regno,
	Alessio Belle, Luigi Santivetti, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Dan Carpenter, David Airlie, Simona Vetter,
	linux-clk, devicetree, linux-mediatek, linux-arm-kernel,
	imagination, dri-devel, linux-kernel, Icenowy Zheng,
	YoungJoon Lee

Hi Chen-Yu,

On Mon, Jul 27, 2026 at 05:15:51PM +0800, Chen-Yu Tsai wrote:
> The MFG (GPU) block on the MT8173 has a small glue layer, named MFG_TOP
> in the datasheet, that contains clock gates, some power sequence signal
> delays, and other unknown registers that get toggled when the GPU is
> powered on.
> 
> The clock gates are exposed as clocks provided by a clock controller,
> while the power sequencing bits are exposed as one singular power domain.
> 
> Tested-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> Changes since v2:
> - Made COMMON_CLK_MT8173_MFGTOP depend on PM
>   - Needed since the driver implements PM domains using the generic PM
>     domain library, which also depends on PM
>   - Fixes build breakage (kernel test robot)
> - Fixed "RST_DELAY_CNT" name (Brian)
> - Dropped unused mfg_desc (Brian)
> - Added check of clk_prepare_enable()'s return value in
>   clk_mt8173_mfgtop_power_on() (Brian)
> - Saved error value for return in IS_ERR(data->clk_26m) branch
>   (Dan Carpenter / kernel test robot w/ smatch)
> ---

[snip]

> +static int clk_mt8173_mfgtop_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct device_node *node = dev->of_node;
> +	struct mt8173_mfgtop_data *data;
> +	int ret;
> +
> +	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> +	if (!data)
> +		return -ENOMEM;
> +
> +	platform_set_drvdata(pdev, data);
> +
> +	data->clk_data = mtk_devm_alloc_clk_data(dev, ARRAY_SIZE(mfg_clks));
> +	if (!data->clk_data)
> +		return -ENOMEM;
> +
> +	/* MTK clock gates also uses regmap */
> +	data->regmap = device_node_to_regmap(node);
> +	if (IS_ERR(data->regmap))
> +		return dev_err_probe(dev, PTR_ERR(data->regmap), "Failed to get regmap\n");
> +
> +	data->child_pd.np = node;
> +	data->child_pd.args_count = 0;
> +	ret = of_parse_phandle_with_args(node, "power-domains", "#power-domain-cells", 0,
> +					 &data->parent_pd);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "Failed to parse power domain\n");
> +
> +	devm_pm_runtime_enable(dev);
> +	/*
> +	 * Do a pm_runtime_resume_and_get() to workaround a possible
> +	 * deadlock between clk_register() and the genpd framework.
> +	 */
> +	ret = pm_runtime_resume_and_get(dev);
> +	if (ret) {
> +		dev_err_probe(dev, ret, "Failed to runtime resume device\n");
> +		goto put_of_node;
> +	}
> +
> +	ret = mtk_clk_register_gates(dev, node, mfg_clks, ARRAY_SIZE(mfg_clks),
> +				     data->clk_data);
> +	if (ret) {
> +		dev_err_probe(dev, ret, "Failed to register clock gates\n");
> +		goto put_pm_runtime;
> +	}
> +
> +	data->clk_26m = clk_hw_get_clk(data->clk_data->hws[CLK_MFG_26M], "26m");
> +	if (IS_ERR(data->clk_26m)) {
> +		ret = dev_err_probe(dev, PTR_ERR(data->clk_26m), "Failed to get 26 MHz clock\n");
> +		goto unregister_clks;
> +	}
> +
> +	ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, data->clk_data);
> +	if (ret) {
> +		dev_err_probe(dev, ret, "Failed to add clk OF provider\n");
> +		goto put_26m_clk;
> +	}
> +
> +	data->genpd.name = "mfg-top";
> +	data->genpd.power_on = clk_mt8173_mfgtop_power_on;
> +	data->genpd.power_off = clk_mt8173_mfgtop_power_off;
> +	ret = pm_genpd_init(&data->genpd, NULL, true);
> +	if (ret) {
> +		dev_err_probe(dev, ret, "Failed to add power domain\n");
> +		goto del_clk_provider;
> +	}
> +
> +	ret = of_genpd_add_provider_simple(node, &data->genpd);
> +	if (ret) {
> +		dev_err_probe(dev, ret, "Failed to add power domain OF provider\n");
> +		goto remove_pd;
> +	}
> +
> +	ret = of_genpd_add_subdomain(&data->parent_pd, &data->child_pd);
> +	if (ret) {
> +		dev_err_probe(dev, ret, "Failed to link PM domains\n");
> +		goto del_pd_provider;
> +	}
> +
> +	pm_runtime_put(dev);
> +	return 0;
> +
> +del_pd_provider:
> +	of_genpd_del_provider(node);
> +remove_pd:
> +	pm_genpd_remove(&data->genpd);
> +del_clk_provider:
> +	of_clk_del_provider(node);
> +put_26m_clk:
> +	clk_put(data->clk_26m);
> +unregister_clks:
> +	mtk_clk_unregister_gates(mfg_clks, ARRAY_SIZE(mfg_clks), data->clk_data);
> +put_pm_runtime:
> +	pm_runtime_put(dev);
> +put_of_node:
> +	of_node_put(data->parent_pd.np);
> +	return ret;
> +}
> +
> +static void clk_mt8173_mfgtop_remove(struct platform_device *pdev)
> +{
> +	struct mt8173_mfgtop_data *data = platform_get_drvdata(pdev);
> +	struct device_node *node = pdev->dev.of_node;
> +
> +	of_genpd_remove_subdomain(&data->parent_pd, &data->child_pd);
> +	of_genpd_del_provider(node);
> +	pm_genpd_remove(&data->genpd);
> +	of_clk_del_provider(node);
> +	clk_put(data->clk_26m);
> +	mtk_clk_unregister_gates(mfg_clks, ARRAY_SIZE(mfg_clks), data->clk_data);

Looking at the error labels in the probe, does the remove also need:

    of_node_put(data->parent_pd.np);

Otherwise this looks good. With that fixed:

Reviewed-by: Brian Masney <bmasney@redhat.com>



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

end of thread, other threads:[~2026-07-27 16:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-27  9:15 [PATCH v3 0/5] powervr: MT8173 GPU support Chen-Yu Tsai
2026-07-27  9:15 ` [PATCH v3 1/5] dt-bindings: clock: mediatek: Add mt8173 mfgtop Chen-Yu Tsai
2026-07-27 11:26   ` AngeloGioacchino Del Regno
2026-07-27  9:15 ` [PATCH v3 2/5] clk: mediatek: Add mt8173-mfgtop driver Chen-Yu Tsai
2026-07-27 11:26   ` AngeloGioacchino Del Regno
2026-07-27 16:16   ` Brian Masney
2026-07-27  9:15 ` [PATCH v3 3/5] dt-bindings: gpu: powervr-rogue: Add MediaTek MT8173 GPU Chen-Yu Tsai
2026-07-27  9:15 ` [PATCH v3 4/5] arm64: dts: mediatek: mt8173: Fix MFG_ASYNC power domain clock Chen-Yu Tsai
2026-07-27  9:15 ` [PATCH v3 5/5] arm64: dts: mediatek: mt8173: Add GPU device nodes Chen-Yu Tsai
2026-07-27 15:48 ` [PATCH v3 0/5] powervr: MT8173 GPU support YoungJoon Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox