* [PATCH v4 1/9] drm/panthor: Ignore -EOPNOTSUPP for shader-present nvmem lookup
2026-11-19 15:45 [PATCH v4 0/9] drm/panthor: Add initial Mali v15 support Karunika Choo
@ 2026-11-19 15:45 ` Karunika Choo
2026-11-19 15:45 ` [PATCH v4 2/9] drm/panthor: Rename neural accelerator feature macro to NX Karunika Choo
` (7 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Karunika Choo @ 2026-11-19 15:45 UTC (permalink / raw)
To: dri-devel
Cc: nd, Boris Brezillon, Steven Price, Liviu Dudau, linux-kernel,
Akash Goel, Lukas Zapolskas, Chris Diamand, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Nicolas Frattaroli
When CONFIG_NVMEM is disabled, reading the optional "shader-present"
nvmem cell can return -EOPNOTSUPP.
Treat this the same as the cell being absent so panthor can continue
probing on platforms that do not provide shader-present fuses through
nvmem.
Fixes: c40b50c3cfbe ("drm/panthor: Implement reading shader_present from nvmem")
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Karunika Choo <karunika.choo@arm.com>
---
v2:
- Picked up R-b from Liviu
v1:
- Picked up R-bs from Boris and Steve
- Added Fixes tag
drivers/gpu/drm/panthor/panthor_hw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panthor/panthor_hw.c b/drivers/gpu/drm/panthor/panthor_hw.c
index ea1e222ef1210..34dc4b9d9dc09 100644
--- a/drivers/gpu/drm/panthor/panthor_hw.c
+++ b/drivers/gpu/drm/panthor/panthor_hw.c
@@ -182,7 +182,7 @@ static int overload_shader_present(struct panthor_device *ptdev)
&contents);
if (!ret)
ptdev->gpu_info.shader_present = contents;
- else if (ret == -ENOENT)
+ else if (ret == -ENOENT || ret == -EOPNOTSUPP)
return 0;
else
return dev_err_probe(ptdev->base.dev, ret,
--
2.43.0
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH v4 2/9] drm/panthor: Rename neural accelerator feature macro to NX
2026-11-19 15:45 [PATCH v4 0/9] drm/panthor: Add initial Mali v15 support Karunika Choo
2026-11-19 15:45 ` [PATCH v4 1/9] drm/panthor: Ignore -EOPNOTSUPP for shader-present nvmem lookup Karunika Choo
@ 2026-11-19 15:45 ` Karunika Choo
2026-11-19 15:45 ` [PATCH v4 3/9] drm/panthor: Move register access helpers out of panthor_device.h Karunika Choo
` (6 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Karunika Choo @ 2026-11-19 15:45 UTC (permalink / raw)
To: dri-devel
Cc: nd, Boris Brezillon, Steven Price, Liviu Dudau, linux-kernel,
Akash Goel, Lukas Zapolskas, Chris Diamand, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Rename GPU_FEATURES_NEURAL_ENGINE to GPU_FEATURES_NX.
Update the panthor_hw helper to use the new name.
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Karunika Choo <karunika.choo@arm.com>
---
v4:
- Collect R-bs from Liviu and Boris
drivers/gpu/drm/panthor/panthor_gpu_regs.h | 2 +-
drivers/gpu/drm/panthor/panthor_hw.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/panthor/panthor_gpu_regs.h b/drivers/gpu/drm/panthor/panthor_gpu_regs.h
index 5340966caef37..c7581b6d4c5be 100644
--- a/drivers/gpu/drm/panthor/panthor_gpu_regs.h
+++ b/drivers/gpu/drm/panthor/panthor_gpu_regs.h
@@ -67,7 +67,7 @@
#define GPU_FEATURES 0x60
#define GPU_FEATURES_RAY_INTERSECTION BIT(2)
-#define GPU_FEATURES_NEURAL_ENGINE BIT(4)
+#define GPU_FEATURES_NX BIT(4)
#define GPU_FEATURES_RAY_TRAVERSAL BIT(5)
#define GPU_TIMESTAMP_OFFSET 0x88
diff --git a/drivers/gpu/drm/panthor/panthor_hw.h b/drivers/gpu/drm/panthor/panthor_hw.h
index eeca936f44bae..f770dc40e6216 100644
--- a/drivers/gpu/drm/panthor/panthor_hw.h
+++ b/drivers/gpu/drm/panthor/panthor_hw.h
@@ -64,7 +64,7 @@ static inline bool panthor_hw_has_pwr_ctrl(struct panthor_device *ptdev)
static inline bool panthor_hw_has_neural(struct panthor_device *ptdev)
{
return (GPU_ARCH_MAJOR(ptdev->gpu_info.gpu_id) >= 14 &&
- ptdev->gpu_info.gpu_features & GPU_FEATURES_NEURAL_ENGINE);
+ ptdev->gpu_info.gpu_features & GPU_FEATURES_NX);
}
#endif /* __PANTHOR_HW_H__ */
--
2.43.0
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH v4 3/9] drm/panthor: Move register access helpers out of panthor_device.h
2026-11-19 15:45 [PATCH v4 0/9] drm/panthor: Add initial Mali v15 support Karunika Choo
2026-11-19 15:45 ` [PATCH v4 1/9] drm/panthor: Ignore -EOPNOTSUPP for shader-present nvmem lookup Karunika Choo
2026-11-19 15:45 ` [PATCH v4 2/9] drm/panthor: Rename neural accelerator feature macro to NX Karunika Choo
@ 2026-11-19 15:45 ` Karunika Choo
2026-11-19 15:45 ` [PATCH v4 4/9] drm/panthor: Parse and store GPU_ID fields Karunika Choo
` (5 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Karunika Choo @ 2026-11-19 15:45 UTC (permalink / raw)
To: dri-devel
Cc: nd, Boris Brezillon, Steven Price, Liviu Dudau, linux-kernel,
Akash Goel, Lukas Zapolskas, Chris Diamand, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Move register access helpers out of panthor_device.h to allow reuse by
other panthor drivers that will be added to enable v15 support.
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Karunika Choo <karunika.choo@arm.com>
---
v4:
- Picked up R-b from Boris
v2:
- Picked up R-b from Liviu
- Fix includes raised by sashiko
- Link: https://lore.kernel.org/all/20260922205441.263661F000FF@smtp.kernel.org/
v1:
- Includes "panthor_device_io.h" directly in "panthor_device.h" instead
of peppering multiple files with the header.
drivers/gpu/drm/panthor/panthor_device.h | 73 +-----------------
drivers/gpu/drm/panthor/panthor_device_io.h | 84 +++++++++++++++++++++
2 files changed, 86 insertions(+), 71 deletions(-)
create mode 100644 drivers/gpu/drm/panthor/panthor_device_io.h
diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h
index b55a3f9edd414..4add31b12cfd7 100644
--- a/drivers/gpu/drm/panthor/panthor_device.h
+++ b/drivers/gpu/drm/panthor/panthor_device.h
@@ -19,6 +19,8 @@
#include <drm/gpu_scheduler.h>
#include <drm/panthor_drm.h>
+#include "panthor_device_io.h"
+
struct panthor_csf;
struct panthor_csf_ctx;
struct panthor_device;
@@ -495,77 +497,6 @@ panthor_exception_is_fault(u32 exception_code)
const char *panthor_exception_name(struct panthor_device *ptdev,
u32 exception_code);
-static inline void gpu_write(void __iomem *iomem, u32 reg, u32 data)
-{
- writel(data, iomem + reg);
-}
-
-static inline u32 gpu_read(void __iomem *iomem, u32 reg)
-{
- return readl(iomem + reg);
-}
-
-static inline u32 gpu_read_relaxed(void __iomem *iomem, u32 reg)
-{
- return readl_relaxed(iomem + reg);
-}
-
-static inline void gpu_write64(void __iomem *iomem, u32 reg, u64 data)
-{
- gpu_write(iomem, reg, lower_32_bits(data));
- gpu_write(iomem, reg + 4, upper_32_bits(data));
-}
-
-static inline u64 gpu_read64(void __iomem *iomem, u32 reg)
-{
- return (gpu_read(iomem, reg) | ((u64)gpu_read(iomem, reg + 4) << 32));
-}
-
-static inline u64 gpu_read64_relaxed(void __iomem *iomem, u32 reg)
-{
- return (gpu_read_relaxed(iomem, reg) |
- ((u64)gpu_read_relaxed(iomem, reg + 4) << 32));
-}
-
-static inline u64 gpu_read64_counter(void __iomem *iomem, u32 reg)
-{
- u32 lo, hi1, hi2;
- do {
- hi1 = gpu_read(iomem, reg + 4);
- lo = gpu_read(iomem, reg);
- hi2 = gpu_read(iomem, reg + 4);
- } while (hi1 != hi2);
- return lo | ((u64)hi2 << 32);
-}
-
-#define gpu_read_poll_timeout(iomem, reg, val, cond, delay_us, timeout_us) \
- read_poll_timeout(gpu_read, val, cond, delay_us, timeout_us, false, \
- iomem, reg)
-
-#define gpu_read_poll_timeout_atomic(iomem, reg, val, cond, delay_us, \
- timeout_us) \
- read_poll_timeout_atomic(gpu_read, val, cond, delay_us, timeout_us, \
- false, iomem, reg)
-
-#define gpu_read64_poll_timeout(iomem, reg, val, cond, delay_us, timeout_us) \
- read_poll_timeout(gpu_read64, val, cond, delay_us, timeout_us, false, \
- iomem, reg)
-
-#define gpu_read64_poll_timeout_atomic(iomem, reg, val, cond, delay_us, \
- timeout_us) \
- read_poll_timeout_atomic(gpu_read64, val, cond, delay_us, timeout_us, \
- false, iomem, reg)
-
-#define gpu_read_relaxed_poll_timeout_atomic(iomem, reg, val, cond, delay_us, \
- timeout_us) \
- read_poll_timeout_atomic(gpu_read_relaxed, val, cond, delay_us, \
- timeout_us, false, iomem, reg)
-
-#define gpu_read64_relaxed_poll_timeout(iomem, reg, val, cond, delay_us, \
- timeout_us) \
- read_poll_timeout(gpu_read64_relaxed, val, cond, delay_us, timeout_us, \
- false, iomem, reg)
-
#define INT_RAWSTAT 0x0
#define INT_CLEAR 0x4
#define INT_MASK 0x8
diff --git a/drivers/gpu/drm/panthor/panthor_device_io.h b/drivers/gpu/drm/panthor/panthor_device_io.h
new file mode 100644
index 0000000000000..ce417c64abb44
--- /dev/null
+++ b/drivers/gpu/drm/panthor/panthor_device_io.h
@@ -0,0 +1,84 @@
+/* SPDX-License-Identifier: GPL-2.0 or MIT */
+/* Copyright 2026 ARM Limited. All rights reserved. */
+
+#ifndef __PANTHOR_DEVICE_IO_H__
+#define __PANTHOR_DEVICE_IO_H__
+
+#include <linux/io.h>
+#include <linux/iopoll.h>
+#include <linux/wordpart.h>
+
+static inline void gpu_write(void __iomem *iomem, u32 reg, u32 data)
+{
+ writel(data, iomem + reg);
+}
+
+static inline u32 gpu_read(void __iomem *iomem, u32 reg)
+{
+ return readl(iomem + reg);
+}
+
+static inline u32 gpu_read_relaxed(void __iomem *iomem, u32 reg)
+{
+ return readl_relaxed(iomem + reg);
+}
+
+static inline void gpu_write64(void __iomem *iomem, u32 reg, u64 data)
+{
+ gpu_write(iomem, reg, lower_32_bits(data));
+ gpu_write(iomem, reg + 4, upper_32_bits(data));
+}
+
+static inline u64 gpu_read64(void __iomem *iomem, u32 reg)
+{
+ return (gpu_read(iomem, reg) | ((u64)gpu_read(iomem, reg + 4) << 32));
+}
+
+static inline u64 gpu_read64_relaxed(void __iomem *iomem, u32 reg)
+{
+ return (gpu_read_relaxed(iomem, reg) |
+ ((u64)gpu_read_relaxed(iomem, reg + 4) << 32));
+}
+
+static inline u64 gpu_read64_counter(void __iomem *iomem, u32 reg)
+{
+ u32 lo, hi1, hi2;
+
+ do {
+ hi1 = gpu_read(iomem, reg + 4);
+ lo = gpu_read(iomem, reg);
+ hi2 = gpu_read(iomem, reg + 4);
+ } while (hi1 != hi2);
+ return lo | ((u64)hi2 << 32);
+}
+
+#define gpu_read_poll_timeout(iomem, reg, val, cond, delay_us, timeout_us) \
+ read_poll_timeout(gpu_read, val, cond, delay_us, timeout_us, false, \
+ iomem, reg)
+
+#define gpu_read_poll_timeout_atomic(iomem, reg, val, cond, delay_us, \
+ timeout_us) \
+ read_poll_timeout_atomic(gpu_read, val, cond, delay_us, timeout_us, \
+ false, iomem, reg)
+
+#define gpu_read64_poll_timeout(iomem, reg, val, cond, delay_us, timeout_us) \
+ read_poll_timeout(gpu_read64, val, cond, delay_us, timeout_us, false, \
+ iomem, reg)
+
+#define gpu_read64_poll_timeout_atomic(iomem, reg, val, cond, delay_us, \
+ timeout_us) \
+ read_poll_timeout_atomic(gpu_read64, val, cond, delay_us, timeout_us, \
+ false, iomem, reg)
+
+#define gpu_read_relaxed_poll_timeout_atomic(iomem, reg, val, cond, delay_us, \
+ timeout_us) \
+ read_poll_timeout_atomic(gpu_read_relaxed, val, cond, delay_us, \
+ timeout_us, false, iomem, reg)
+
+#define gpu_read64_relaxed_poll_timeout(iomem, reg, val, cond, delay_us, \
+ timeout_us) \
+ read_poll_timeout(gpu_read64_relaxed, val, cond, delay_us, timeout_us, \
+ false, iomem, reg)
+
+
+#endif /* __PANTHOR_DEVICE_IO_H__ */
--
2.43.0
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH v4 4/9] drm/panthor: Parse and store GPU_ID fields
2026-11-19 15:45 [PATCH v4 0/9] drm/panthor: Add initial Mali v15 support Karunika Choo
` (2 preceding siblings ...)
2026-11-19 15:45 ` [PATCH v4 3/9] drm/panthor: Move register access helpers out of panthor_device.h Karunika Choo
@ 2026-11-19 15:45 ` Karunika Choo
2026-11-19 15:45 ` [PATCH v4 5/9] drm/panthor: Move register base offsets to the HW description Karunika Choo
` (4 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Karunika Choo @ 2026-11-19 15:45 UTC (permalink / raw)
To: dri-devel
Cc: nd, Boris Brezillon, Steven Price, Liviu Dudau, linux-kernel,
Akash Goel, Lukas Zapolskas, Chris Diamand, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Prepare for Mali v15, where GPU_ID expands to 64 bits and its field
layout changes.
Introduce a small panthor_gpu_id structure and parse the GPU_ID fields
once during hardware initialization. Convert existing users to consume
the cached fields instead of extracting them repeatedly from the raw
register value.
This centralizes GPU_ID decoding and makes it easier to support both the
existing and v15 formats.
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Karunika Choo <karunika.choo@arm.com>
---
v4:
- Picked up R-b from Boris
v2:
- Picked up R-b from Liviu
- Avoid modifying the printed id field for existing GPUs.
- Link: https://lore.kernel.org/all/20260922205659.3C4F21F000FF@smtp.kernel.org/
v1:
- changed struct panthor_gpu_id into a flat structure instead of
inconsistent groupings.
drivers/gpu/drm/panthor/panthor_device.h | 29 ++++++++++++++++++++++++
drivers/gpu/drm/panthor/panthor_fw.c | 4 ++--
drivers/gpu/drm/panthor/panthor_gpu.c | 2 +-
drivers/gpu/drm/panthor/panthor_hw.c | 24 ++++++++++++++------
drivers/gpu/drm/panthor/panthor_hw.h | 4 ++--
5 files changed, 51 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h
index 4add31b12cfd7..f0a96ff0f13da 100644
--- a/drivers/gpu/drm/panthor/panthor_device.h
+++ b/drivers/gpu/drm/panthor/panthor_device.h
@@ -111,6 +111,32 @@ struct panthor_irq {
enum panthor_irq_state state;
};
+/**
+ * struct panthor_gpu_id - Parsed GPU_ID fields
+ */
+struct panthor_gpu_id {
+ /** @arch_major: Architecture major revision */
+ u8 arch_major;
+
+ /** @arch_minor: Architecture minor revision */
+ u8 arch_minor;
+
+ /** @arch_rev: Architecture patch revision */
+ u8 arch_rev;
+
+ /** @prod_major: Product identifier */
+ u8 prod_major;
+
+ /** @ver_major: Major release version number */
+ u8 ver_major;
+
+ /** @ver_minor: Minor release version number */
+ u8 ver_minor;
+
+ /** @ver_status: Status of GPU release */
+ u8 ver_status;
+};
+
/**
* enum panthor_device_profiling_mode - Profiling state
*/
@@ -170,6 +196,9 @@ struct panthor_device {
/** @mmu_info: MMU info */
struct drm_panthor_mmu_info mmu_info;
+ /** @gpu_id: Parsed GPU_ID fields */
+ struct panthor_gpu_id gpu_id;
+
/** @hw: GPU-specific data. */
struct panthor_hw *hw;
diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c
index 4f1fab66a13bf..13efed3a2ea72 100644
--- a/drivers/gpu/drm/panthor/panthor_fw.c
+++ b/drivers/gpu/drm/panthor/panthor_fw.c
@@ -809,8 +809,8 @@ static int panthor_fw_load(struct panthor_device *ptdev)
int ret;
snprintf(fw_path, sizeof(fw_path), "arm/mali/arch%d.%d/%s",
- (u32)GPU_ARCH_MAJOR(ptdev->gpu_info.gpu_id),
- (u32)GPU_ARCH_MINOR(ptdev->gpu_info.gpu_id),
+ (u32)ptdev->gpu_id.arch_major,
+ (u32)ptdev->gpu_id.arch_minor,
CSF_FW_NAME);
ret = request_firmware(&fw, fw_path, ptdev->base.dev);
diff --git a/drivers/gpu/drm/panthor/panthor_gpu.c b/drivers/gpu/drm/panthor/panthor_gpu.c
index b8df5663f04e4..c5c37f22993d6 100644
--- a/drivers/gpu/drm/panthor/panthor_gpu.c
+++ b/drivers/gpu/drm/panthor/panthor_gpu.c
@@ -74,7 +74,7 @@ static void panthor_gpu_l2_config_set(struct panthor_device *ptdev)
if (!data || !data->asn_hash_enable)
return;
- if (GPU_ARCH_MAJOR(ptdev->gpu_info.gpu_id) < 11) {
+ if (ptdev->gpu_id.arch_major < 11) {
drm_err(&ptdev->base, "Custom ASN hash not supported by the device");
return;
}
diff --git a/drivers/gpu/drm/panthor/panthor_hw.c b/drivers/gpu/drm/panthor/panthor_hw.c
index 34dc4b9d9dc09..854874a9f322a 100644
--- a/drivers/gpu/drm/panthor/panthor_hw.c
+++ b/drivers/gpu/drm/panthor/panthor_hw.c
@@ -119,9 +119,9 @@ void panthor_hw_power_status_unregister(void)
static char *get_gpu_model_name(struct panthor_device *ptdev)
{
- const u32 gpu_id = ptdev->gpu_info.gpu_id;
- const u32 product_id = GPU_PROD_ID_MAKE(GPU_ARCH_MAJOR(gpu_id),
- GPU_PROD_MAJOR(gpu_id));
+ const struct panthor_gpu_id *gpu_id = &ptdev->gpu_id;
+ const u32 product_id = GPU_PROD_ID_MAKE(gpu_id->arch_major,
+ gpu_id->prod_major);
const bool ray_intersection = !!(ptdev->gpu_info.gpu_features &
GPU_FEATURES_RAY_INTERSECTION);
const u8 shader_core_count = hweight64(ptdev->gpu_info.shader_present);
@@ -245,9 +245,9 @@ static int panthor_hw_info_init(struct panthor_device *ptdev)
if (ret)
return ret;
- major = GPU_VER_MAJOR(ptdev->gpu_info.gpu_id);
- minor = GPU_VER_MINOR(ptdev->gpu_info.gpu_id);
- status = GPU_VER_STATUS(ptdev->gpu_info.gpu_id);
+ major = ptdev->gpu_id.ver_major;
+ minor = ptdev->gpu_id.ver_minor;
+ status = ptdev->gpu_id.ver_status;
drm_info(&ptdev->base,
"%s id 0x%x major 0x%x minor 0x%x status 0x%x",
@@ -273,7 +273,7 @@ static int panthor_hw_info_init(struct panthor_device *ptdev)
static int panthor_hw_bind_device(struct panthor_device *ptdev)
{
struct panthor_hw *hdev = NULL;
- const u32 arch_major = GPU_ARCH_MAJOR(ptdev->gpu_info.gpu_id);
+ const u32 arch_major = ptdev->gpu_id.arch_major;
int i = 0;
for (i = 0; i < ARRAY_SIZE(panthor_hw_match); i++) {
@@ -295,10 +295,20 @@ static int panthor_hw_bind_device(struct panthor_device *ptdev)
static int panthor_hw_gpu_id_init(struct panthor_device *ptdev)
{
+ struct panthor_gpu_id *gpu_id = &ptdev->gpu_id;
ptdev->gpu_info.gpu_id = gpu_read(ptdev->iomem, GPU_ID);
+
if (!ptdev->gpu_info.gpu_id)
return -ENXIO;
+ gpu_id->arch_major = GPU_ARCH_MAJOR(ptdev->gpu_info.gpu_id);
+ gpu_id->arch_minor = GPU_ARCH_MINOR(ptdev->gpu_info.gpu_id);
+ gpu_id->arch_rev = GPU_ARCH_REV(ptdev->gpu_info.gpu_id);
+ gpu_id->prod_major = GPU_PROD_MAJOR(ptdev->gpu_info.gpu_id);
+ gpu_id->ver_major = GPU_VER_MAJOR(ptdev->gpu_info.gpu_id);
+ gpu_id->ver_minor = GPU_VER_MINOR(ptdev->gpu_info.gpu_id);
+ gpu_id->ver_status = GPU_VER_STATUS(ptdev->gpu_info.gpu_id);
+
return 0;
}
diff --git a/drivers/gpu/drm/panthor/panthor_hw.h b/drivers/gpu/drm/panthor/panthor_hw.h
index f770dc40e6216..c4a490bc39de6 100644
--- a/drivers/gpu/drm/panthor/panthor_hw.h
+++ b/drivers/gpu/drm/panthor/panthor_hw.h
@@ -58,12 +58,12 @@ static inline void panthor_hw_l2_power_off(struct panthor_device *ptdev)
static inline bool panthor_hw_has_pwr_ctrl(struct panthor_device *ptdev)
{
- return GPU_ARCH_MAJOR(ptdev->gpu_info.gpu_id) >= 14;
+ return ptdev->gpu_id.arch_major >= 14;
}
static inline bool panthor_hw_has_neural(struct panthor_device *ptdev)
{
- return (GPU_ARCH_MAJOR(ptdev->gpu_info.gpu_id) >= 14 &&
+ return (ptdev->gpu_id.arch_major >= 14 &&
ptdev->gpu_info.gpu_features & GPU_FEATURES_NX);
}
--
2.43.0
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH v4 5/9] drm/panthor: Move register base offsets to the HW description
2026-11-19 15:45 [PATCH v4 0/9] drm/panthor: Add initial Mali v15 support Karunika Choo
` (3 preceding siblings ...)
2026-11-19 15:45 ` [PATCH v4 4/9] drm/panthor: Parse and store GPU_ID fields Karunika Choo
@ 2026-11-19 15:45 ` Karunika Choo
2026-11-19 15:45 ` [PATCH v4 6/9] drm/panthor: Derive MMU AS register addresses from base and stride Karunika Choo
` (3 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Karunika Choo @ 2026-11-19 15:45 UTC (permalink / raw)
To: dri-devel
Cc: nd, Boris Brezillon, Steven Price, Liviu Dudau, linux-kernel,
Akash Goel, Lukas Zapolskas, Chris Diamand, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Mali v15 reorders several register regions, including GPU_CONTROL,
MCU_CONTROL and PWR_CONTROL, so the driver can no longer assume a single
fixed base layout across all supported GPUs.
Add per-GPU register base offsets to the panthor hardware description
and switch the GPU, FW and PWR local iomem setup to use those stored
values. With the base addresses now owned by the hardware description,
drop the corresponding fixed base-offset definitions from the register
headers.
This prepares the driver for GPUs with different register layouts
without changing the existing behaviour on currently supported parts.
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Karunika Choo <karunika.choo@arm.com>
---
v4:
- Picked up R-b from Boris
v2:
- Picked up R-b from Liviu
v1:
- rebased on drm-misc-next
- use a generic panthor_hw_regbank structure for all register offsets.
drivers/gpu/drm/panthor/panthor_fw.c | 2 +-
drivers/gpu/drm/panthor/panthor_fw_regs.h | 2 --
drivers/gpu/drm/panthor/panthor_gpu.c | 4 +--
drivers/gpu/drm/panthor/panthor_gpu_regs.h | 2 --
drivers/gpu/drm/panthor/panthor_hw.c | 23 +++++++++++++++--
drivers/gpu/drm/panthor/panthor_hw.h | 29 ++++++++++++++++++++--
drivers/gpu/drm/panthor/panthor_pwr.c | 2 +-
drivers/gpu/drm/panthor/panthor_pwr_regs.h | 2 --
8 files changed, 52 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c
index 13efed3a2ea72..679ea1d233d53 100644
--- a/drivers/gpu/drm/panthor/panthor_fw.c
+++ b/drivers/gpu/drm/panthor/panthor_fw.c
@@ -1500,7 +1500,7 @@ int panthor_fw_init(struct panthor_device *ptdev)
if (!fw)
return -ENOMEM;
- fw->iomem = ptdev->iomem + MCU_CONTROL_BASE;
+ fw->iomem = ptdev->iomem + ptdev->hw->regs.mcu_control.offset;
ptdev->fw = fw;
init_waitqueue_head(&fw->req_waitqueue);
INIT_LIST_HEAD(&fw->sections);
diff --git a/drivers/gpu/drm/panthor/panthor_fw_regs.h b/drivers/gpu/drm/panthor/panthor_fw_regs.h
index b2e59cfc22b00..a3492f7f913f9 100644
--- a/drivers/gpu/drm/panthor/panthor_fw_regs.h
+++ b/drivers/gpu/drm/panthor/panthor_fw_regs.h
@@ -4,8 +4,6 @@
#ifndef __PANTHOR_FW_REGS_H__
#define __PANTHOR_FW_REGS_H__
-#define MCU_CONTROL_BASE 0x700
-
#define MCU_CONTROL 0x0
#define MCU_CONTROL_ENABLE 1
#define MCU_CONTROL_AUTO 2
diff --git a/drivers/gpu/drm/panthor/panthor_gpu.c b/drivers/gpu/drm/panthor/panthor_gpu.c
index c5c37f22993d6..ab54119314da0 100644
--- a/drivers/gpu/drm/panthor/panthor_gpu.c
+++ b/drivers/gpu/drm/panthor/panthor_gpu.c
@@ -159,7 +159,7 @@ int panthor_gpu_init(struct panthor_device *ptdev)
if (!gpu)
return -ENOMEM;
- gpu->iomem = ptdev->iomem + GPU_CONTROL_BASE;
+ gpu->iomem = ptdev->iomem + ptdev->hw->regs.gpu_control.offset;
spin_lock_init(&gpu->reqs_lock);
init_waitqueue_head(&gpu->reqs_acked);
mutex_init(&gpu->cache_flush_lock);
@@ -176,7 +176,7 @@ int panthor_gpu_init(struct panthor_device *ptdev)
return irq;
ret = panthor_irq_request(ptdev, &ptdev->gpu->irq, irq,
- ptdev->iomem + GPU_INT_BASE, "gpu",
+ gpu->iomem + GPU_INT_BASE, "gpu",
panthor_gpu_irq_threaded_handler);
if (ret)
return ret;
diff --git a/drivers/gpu/drm/panthor/panthor_gpu_regs.h b/drivers/gpu/drm/panthor/panthor_gpu_regs.h
index c7581b6d4c5be..60819c4ace428 100644
--- a/drivers/gpu/drm/panthor/panthor_gpu_regs.h
+++ b/drivers/gpu/drm/panthor/panthor_gpu_regs.h
@@ -4,8 +4,6 @@
#ifndef __PANTHOR_GPU_REGS_H__
#define __PANTHOR_GPU_REGS_H__
-#define GPU_CONTROL_BASE 0x0
-
#define GPU_ID 0x0
#define GPU_ARCH_MAJOR(x) ((x) >> 28)
#define GPU_ARCH_MINOR(x) (((x) & GENMASK(27, 24)) >> 24)
diff --git a/drivers/gpu/drm/panthor/panthor_hw.c b/drivers/gpu/drm/panthor/panthor_hw.c
index 854874a9f322a..4fe9e6aeadf76 100644
--- a/drivers/gpu/drm/panthor/panthor_hw.c
+++ b/drivers/gpu/drm/panthor/panthor_hw.c
@@ -36,6 +36,14 @@ static struct panthor_hw panthor_hw_arch_v10 = {
.power_changed_off = panthor_gpu_power_changed_off,
.power_changed_on = panthor_gpu_power_changed_on,
},
+ .regs = {
+ .gpu_control = {
+ .offset = 0x0,
+ },
+ .mcu_control = {
+ .offset = 0x700,
+ },
+ },
};
static struct panthor_hw panthor_hw_arch_v14 = {
@@ -44,6 +52,17 @@ static struct panthor_hw panthor_hw_arch_v14 = {
.l2_power_off = panthor_pwr_l2_power_off,
.l2_power_on = panthor_pwr_l2_power_on,
},
+ .regs = {
+ .gpu_control = {
+ .offset = 0x0,
+ },
+ .mcu_control = {
+ .offset = 0x700,
+ },
+ .pwr_control = {
+ .offset = 0x800,
+ },
+ },
};
static struct panthor_hw_entry panthor_hw_match[] = {
@@ -195,7 +214,7 @@ static int panthor_gpu_info_init(struct panthor_device *ptdev)
{
unsigned int i;
- void __iomem *gpu_iomem = ptdev->iomem + GPU_CONTROL_BASE;
+ void __iomem *gpu_iomem = ptdev->iomem + ptdev->hw->regs.gpu_control.offset;
ptdev->gpu_info.csf_id = gpu_read(gpu_iomem, GPU_CSF_ID);
ptdev->gpu_info.gpu_rev = gpu_read(gpu_iomem, GPU_REVID);
@@ -221,7 +240,7 @@ static int panthor_gpu_info_init(struct panthor_device *ptdev)
ptdev->gpu_info.gpu_features = gpu_read64(gpu_iomem, GPU_FEATURES);
if (panthor_hw_has_pwr_ctrl(ptdev)) {
- void __iomem *pwr_iomem = gpu_iomem + PWR_CONTROL_BASE;
+ void __iomem *pwr_iomem = ptdev->iomem + ptdev->hw->regs.pwr_control.offset;
/* Introduced in arch 14.x */
ptdev->gpu_info.l2_present = gpu_read64(pwr_iomem, PWR_L2_PRESENT);
diff --git a/drivers/gpu/drm/panthor/panthor_hw.h b/drivers/gpu/drm/panthor/panthor_hw.h
index c4a490bc39de6..0a82152d772ad 100644
--- a/drivers/gpu/drm/panthor/panthor_hw.h
+++ b/drivers/gpu/drm/panthor/panthor_hw.h
@@ -27,14 +27,39 @@ struct panthor_hw_ops {
void (*power_changed_off)(struct panthor_device *ptdev);
};
+/** struct panthor_hw_regbank - Register offset and instance stride information */
+struct panthor_hw_regbank {
+ /** @offset: Register offset relative to &struct panthor_device.iomem */
+ u32 offset;
+
+ /**
+ * @stride: Register offset between instances, or 0 for non-instanced
+ * registers
+ */
+ u32 stride;
+};
+
+/** struct panthor_hw_regs_layout - Hardware register bank layout */
+struct panthor_hw_regs_layout {
+ /** @gpu_control: GPU_CONTROL register bank layout */
+ struct panthor_hw_regbank gpu_control;
+
+ /** @pwr_control: PWR_CONTROL register bank layout */
+ struct panthor_hw_regbank pwr_control;
+
+ /** @mcu_control: MCU_CONTROL register bank layout */
+ struct panthor_hw_regbank mcu_control;
+};
+
/**
* struct panthor_hw - GPU specific register mapping and functions
*/
struct panthor_hw {
- /** @features: Bitmap containing panthor_hw_feature */
-
/** @ops: Panthor HW specific operations */
struct panthor_hw_ops ops;
+
+ /** @regs: Hardware register bank layout */
+ struct panthor_hw_regs_layout regs;
};
int panthor_hw_init(struct panthor_device *ptdev);
diff --git a/drivers/gpu/drm/panthor/panthor_pwr.c b/drivers/gpu/drm/panthor/panthor_pwr.c
index b1000001325ea..1cfd4b658c81b 100644
--- a/drivers/gpu/drm/panthor/panthor_pwr.c
+++ b/drivers/gpu/drm/panthor/panthor_pwr.c
@@ -502,7 +502,7 @@ int panthor_pwr_init(struct panthor_device *ptdev)
if (!pwr)
return -ENOMEM;
- pwr->iomem = ptdev->iomem + PWR_CONTROL_BASE;
+ pwr->iomem = ptdev->iomem + ptdev->hw->regs.pwr_control.offset;
spin_lock_init(&pwr->reqs_lock);
init_waitqueue_head(&pwr->reqs_acked);
ptdev->pwr = pwr;
diff --git a/drivers/gpu/drm/panthor/panthor_pwr_regs.h b/drivers/gpu/drm/panthor/panthor_pwr_regs.h
index 80d8e1e522298..e1f3153285bd7 100644
--- a/drivers/gpu/drm/panthor/panthor_pwr_regs.h
+++ b/drivers/gpu/drm/panthor/panthor_pwr_regs.h
@@ -4,8 +4,6 @@
#ifndef __PANTHOR_PWR_REGS_H__
#define __PANTHOR_PWR_REGS_H__
-#define PWR_CONTROL_BASE 0x800
-
#define PWR_INT_BASE 0x0
#define PWR_IRQ_POWER_CHANGED_SINGLE BIT(0)
#define PWR_IRQ_POWER_CHANGED_ALL BIT(1)
--
2.43.0
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH v4 6/9] drm/panthor: Derive MMU AS register addresses from base and stride
2026-11-19 15:45 [PATCH v4 0/9] drm/panthor: Add initial Mali v15 support Karunika Choo
` (4 preceding siblings ...)
2026-11-19 15:45 ` [PATCH v4 5/9] drm/panthor: Move register base offsets to the HW description Karunika Choo
@ 2026-11-19 15:45 ` Karunika Choo
2026-11-19 15:45 ` [PATCH v4 7/9] drm/panthor: Skip devfreq when explicitly disabled Karunika Choo
` (2 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Karunika Choo @ 2026-11-19 15:45 UTC (permalink / raw)
To: dri-devel
Cc: nd, Boris Brezillon, Steven Price, Liviu Dudau, linux-kernel,
Akash Goel, Lukas Zapolskas, Chris Diamand, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
Move the MMU address-space register layout into the hardware description
by storing the MMU_AS base offset and per-AS stride in the Panthor HW
map.
Use those values to compute the iomem pointer for each AS slot and make
the MMU AS register definitions relative to the per-slot register window
instead of hard-coding the slot offset in every register macro.
This prepares the MMU code for GPUs where the MMU AS register region is
not at a fixed offset while keeping the existing register accesses
scoped to a single AS window.
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Karunika Choo <karunika.choo@arm.com>
---
v4:
- Picked up R-b from Boris
v2:
- Picked up R-b from Liviu
- Avoid enabling all AS IRQs on init and replace with explicit IRQ clear
to preserve init behaviour. AS IRQs are enabled as part of
panthor_mmu_as_enable(). This also prevents accessing NULL iomem
pointers for initialized AS during init per sashiko's comment.
- Link: https://lore.kernel.org/all/20260922210016.0C0961F000FF@smtp.kernel.org/
v1:
- align with updated panthor_hw_regbank structure.
- moved AS iomem tracking into panthor_as_slot and introduced as_iomem()
to retrieve it.
drivers/gpu/drm/panthor/panthor_hw.c | 8 ++++
drivers/gpu/drm/panthor/panthor_hw.h | 3 ++
drivers/gpu/drm/panthor/panthor_mmu.c | 47 ++++++++++++++--------
drivers/gpu/drm/panthor/panthor_mmu_regs.h | 23 +++++------
4 files changed, 51 insertions(+), 30 deletions(-)
diff --git a/drivers/gpu/drm/panthor/panthor_hw.c b/drivers/gpu/drm/panthor/panthor_hw.c
index 4fe9e6aeadf76..593bf6743d6df 100644
--- a/drivers/gpu/drm/panthor/panthor_hw.c
+++ b/drivers/gpu/drm/panthor/panthor_hw.c
@@ -43,6 +43,10 @@ static struct panthor_hw panthor_hw_arch_v10 = {
.mcu_control = {
.offset = 0x700,
},
+ .mmu_as_control = {
+ .offset = 0x2400,
+ .stride = 0x40,
+ },
},
};
@@ -62,6 +66,10 @@ static struct panthor_hw panthor_hw_arch_v14 = {
.pwr_control = {
.offset = 0x800,
},
+ .mmu_as_control = {
+ .offset = 0x2400,
+ .stride = 0x40,
+ },
},
};
diff --git a/drivers/gpu/drm/panthor/panthor_hw.h b/drivers/gpu/drm/panthor/panthor_hw.h
index 0a82152d772ad..4cb603a3acef6 100644
--- a/drivers/gpu/drm/panthor/panthor_hw.h
+++ b/drivers/gpu/drm/panthor/panthor_hw.h
@@ -49,6 +49,9 @@ struct panthor_hw_regs_layout {
/** @mcu_control: MCU_CONTROL register bank layout */
struct panthor_hw_regbank mcu_control;
+
+ /** @mmu_as_control: MMU_AS_CONTROL register bank layout */
+ struct panthor_hw_regbank mmu_as_control;
};
/**
diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
index d1c29eec46f21..718160c0779ae 100644
--- a/drivers/gpu/drm/panthor/panthor_mmu.c
+++ b/drivers/gpu/drm/panthor/panthor_mmu.c
@@ -35,6 +35,7 @@
#include "panthor_gpu.h"
#include "panthor_gpu_regs.h"
#include "panthor_heap.h"
+#include "panthor_hw.h"
#include "panthor_mmu.h"
#include "panthor_mmu_regs.h"
#include "panthor_sched.h"
@@ -49,15 +50,15 @@ struct panthor_vm;
struct panthor_as_slot {
/** @vm: VM bound to this slot. NULL is no VM is bound. */
struct panthor_vm *vm;
+
+ /** @iomem: CPU mapping for MMU_AS_CONTROL iomem region */
+ void __iomem *iomem;
};
/**
* struct panthor_mmu - MMU related data
*/
struct panthor_mmu {
- /** @iomem: CPU mapping of MMU_AS_CONTROL iomem region */
- void __iomem *iomem;
-
/** @irq: The MMU irq. */
struct panthor_irq irq;
@@ -533,6 +534,11 @@ static void free_pt(void *cookie, void *data, size_t size)
kmem_cache_free(pt_cache, data);
}
+static void __iomem *as_iomem(struct panthor_mmu *mmu, u32 as_nr)
+{
+ return mmu->as.slots[as_nr].iomem;
+}
+
static int wait_ready(struct panthor_device *ptdev, u32 as_nr)
{
struct panthor_mmu *mmu = ptdev->mmu;
@@ -542,7 +548,7 @@ static int wait_ready(struct panthor_device *ptdev, u32 as_nr)
/* Wait for the MMU status to indicate there is no active command, in
* case one is pending.
*/
- ret = gpu_read_relaxed_poll_timeout_atomic(mmu->iomem, AS_STATUS(as_nr), val,
+ ret = gpu_read_relaxed_poll_timeout_atomic(as_iomem(mmu, as_nr), AS_STATUS, val,
!(val & AS_STATUS_AS_ACTIVE), 10, 100000);
if (ret) {
@@ -560,7 +566,7 @@ static int as_send_cmd_and_wait(struct panthor_device *ptdev, u32 as_nr, u32 cmd
/* write AS_COMMAND when MMU is ready to accept another command */
status = wait_ready(ptdev, as_nr);
if (!status) {
- gpu_write(ptdev->mmu->iomem, AS_COMMAND(as_nr), cmd);
+ gpu_write(as_iomem(ptdev->mmu, as_nr), AS_COMMAND, cmd);
status = wait_ready(ptdev, as_nr);
}
@@ -603,9 +609,9 @@ static int panthor_mmu_as_enable(struct panthor_device *ptdev, u32 as_nr,
panthor_irq_enable_events(&ptdev->mmu->irq, MMU_INT_AS_FAULT(as_nr));
- gpu_write64(mmu->iomem, AS_TRANSTAB(as_nr), transtab);
- gpu_write64(mmu->iomem, AS_MEMATTR(as_nr), memattr);
- gpu_write64(mmu->iomem, AS_TRANSCFG(as_nr), transcfg);
+ gpu_write64(as_iomem(mmu, as_nr), AS_TRANSTAB, transtab);
+ gpu_write64(as_iomem(mmu, as_nr), AS_MEMATTR, memattr);
+ gpu_write64(as_iomem(mmu, as_nr), AS_TRANSCFG, transcfg);
return as_send_cmd_and_wait(ptdev, as_nr, AS_COMMAND_UPDATE);
}
@@ -627,9 +633,9 @@ static int panthor_mmu_as_disable(struct panthor_device *ptdev, u32 as_nr)
return ret;
}
- gpu_write64(mmu->iomem, AS_TRANSTAB(as_nr), 0);
- gpu_write64(mmu->iomem, AS_MEMATTR(as_nr), 0);
- gpu_write64(mmu->iomem, AS_TRANSCFG(as_nr), AS_TRANSCFG_ADRMODE_UNMAPPED);
+ gpu_write64(as_iomem(mmu, as_nr), AS_TRANSTAB, 0);
+ gpu_write64(as_iomem(mmu, as_nr), AS_MEMATTR, 0);
+ gpu_write64(as_iomem(mmu, as_nr), AS_TRANSCFG, AS_TRANSCFG_ADRMODE_UNMAPPED);
ret = as_send_cmd_and_wait(ptdev, as_nr, AS_COMMAND_UPDATE);
if (ret)
@@ -1799,7 +1805,7 @@ static int panthor_vm_lock_region(struct panthor_vm *vm, u64 start, u64 size)
mutex_lock(&ptdev->mmu->as.slots_lock);
if (vm->as.id >= 0 && size) {
/* Lock the region that needs to be updated */
- gpu_write64(ptdev->mmu->iomem, AS_LOCKADDR(vm->as.id),
+ gpu_write64(as_iomem(ptdev->mmu, vm->as.id), AS_LOCKADDR,
pack_region_range(ptdev, &start, &size));
/* If the lock succeeded, update the locked_region info. */
@@ -1861,8 +1867,8 @@ static void panthor_mmu_irq_handler(struct panthor_irq *pirq, u32 status)
u32 access_type;
u32 source_id;
- fault_status = gpu_read(mmu->iomem, AS_FAULTSTATUS(as));
- addr = gpu_read64(mmu->iomem, AS_FAULTADDRESS(as));
+ fault_status = gpu_read(as_iomem(mmu, as), AS_FAULTSTATUS);
+ addr = gpu_read64(as_iomem(mmu, as), AS_FAULTADDRESS);
/* decode the fault status */
exception_type = fault_status & 0xFF;
@@ -3429,8 +3435,11 @@ static void panthor_mmu_info_init(struct panthor_device *ptdev)
int panthor_mmu_init(struct panthor_device *ptdev)
{
u32 va_bits = GPU_MMU_FEATURES_VA_BITS(ptdev->gpu_info.mmu_features);
+ unsigned long as_present_mask = ptdev->gpu_info.as_present;
+ struct panthor_hw_regbank *regbank = &ptdev->hw->regs.mmu_as_control;
struct panthor_mmu *mmu;
int ret, irq;
+ u32 as_id;
panthor_mmu_info_init(ptdev);
@@ -3449,7 +3458,13 @@ int panthor_mmu_init(struct panthor_device *ptdev)
if (ret)
return ret;
- mmu->iomem = ptdev->iomem + MMU_AS_BASE;
+ for_each_set_bit(as_id, &as_present_mask, MAX_AS_SLOTS) {
+ u64 offset = regbank->offset + (regbank->stride * as_id);
+
+ guard(mutex)(&mmu->as.slots_lock);
+ mmu->as.slots[as_id].iomem = ptdev->iomem + offset;
+ }
+
ptdev->mmu = mmu;
irq = platform_get_irq_byname(to_platform_device(ptdev->base.dev), "mmu");
@@ -3479,7 +3494,7 @@ int panthor_mmu_init(struct panthor_device *ptdev)
if (ret)
return ret;
- panthor_irq_enable_events(&mmu->irq, panthor_mmu_fault_mask(ptdev, ~0));
+ gpu_write(mmu->irq.iomem, INT_CLEAR, panthor_mmu_fault_mask(ptdev, ~0));
panthor_irq_resume(&mmu->irq);
return 0;
}
diff --git a/drivers/gpu/drm/panthor/panthor_mmu_regs.h b/drivers/gpu/drm/panthor/panthor_mmu_regs.h
index 1ec7f5ef2b196..82661283b46ab 100644
--- a/drivers/gpu/drm/panthor/panthor_mmu_regs.h
+++ b/drivers/gpu/drm/panthor/panthor_mmu_regs.h
@@ -11,13 +11,8 @@
/* AS_COMMAND register commands */
-#define MMU_AS_BASE 0x2400
-
-#define MMU_AS_SHIFT 6
-#define MMU_AS(as) ((as) << MMU_AS_SHIFT)
-
-#define AS_TRANSTAB(as) (MMU_AS(as) + 0x0)
-#define AS_MEMATTR(as) (MMU_AS(as) + 0x8)
+#define AS_TRANSTAB 0x0
+#define AS_MEMATTR 0x8
#define AS_MEMATTR_AARCH64_INNER_ALLOC_IMPL (2 << 2)
#define AS_MEMATTR_AARCH64_INNER_ALLOC_EXPL(w, r) ((3 << 2) | \
((w) ? BIT(0) : 0) | \
@@ -29,8 +24,8 @@
#define AS_MEMATTR_AARCH64_INNER_OUTER_NC (1 << 6)
#define AS_MEMATTR_AARCH64_INNER_OUTER_WB (2 << 6)
#define AS_MEMATTR_AARCH64_FAULT (3 << 6)
-#define AS_LOCKADDR(as) (MMU_AS(as) + 0x10)
-#define AS_COMMAND(as) (MMU_AS(as) + 0x18)
+#define AS_LOCKADDR 0x10
+#define AS_COMMAND 0x18
#define AS_COMMAND_NOP 0
#define AS_COMMAND_UPDATE 1
#define AS_COMMAND_LOCK 2
@@ -38,16 +33,16 @@
#define AS_COMMAND_FLUSH_PT 4
#define AS_COMMAND_FLUSH_MEM 5
#define AS_LOCK_REGION_MIN_SIZE (1ULL << 15)
-#define AS_FAULTSTATUS(as) (MMU_AS(as) + 0x1C)
+#define AS_FAULTSTATUS 0x1C
#define AS_FAULTSTATUS_ACCESS_TYPE_MASK (0x3 << 8)
#define AS_FAULTSTATUS_ACCESS_TYPE_ATOMIC (0x0 << 8)
#define AS_FAULTSTATUS_ACCESS_TYPE_EX (0x1 << 8)
#define AS_FAULTSTATUS_ACCESS_TYPE_READ (0x2 << 8)
#define AS_FAULTSTATUS_ACCESS_TYPE_WRITE (0x3 << 8)
-#define AS_FAULTADDRESS(as) (MMU_AS(as) + 0x20)
-#define AS_STATUS(as) (MMU_AS(as) + 0x28)
+#define AS_FAULTADDRESS 0x20
+#define AS_STATUS 0x28
#define AS_STATUS_AS_ACTIVE BIT(0)
-#define AS_TRANSCFG(as) (MMU_AS(as) + 0x30)
+#define AS_TRANSCFG 0x30
#define AS_TRANSCFG_ADRMODE_UNMAPPED (1 << 0)
#define AS_TRANSCFG_ADRMODE_IDENTITY (2 << 0)
#define AS_TRANSCFG_ADRMODE_AARCH64_4K (6 << 0)
@@ -65,6 +60,6 @@
#define AS_TRANSCFG_DISABLE_AF_FAULT BIT(34)
#define AS_TRANSCFG_WXN BIT(35)
#define AS_TRANSCFG_XREADABLE BIT(36)
-#define AS_FAULTEXTRA(as) (MMU_AS(as) + 0x38)
+#define AS_FAULTEXTRA 0x38
#endif /* __PANTHOR_MMU_REGS_H__ */
--
2.43.0
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH v4 7/9] drm/panthor: Skip devfreq when explicitly disabled
2026-11-19 15:45 [PATCH v4 0/9] drm/panthor: Add initial Mali v15 support Karunika Choo
` (5 preceding siblings ...)
2026-11-19 15:45 ` [PATCH v4 6/9] drm/panthor: Derive MMU AS register addresses from base and stride Karunika Choo
@ 2026-11-19 15:45 ` Karunika Choo
2026-11-19 16:01 ` Boris Brezillon
2026-11-19 15:45 ` [PATCH v4 8/9] dt-bindings: gpu: mali-gen5-am: Add Mali 5th-Gen AM schema Karunika Choo
2026-11-19 15:45 ` [PATCH v4 9/9] drm/panthor: Add Mali v15 hardware support Karunika Choo
8 siblings, 1 reply; 12+ messages in thread
From: Karunika Choo @ 2026-11-19 15:45 UTC (permalink / raw)
To: dri-devel
Cc: nd, Boris Brezillon, Steven Price, Liviu Dudau, linux-kernel,
Akash Goel, Lukas Zapolskas, Chris Diamand, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
On Mali v15 AM systems, frequency scaling is handled outside panthor by
the AM_GOVERNOR block, so the GPU DT node may not provide an OPP table.
Add generic devfreq_disabled field to panthor_soc_data to allow
disabling of devfreq for other use GPUs and make panthor_devfreq_init()
return early when this flag is set. Ensure frequency can be queried
without devfreq instance and omit drm-maxfreq-panthor from fdinfo when
the maximum frequency is unknown.
Signed-off-by: Karunika Choo <karunika.choo@arm.com>
---
v4:
- Use panthor_soc_data flags instead of compatible to allow earlier GPUs
to also disable devfreq. Resetting R-bs as a result.
v3:
- Omit drm-maxfreq-panthor from fdinfo when the maximum frequency
is unknown, as on AM systems without an OPP table.
v2:
- Directly call functions instead of storing function pointers.
- Picked up R-b from Liviu
v1:
- Only skip panthor_devfreq init when OPP lookup returns -ENODEV instead
of direct DT-property check.
- Support frequency query without devfreq.
drivers/gpu/drm/panthor/panthor_devfreq.c | 9 +++++++--
drivers/gpu/drm/panthor/panthor_device.h | 3 +++
drivers/gpu/drm/panthor/panthor_drv.c | 5 ++++-
drivers/gpu/drm/panthor/panthor_hw.h | 10 ++++++++++
4 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/panthor/panthor_devfreq.c b/drivers/gpu/drm/panthor/panthor_devfreq.c
index 2249b41ca4afe..8b215e24b02c3 100644
--- a/drivers/gpu/drm/panthor/panthor_devfreq.c
+++ b/drivers/gpu/drm/panthor/panthor_devfreq.c
@@ -12,6 +12,7 @@
#include "panthor_devfreq.h"
#include "panthor_device.h"
+#include "panthor_hw.h"
/**
* struct panthor_devfreq - Device frequency management
@@ -154,6 +155,9 @@ int panthor_devfreq_init(struct panthor_device *ptdev)
ptdev->devfreq = pdevfreq;
+ if (panthor_hw_is_devfreq_disabled(ptdev))
+ return 0;
+
/*
* The power domain associated with the GPU may have already added an
* OPP table, complete with OPPs, as part of the platform bus
@@ -324,9 +328,10 @@ unsigned long panthor_devfreq_get_freq(struct panthor_device *ptdev)
int ret;
if (!pdevfreq->devfreq)
- return 0;
+ ret = panthor_devfreq_get_cur_freq(ptdev->base.dev, &freq);
+ else
+ ret = pdevfreq->devfreq->profile->get_cur_freq(ptdev->base.dev, &freq);
- ret = pdevfreq->devfreq->profile->get_cur_freq(ptdev->base.dev, &freq);
if (ret)
return 0;
diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h
index f0a96ff0f13da..31f9341b5aeda 100644
--- a/drivers/gpu/drm/panthor/panthor_device.h
+++ b/drivers/gpu/drm/panthor/panthor_device.h
@@ -45,6 +45,9 @@ struct panthor_soc_data {
/** @asn_hash: ASN_HASH values when asn_hash_enable is true. */
u32 asn_hash[3];
+
+ /** @devfreq_disabled: True if devfreq is handled external to Panthor */
+ bool devfreq_disabled;
};
/**
diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
index dc8d0191aef42..b4d3d339b04b4 100644
--- a/drivers/gpu/drm/panthor/panthor_drv.c
+++ b/drivers/gpu/drm/panthor/panthor_drv.c
@@ -1715,7 +1715,10 @@ static void panthor_gpu_show_fdinfo(struct panthor_device *ptdev,
if (ptdev->profile_mask & PANTHOR_DEVICE_PROFILING_CYCLES)
drm_printf(p, "drm-cycles-panthor:\t%llu\n", pfile->stats.cycles);
- drm_printf(p, "drm-maxfreq-panthor:\t%lu Hz\n", ptdev->fast_rate);
+ /* Omit the maximum frequency when it is unknown */
+ if (ptdev->fast_rate)
+ drm_printf(p, "drm-maxfreq-panthor:\t%lu Hz\n", ptdev->fast_rate);
+
drm_printf(p, "drm-curfreq-panthor:\t%lu Hz\n",
panthor_devfreq_get_freq(ptdev));
}
diff --git a/drivers/gpu/drm/panthor/panthor_hw.h b/drivers/gpu/drm/panthor/panthor_hw.h
index 4cb603a3acef6..f93a6b16df2af 100644
--- a/drivers/gpu/drm/panthor/panthor_hw.h
+++ b/drivers/gpu/drm/panthor/panthor_hw.h
@@ -95,4 +95,14 @@ static inline bool panthor_hw_has_neural(struct panthor_device *ptdev)
ptdev->gpu_info.gpu_features & GPU_FEATURES_NX);
}
+static inline bool panthor_hw_is_devfreq_disabled(struct panthor_device *ptdev)
+{
+ const struct panthor_soc_data *data = ptdev->soc_data;
+
+ if (!data)
+ return false;
+
+ return data->devfreq_disabled;
+}
+
#endif /* __PANTHOR_HW_H__ */
--
2.43.0
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH v4 7/9] drm/panthor: Skip devfreq when explicitly disabled
2026-11-19 15:45 ` [PATCH v4 7/9] drm/panthor: Skip devfreq when explicitly disabled Karunika Choo
@ 2026-11-19 16:01 ` Boris Brezillon
0 siblings, 0 replies; 12+ messages in thread
From: Boris Brezillon @ 2026-11-19 16:01 UTC (permalink / raw)
To: Karunika Choo
Cc: dri-devel, nd, Steven Price, Liviu Dudau, linux-kernel,
Akash Goel, Lukas Zapolskas, Chris Diamand, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
On Thu, 19 Nov 2026 15:45:57 +0000
Karunika Choo <karunika.choo@arm.com> wrote:
> On Mali v15 AM systems, frequency scaling is handled outside panthor by
> the AM_GOVERNOR block, so the GPU DT node may not provide an OPP table.
>
> Add generic devfreq_disabled field to panthor_soc_data to allow
> disabling of devfreq for other use GPUs and make panthor_devfreq_init()
> return early when this flag is set. Ensure frequency can be queried
> without devfreq instance and omit drm-maxfreq-panthor from fdinfo when
> the maximum frequency is unknown.
>
> Signed-off-by: Karunika Choo <karunika.choo@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> v4:
> - Use panthor_soc_data flags instead of compatible to allow earlier GPUs
> to also disable devfreq. Resetting R-bs as a result.
> v3:
> - Omit drm-maxfreq-panthor from fdinfo when the maximum frequency
> is unknown, as on AM systems without an OPP table.
> v2:
> - Directly call functions instead of storing function pointers.
> - Picked up R-b from Liviu
> v1:
> - Only skip panthor_devfreq init when OPP lookup returns -ENODEV instead
> of direct DT-property check.
> - Support frequency query without devfreq.
>
> drivers/gpu/drm/panthor/panthor_devfreq.c | 9 +++++++--
> drivers/gpu/drm/panthor/panthor_device.h | 3 +++
> drivers/gpu/drm/panthor/panthor_drv.c | 5 ++++-
> drivers/gpu/drm/panthor/panthor_hw.h | 10 ++++++++++
> 4 files changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_devfreq.c b/drivers/gpu/drm/panthor/panthor_devfreq.c
> index 2249b41ca4afe..8b215e24b02c3 100644
> --- a/drivers/gpu/drm/panthor/panthor_devfreq.c
> +++ b/drivers/gpu/drm/panthor/panthor_devfreq.c
> @@ -12,6 +12,7 @@
>
> #include "panthor_devfreq.h"
> #include "panthor_device.h"
> +#include "panthor_hw.h"
>
> /**
> * struct panthor_devfreq - Device frequency management
> @@ -154,6 +155,9 @@ int panthor_devfreq_init(struct panthor_device *ptdev)
>
> ptdev->devfreq = pdevfreq;
>
> + if (panthor_hw_is_devfreq_disabled(ptdev))
> + return 0;
> +
> /*
> * The power domain associated with the GPU may have already added an
> * OPP table, complete with OPPs, as part of the platform bus
> @@ -324,9 +328,10 @@ unsigned long panthor_devfreq_get_freq(struct panthor_device *ptdev)
> int ret;
>
> if (!pdevfreq->devfreq)
> - return 0;
> + ret = panthor_devfreq_get_cur_freq(ptdev->base.dev, &freq);
> + else
> + ret = pdevfreq->devfreq->profile->get_cur_freq(ptdev->base.dev, &freq);
>
> - ret = pdevfreq->devfreq->profile->get_cur_freq(ptdev->base.dev, &freq);
> if (ret)
> return 0;
>
> diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h
> index f0a96ff0f13da..31f9341b5aeda 100644
> --- a/drivers/gpu/drm/panthor/panthor_device.h
> +++ b/drivers/gpu/drm/panthor/panthor_device.h
> @@ -45,6 +45,9 @@ struct panthor_soc_data {
>
> /** @asn_hash: ASN_HASH values when asn_hash_enable is true. */
> u32 asn_hash[3];
> +
> + /** @devfreq_disabled: True if devfreq is handled external to Panthor */
> + bool devfreq_disabled;
> };
>
> /**
> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> index dc8d0191aef42..b4d3d339b04b4 100644
> --- a/drivers/gpu/drm/panthor/panthor_drv.c
> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> @@ -1715,7 +1715,10 @@ static void panthor_gpu_show_fdinfo(struct panthor_device *ptdev,
> if (ptdev->profile_mask & PANTHOR_DEVICE_PROFILING_CYCLES)
> drm_printf(p, "drm-cycles-panthor:\t%llu\n", pfile->stats.cycles);
>
> - drm_printf(p, "drm-maxfreq-panthor:\t%lu Hz\n", ptdev->fast_rate);
> + /* Omit the maximum frequency when it is unknown */
> + if (ptdev->fast_rate)
> + drm_printf(p, "drm-maxfreq-panthor:\t%lu Hz\n", ptdev->fast_rate);
> +
> drm_printf(p, "drm-curfreq-panthor:\t%lu Hz\n",
> panthor_devfreq_get_freq(ptdev));
> }
> diff --git a/drivers/gpu/drm/panthor/panthor_hw.h b/drivers/gpu/drm/panthor/panthor_hw.h
> index 4cb603a3acef6..f93a6b16df2af 100644
> --- a/drivers/gpu/drm/panthor/panthor_hw.h
> +++ b/drivers/gpu/drm/panthor/panthor_hw.h
> @@ -95,4 +95,14 @@ static inline bool panthor_hw_has_neural(struct panthor_device *ptdev)
> ptdev->gpu_info.gpu_features & GPU_FEATURES_NX);
> }
>
> +static inline bool panthor_hw_is_devfreq_disabled(struct panthor_device *ptdev)
> +{
> + const struct panthor_soc_data *data = ptdev->soc_data;
> +
> + if (!data)
> + return false;
> +
> + return data->devfreq_disabled;
> +}
> +
> #endif /* __PANTHOR_HW_H__ */
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v4 8/9] dt-bindings: gpu: mali-gen5-am: Add Mali 5th-Gen AM schema
2026-11-19 15:45 [PATCH v4 0/9] drm/panthor: Add initial Mali v15 support Karunika Choo
` (6 preceding siblings ...)
2026-11-19 15:45 ` [PATCH v4 7/9] drm/panthor: Skip devfreq when explicitly disabled Karunika Choo
@ 2026-11-19 15:45 ` Karunika Choo
2026-11-19 15:45 ` [PATCH v4 9/9] drm/panthor: Add Mali v15 hardware support Karunika Choo
8 siblings, 0 replies; 12+ messages in thread
From: Karunika Choo @ 2026-11-19 15:45 UTC (permalink / raw)
To: dri-devel
Cc: nd, Boris Brezillon, Steven Price, Liviu Dudau, linux-kernel,
Akash Goel, Lukas Zapolskas, Chris Diamand, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree
Add a separate device-tree schema for Mali 5th-Gen AM GPUs.
AM_GOVERNOR controls GPU frequency. The GPU node does not accept OPP,
cooling or GPU supply properties.
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Karunika Choo <karunika.choo@arm.com>
---
v4:
- Pick up Ack from Boris
v3:
- Drop the $nodename constraint from the AM GPU binding.
- Require the arm,zena-css-mali integration compatible followed by
the arm,mali-gen5-am fallback.
- Update the binding example to use the new compatible, three-cell
interrupt specifiers, and a single GPU clock.
v2:
- Move arm,mali-gen5-am support from arm,mali-valhall-csf.yaml to a
separate arm,mali-gen5-am.yaml schema.
- Move the AM GPU example to the new schema and add the interrupt
binding headers.
- Add the new schema to the Panthor MAINTAINERS entry.
.../bindings/gpu/arm,mali-gen5-am.yaml | 89 +++++++++++++++++++
MAINTAINERS | 1 +
2 files changed, 90 insertions(+)
create mode 100644 Documentation/devicetree/bindings/gpu/arm,mali-gen5-am.yaml
diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-gen5-am.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-gen5-am.yaml
new file mode 100644
index 0000000000000..af758daec2aeb
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-gen5-am.yaml
@@ -0,0 +1,89 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpu/arm,mali-gen5-am.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ARM Mali 5th Gen AM GPU
+
+maintainers:
+ - Liviu Dudau <liviu.dudau@arm.com>
+ - Boris Brezillon <boris.brezillon@collabora.com>
+
+properties:
+ compatible:
+ items:
+ - enum:
+ - arm,zena-css-mali
+ - const: arm,mali-gen5-am
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ items:
+ - description: Job interrupt
+ - description: MMU interrupt
+ - description: GPU interrupt
+
+ interrupt-names:
+ items:
+ - const: job
+ - const: mmu
+ - const: gpu
+
+ clocks:
+ minItems: 1
+ maxItems: 3
+
+ clock-names:
+ minItems: 1
+ items:
+ - const: core
+ - enum:
+ - coregroup
+ - stacks
+ - const: stacks
+
+ nvmem-cells:
+ items:
+ - description: bitmask of functional shader cores
+
+ nvmem-cell-names:
+ items:
+ - const: shader-present
+
+ power-domains:
+ minItems: 1
+ maxItems: 5
+
+ power-domain-names:
+ minItems: 1
+ maxItems: 5
+
+ dma-coherent: true
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - interrupt-names
+ - clocks
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+ gpu@100000 {
+ compatible = "arm,zena-css-mali", "arm,mali-gen5-am";
+ reg = <0x100000 0x480000>;
+ interrupts = <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "job", "mmu", "gpu";
+ clocks = <&gpu_clk>;
+ };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index bcade5bfbafe9..93ee837af9958 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2404,6 +2404,7 @@ R: Chris Diamand <chris.diamand@arm.com>
L: dri-devel@lists.freedesktop.org
S: Supported
T: git https://gitlab.freedesktop.org/drm/misc/kernel.git
+F: Documentation/devicetree/bindings/gpu/arm,mali-gen5-am*.yaml
F: Documentation/devicetree/bindings/gpu/arm,mali-valhall-csf.yaml
F: drivers/gpu/drm/ci/xfails/panthor*
F: drivers/gpu/drm/panthor/
--
2.43.0
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH v4 9/9] drm/panthor: Add Mali v15 hardware support
2026-11-19 15:45 [PATCH v4 0/9] drm/panthor: Add initial Mali v15 support Karunika Choo
` (7 preceding siblings ...)
2026-11-19 15:45 ` [PATCH v4 8/9] dt-bindings: gpu: mali-gen5-am: Add Mali 5th-Gen AM schema Karunika Choo
@ 2026-11-19 15:45 ` Karunika Choo
2026-11-19 16:06 ` Boris Brezillon
8 siblings, 1 reply; 12+ messages in thread
From: Karunika Choo @ 2026-11-19 15:45 UTC (permalink / raw)
To: dri-devel
Cc: nd, Boris Brezillon, Steven Price, Liviu Dudau, linux-kernel,
Akash Goel, Lukas Zapolskas, Chris Diamand, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Daniel Almeida, Alice Ryhl, rust-for-linux
Add the panthor hardware description for Mali v15 GPUs and hook it into
device matching.
This includes the v15 register map and product identification needed to
populate the GPU information exposed by the driver and its uAPI, as well
as add compatibility string for v15 GPUs.
Mali v15 also exposes a 64-bit GPU_ID register with a different field
layout from earlier GPUs. Add the register definitions and decoding
helpers for the new format, read GPU_ID_WIDE when the compatibility
value indicates a v15 GPU, and populate both the cached GPU_ID fields
and the uAPI gpu_id_wide field.
Bump drm minor to 10.
Signed-off-by: Karunika Choo <karunika.choo@arm.com>
---
v4:
- squashed 64-bit GPU_ID decoding into this patch. Resetting R-bs as
a result.
v2:
- check as_count is non-zero before generating as_present mask per
sashiko's comment.
- Link: https://lore.kernel.org/all/20260922205812.C473B1F000FF@smtp.kernel.org/
- clean up l2_features value assignment.
- removed duplicated GPU_FEATURES macro definitions
- Picked up R-b from Liviu
v1:
- make COHERENCY_FEATURES register read use cached gpu_info values.
- Added Mali-G2 name variants and NX aware model identification.
- fix premature reading of l2_features gpu_info field during
panthor_hw_info_init().
- build as_present using GENMASK.
64-bit GPU_ID:
v3:
- Fix the missing blank line after declarations in GPU_ID decoding.
v2:
- Picked up R-b from Liviu.
- Rename the register macro from GPU_WIDE_ID to GPU_ID_WIDE.
- Rename the uAPI field from gpu_wide_id to gpu_id_wide.
- Print the upper 32 bits of GPU_ID_WIDE as the logged 'id' for v15 and
later GPUs. Keep the existing output for earlier GPUs. Continuation
fix for previous sashiko comment.
- Link: https://lore.kernel.org/all/20260922205659.3C4F21F000FF@smtp.kernel.org/
v1:
- Decode selected GPU_ID format after checking compatibility value.
- Document GPU_DISCOVER and GPU_CONTROL register offset differences
between GPUs.
- Fix mask generation in panthor_gpu_discover_regs.h
drivers/gpu/drm/panthor/panthor_drv.c | 9 +-
drivers/gpu/drm/panthor/panthor_fw.c | 1 +
drivers/gpu/drm/panthor/panthor_gpu.c | 3 +-
.../drm/panthor/panthor_gpu_discover_regs.h | 42 +++++
drivers/gpu/drm/panthor/panthor_heap.c | 3 +-
drivers/gpu/drm/panthor/panthor_hw.c | 159 ++++++++++++++++--
drivers/gpu/drm/panthor/panthor_hw.h | 13 ++
include/uapi/drm/panthor_drm.h | 23 ++-
8 files changed, 230 insertions(+), 23 deletions(-)
create mode 100644 drivers/gpu/drm/panthor/panthor_gpu_discover_regs.h
diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
index b4d3d339b04b4..94320799d5d75 100644
--- a/drivers/gpu/drm/panthor/panthor_drv.c
+++ b/drivers/gpu/drm/panthor/panthor_drv.c
@@ -1788,6 +1788,8 @@ static void panthor_debugfs_init(struct drm_minor *minor)
* - 1.8 - extends DEV_QUERY_TIMESTAMP_INFO with flags
* - 1.9 - adds DRM_PANTHOR_DEV_QUERY_MMU_INFO query
* - adds DRM_PANTHOR_VM_BIND_OP_MAP_SPARSE flag
+ * - 1.10 - adds thread_num_active_granularity, gpu_rev_wide, l2_features_wide,
+ * and gpu_id_wide to drm_panthor_gpu_info
*/
static const struct drm_driver panthor_drm_driver = {
.driver_features = DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ |
@@ -1801,7 +1803,7 @@ static const struct drm_driver panthor_drm_driver = {
.name = "panthor",
.desc = "Panthor DRM driver",
.major = 1,
- .minor = 9,
+ .minor = 10,
.gem_prime_import_sg_table = panthor_gem_prime_import_sg_table,
.gem_prime_import = panthor_gem_prime_import,
@@ -1880,10 +1882,15 @@ static const struct panthor_soc_data soc_data_mediatek_mt8196 = {
.asn_hash = { 0xb, 0xe, 0x0, },
};
+static const struct panthor_soc_data soc_data_gen5_am = {
+ .devfreq_disabled = true,
+};
+
static const struct of_device_id dt_match[] = {
{ .compatible = "mediatek,mt8196-mali", .data = &soc_data_mediatek_mt8196, },
{ .compatible = "rockchip,rk3588-mali" },
{ .compatible = "arm,mali-valhall-csf" },
+ { .compatible = "arm,mali-gen5-am", .data = &soc_data_gen5_am, },
{}
};
MODULE_DEVICE_TABLE(of, dt_match);
diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c
index 679ea1d233d53..1449d9a66302e 100644
--- a/drivers/gpu/drm/panthor/panthor_fw.c
+++ b/drivers/gpu/drm/panthor/panthor_fw.c
@@ -1563,3 +1563,4 @@ MODULE_FIRMWARE("arm/mali/arch11.8/mali_csffw.bin");
MODULE_FIRMWARE("arm/mali/arch12.8/mali_csffw.bin");
MODULE_FIRMWARE("arm/mali/arch13.8/mali_csffw.bin");
MODULE_FIRMWARE("arm/mali/arch14.8/mali_csffw.bin");
+MODULE_FIRMWARE("arm/mali/arch15.8/mali_csffw.bin");
diff --git a/drivers/gpu/drm/panthor/panthor_gpu.c b/drivers/gpu/drm/panthor/panthor_gpu.c
index ab54119314da0..2e1b00e86cdea 100644
--- a/drivers/gpu/drm/panthor/panthor_gpu.c
+++ b/drivers/gpu/drm/panthor/panthor_gpu.c
@@ -503,8 +503,7 @@ int panthor_gpu_coherency_init(struct panthor_device *ptdev)
/* Check if the ACE-Lite coherency protocol is actually supported by the GPU.
* ACE protocol has never been supported for command stream frontend GPUs.
*/
- if ((gpu_read(ptdev->gpu->iomem, GPU_COHERENCY_FEATURES) &
- GPU_COHERENCY_PROT_BIT(ACE_LITE))) {
+ if ((ptdev->gpu_info.coherency_features & GPU_COHERENCY_PROT_BIT(ACE_LITE))) {
ptdev->gpu_info.selected_coherency = GPU_COHERENCY_ACE_LITE;
return 0;
}
diff --git a/drivers/gpu/drm/panthor/panthor_gpu_discover_regs.h b/drivers/gpu/drm/panthor/panthor_gpu_discover_regs.h
new file mode 100644
index 0000000000000..05e90950ec6ad
--- /dev/null
+++ b/drivers/gpu/drm/panthor/panthor_gpu_discover_regs.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: GPL-2.0 or MIT */
+/* Copyright 2026 ARM Limited. All rights reserved. */
+
+#ifndef __PANTHOR_GPU_DISCOVER_REGS_H__
+#define __PANTHOR_GPU_DISCOVER_REGS_H__
+
+#include <linux/bits.h>
+
+#define GPU_ID_WIDE 0x0
+#define GPU_WIDE_COMPAT 0xF
+#define GPU_WIDE_ARCH_MAJOR(x) (((x) & GENMASK_U64(63, 56)) >> 56)
+#define GPU_WIDE_ARCH_MINOR(x) (((x) & GENMASK_U64(55, 48)) >> 48)
+#define GPU_WIDE_ARCH_REV(x) (((x) & GENMASK_U64(47, 40)) >> 40)
+#define GPU_WIDE_PROD_MAJOR(x) (((x) & GENMASK_U64(39, 32)) >> 32)
+#define GPU_WIDE_VER_MAJOR(x) (((x) & GENMASK_U64(23, 16)) >> 16)
+#define GPU_WIDE_VER_MINOR(x) (((x) & GENMASK_U64(15, 8)) >> 8)
+#define GPU_WIDE_VER_STATUS(x) ((x) & GENMASK_U64(7, 0))
+
+#define DISCOVER_REVIDR 0x8
+#define DISCOVER_GPU_FEATURES 0x20
+#define GPU_FEATURES_VARIABLE_RATE_SHADING BIT(0)
+#define GPU_FEATURES_SIMD_STATE BIT(1)
+#define GPU_FEATURES_CROSS_STREAM_SYNC BIT(3)
+#define GPU_FEATURES_LD_LEA_TENSOR_INSTRUCTIONS BIT(6)
+#define DISCOVER_MCU_FEATURES 0x40
+#define DISCOVER_PRFCNT_FEATURES 0x50
+#define PRFCNT_FEATURES_COUNTER_BLOCK_SIZE(x) (((x) & GENMASK(7, 0)) << 8)
+#define DISCOVER_DOORBELL_FEATURES 0x60
+#define DISCOVER_MEM_FEATURES 0x100
+#define DISCOVER_MMU_FEATURES 0x108
+#define MMU_FEATURES_AS_COUNT(x) (((x) & GENMASK(23, 16)) >> 16)
+#define DISCOVER_AMBA_FEATURES 0x120
+
+#define DISCOVER_L2_FEATURES 0x128
+#define DISCOVER_TILER_FEATURES 0x200
+#define DISCOVER_CORE_FEATURES 0x300
+#define DISCOVER_THREAD_FEATURES 0x320
+#define DISCOVER_THREAD_MAX_THREADS 0x330
+#define DISCOVER_THREAD_NUM_ACTIVE_GRANULARITY 0x334
+#define DISCOVER_TEXTURE_FEATURES 0x360
+
+#endif /* __PANTHOR_GPU_DISCOVER_REGS_H__ */
diff --git a/drivers/gpu/drm/panthor/panthor_heap.c b/drivers/gpu/drm/panthor/panthor_heap.c
index 99311abdf1e91..afb7d68abc874 100644
--- a/drivers/gpu/drm/panthor/panthor_heap.c
+++ b/drivers/gpu/drm/panthor/panthor_heap.c
@@ -11,6 +11,7 @@
#include "panthor_gem.h"
#include "panthor_gpu_regs.h"
#include "panthor_heap.h"
+#include "panthor_hw.h"
#include "panthor_mmu.h"
/*
@@ -105,7 +106,7 @@ struct panthor_heap_pool {
static int panthor_heap_ctx_stride(struct panthor_device *ptdev)
{
- u32 l2_features = ptdev->gpu_info.l2_features;
+ u64 l2_features = panthor_hw_get_l2_features(ptdev);
u32 gpu_cache_line_size = GPU_L2_FEATURES_LINE_SIZE(l2_features);
return ALIGN(HEAP_CONTEXT_SIZE, gpu_cache_line_size);
diff --git a/drivers/gpu/drm/panthor/panthor_hw.c b/drivers/gpu/drm/panthor/panthor_hw.c
index 593bf6743d6df..fc81fabbe62fd 100644
--- a/drivers/gpu/drm/panthor/panthor_hw.c
+++ b/drivers/gpu/drm/panthor/panthor_hw.c
@@ -1,13 +1,16 @@
// SPDX-License-Identifier: GPL-2.0 or MIT
/* Copyright 2025 ARM Limited. All rights reserved. */
+#include <linux/bits.h>
#include <linux/nvmem-consumer.h>
#include <linux/platform_device.h>
+#include <linux/wordpart.h>
#include <drm/drm_print.h>
#include "panthor_device.h"
#include "panthor_gpu.h"
+#include "panthor_gpu_discover_regs.h"
#include "panthor_gpu_regs.h"
#include "panthor_hw.h"
#include "panthor_pwr.h"
@@ -73,6 +76,29 @@ static struct panthor_hw panthor_hw_arch_v14 = {
},
};
+static struct panthor_hw panthor_hw_arch_v15 = {
+ .ops = {
+ .soft_reset = panthor_pwr_reset_soft,
+ .l2_power_off = panthor_pwr_l2_power_off,
+ .l2_power_on = panthor_pwr_l2_power_on,
+ },
+ .regs = {
+ .gpu_control = {
+ .offset = 0x3000,
+ },
+ .mcu_control = {
+ .offset = 0x3100,
+ },
+ .pwr_control = {
+ .offset = 0x3800,
+ },
+ .mmu_as_control = {
+ .offset = 0x2800,
+ .stride = 0x80,
+ },
+ },
+};
+
static struct panthor_hw_entry panthor_hw_match[] = {
{
.arch_min = 10,
@@ -84,6 +110,11 @@ static struct panthor_hw_entry panthor_hw_match[] = {
.arch_max = 14,
.hwdev = &panthor_hw_arch_v14,
},
+ {
+ .arch_min = 15,
+ .arch_max = 15,
+ .hwdev = &panthor_hw_arch_v15,
+ }
};
static int panthor_hw_set_power_tracing(struct device *dev, void *data)
@@ -151,8 +182,11 @@ static char *get_gpu_model_name(struct panthor_device *ptdev)
gpu_id->prod_major);
const bool ray_intersection = !!(ptdev->gpu_info.gpu_features &
GPU_FEATURES_RAY_INTERSECTION);
+ const bool neural_present = !!(ptdev->gpu_info.gpu_features &
+ GPU_FEATURES_NX);
const u8 shader_core_count = hweight64(ptdev->gpu_info.shader_present);
+
switch (product_id) {
case GPU_PROD_ID_MAKE(10, 2):
return "Mali-G710";
@@ -195,6 +229,18 @@ static char *get_gpu_model_name(struct panthor_device *ptdev)
return "Mali-G1-Premium";
case GPU_PROD_ID_MAKE(14, 3):
return "Mali-G1-Pro";
+ case GPU_PROD_ID_MAKE(15, 0):
+ return "Mali-G2-Ultra-NX";
+ case GPU_PROD_ID_MAKE(15, 1):
+ if (neural_present)
+ return "Mali-G2-Premium-NX";
+
+ return "Mali-G2-Premium";
+ case GPU_PROD_ID_MAKE(15, 3):
+ if (neural_present)
+ return "Mali-G2-Pro-NX";
+
+ return "Mali-G2-Pro";
}
return "(Unknown Mali GPU)";
@@ -218,7 +264,7 @@ static int overload_shader_present(struct panthor_device *ptdev)
return 0;
}
-static int panthor_gpu_info_init(struct panthor_device *ptdev)
+static void panthor_gpu_info_v10_init(struct panthor_device *ptdev)
{
unsigned int i;
@@ -259,31 +305,86 @@ static int panthor_gpu_info_init(struct panthor_device *ptdev)
ptdev->gpu_info.tiler_present = gpu_read64(gpu_iomem, GPU_TILER_PRESENT);
ptdev->gpu_info.l2_present = gpu_read64(gpu_iomem, GPU_L2_PRESENT);
}
+}
+
+static void panthor_gpu_info_v15_init(struct panthor_device *ptdev)
+{
+ void __iomem *pwr_iomem = ptdev->iomem + ptdev->hw->regs.pwr_control.offset;
+ u64 texture_features;
+ u32 as_count;
+
+ ptdev->gpu_info.gpu_rev_wide = gpu_read64(ptdev->iomem, DISCOVER_REVIDR);
+ ptdev->gpu_info.l2_features_wide = gpu_read64(ptdev->iomem, DISCOVER_L2_FEATURES);
+
+ texture_features = gpu_read64(ptdev->iomem, DISCOVER_TEXTURE_FEATURES);
+ ptdev->gpu_info.texture_features[0] = lower_32_bits(texture_features);
+ ptdev->gpu_info.texture_features[1] = upper_32_bits(texture_features);
+
+ ptdev->gpu_info.thread_features = gpu_read(ptdev->iomem, DISCOVER_THREAD_FEATURES);
+ ptdev->gpu_info.max_threads = gpu_read(ptdev->iomem, DISCOVER_THREAD_MAX_THREADS);
+ ptdev->gpu_info.thread_num_active_granularity =
+ gpu_read(ptdev->iomem, DISCOVER_THREAD_NUM_ACTIVE_GRANULARITY);
+
+ /* The upper 32-bits of following registers do not contain any information (yet) */
+ ptdev->gpu_info.gpu_features = gpu_read64(ptdev->iomem, DISCOVER_GPU_FEATURES);
+ ptdev->gpu_info.mem_features = gpu_read(ptdev->iomem, DISCOVER_MEM_FEATURES);
+ ptdev->gpu_info.mmu_features = gpu_read(ptdev->iomem, DISCOVER_MMU_FEATURES);
+ ptdev->gpu_info.coherency_features = gpu_read(ptdev->iomem, DISCOVER_AMBA_FEATURES);
+ ptdev->gpu_info.tiler_features = gpu_read(ptdev->iomem, DISCOVER_TILER_FEATURES);
+ ptdev->gpu_info.core_features = gpu_read(ptdev->iomem, DISCOVER_CORE_FEATURES);
+
+ /* AS_PRESENT register removed on v15+ create virtual mask from MMU_FEATURES.AS_COUNT */
+ as_count = MMU_FEATURES_AS_COUNT(ptdev->gpu_info.mmu_features);
+ if (as_count)
+ ptdev->gpu_info.as_present = GENMASK(as_count - 1, 0);
+
+ ptdev->gpu_info.l2_present = gpu_read64(pwr_iomem, PWR_L2_PRESENT);
+ ptdev->gpu_info.tiler_present = gpu_read64(pwr_iomem, PWR_TILER_PRESENT);
+ ptdev->gpu_info.shader_present = gpu_read64(pwr_iomem, PWR_SHADER_PRESENT);
+}
+
+static int panthor_gpu_info_init(struct panthor_device *ptdev)
+{
+ if (panthor_hw_has_gpu_discover(ptdev))
+ panthor_gpu_info_v15_init(ptdev);
+ else
+ panthor_gpu_info_v10_init(ptdev);
return overload_shader_present(ptdev);
}
static int panthor_hw_info_init(struct panthor_device *ptdev)
{
- u32 major, minor, status;
+ u64 l2_features;
+ u32 prod_id, major, minor, status;
int ret;
ret = panthor_gpu_info_init(ptdev);
if (ret)
return ret;
+ /*
+ * The logged 'id' contains four 4-bit architecture and product fields
+ * in pre-v15 GPUs. In v15+ GPUs, this is now four 8-bit fields.
+ * Preserve the pre-v15 format for compatibility. Tools decoding these
+ * fields must handle the wider format for v15+ GPUs.
+ */
+ if (ptdev->gpu_id.arch_major < 15)
+ prod_id = upper_16_bits(ptdev->gpu_info.gpu_id);
+ else
+ prod_id = upper_32_bits(ptdev->gpu_info.gpu_id_wide);
+
major = ptdev->gpu_id.ver_major;
minor = ptdev->gpu_id.ver_minor;
status = ptdev->gpu_id.ver_status;
+ l2_features = panthor_hw_get_l2_features(ptdev);
- drm_info(&ptdev->base,
- "%s id 0x%x major 0x%x minor 0x%x status 0x%x",
- get_gpu_model_name(ptdev), ptdev->gpu_info.gpu_id >> 16,
- major, minor, status);
+ drm_info(&ptdev->base, "%s id 0x%x major 0x%x minor 0x%x status 0x%x",
+ get_gpu_model_name(ptdev), prod_id, major, minor, status);
drm_info(&ptdev->base,
- "Features: L2:%#x Tiler:%#x Mem:%#x MMU:%#x AS:%#x",
- ptdev->gpu_info.l2_features,
+ "Features: L2:%#llx Tiler:%#x Mem:%#x MMU:%#x AS:%#x",
+ l2_features,
ptdev->gpu_info.tiler_features,
ptdev->gpu_info.mem_features,
ptdev->gpu_info.mmu_features,
@@ -323,18 +424,42 @@ static int panthor_hw_bind_device(struct panthor_device *ptdev)
static int panthor_hw_gpu_id_init(struct panthor_device *ptdev)
{
struct panthor_gpu_id *gpu_id = &ptdev->gpu_id;
- ptdev->gpu_info.gpu_id = gpu_read(ptdev->iomem, GPU_ID);
+ u32 gpu_id32 = gpu_read(ptdev->iomem, GPU_ID);
- if (!ptdev->gpu_info.gpu_id)
+ if (!gpu_id32)
return -ENXIO;
- gpu_id->arch_major = GPU_ARCH_MAJOR(ptdev->gpu_info.gpu_id);
- gpu_id->arch_minor = GPU_ARCH_MINOR(ptdev->gpu_info.gpu_id);
- gpu_id->arch_rev = GPU_ARCH_REV(ptdev->gpu_info.gpu_id);
- gpu_id->prod_major = GPU_PROD_MAJOR(ptdev->gpu_info.gpu_id);
- gpu_id->ver_major = GPU_VER_MAJOR(ptdev->gpu_info.gpu_id);
- gpu_id->ver_minor = GPU_VER_MINOR(ptdev->gpu_info.gpu_id);
- gpu_id->ver_status = GPU_VER_STATUS(ptdev->gpu_info.gpu_id);
+ if (GPU_ARCH_MAJOR(gpu_id32) == GPU_WIDE_COMPAT) {
+ /*
+ * GPU_DISCOVER register block always starts at offset zero,
+ * so does the GPU_CONTROL register block on pre-v15 GPUs.
+ */
+ void __iomem *discover = ptdev->iomem;
+ u64 gpu_id64 = gpu_read64(discover, GPU_ID_WIDE);
+
+ if (!gpu_id64)
+ return -ENXIO;
+
+ ptdev->gpu_info.gpu_id_wide = gpu_id64;
+
+ gpu_id->arch_major = GPU_WIDE_ARCH_MAJOR(gpu_id64);
+ gpu_id->arch_minor = GPU_WIDE_ARCH_MINOR(gpu_id64);
+ gpu_id->arch_rev = GPU_WIDE_ARCH_REV(gpu_id64);
+ gpu_id->prod_major = GPU_WIDE_PROD_MAJOR(gpu_id64);
+ gpu_id->ver_major = GPU_WIDE_VER_MAJOR(gpu_id64);
+ gpu_id->ver_minor = GPU_WIDE_VER_MINOR(gpu_id64);
+ gpu_id->ver_status = GPU_WIDE_VER_STATUS(gpu_id64);
+ } else {
+ ptdev->gpu_info.gpu_id = gpu_id32;
+
+ gpu_id->arch_major = GPU_ARCH_MAJOR(gpu_id32);
+ gpu_id->arch_minor = GPU_ARCH_MINOR(gpu_id32);
+ gpu_id->arch_rev = GPU_ARCH_REV(gpu_id32);
+ gpu_id->prod_major = GPU_PROD_MAJOR(gpu_id32);
+ gpu_id->ver_major = GPU_VER_MAJOR(gpu_id32);
+ gpu_id->ver_minor = GPU_VER_MINOR(gpu_id32);
+ gpu_id->ver_status = GPU_VER_STATUS(gpu_id32);
+ }
return 0;
}
diff --git a/drivers/gpu/drm/panthor/panthor_hw.h b/drivers/gpu/drm/panthor/panthor_hw.h
index f93a6b16df2af..8d61a1099aa5e 100644
--- a/drivers/gpu/drm/panthor/panthor_hw.h
+++ b/drivers/gpu/drm/panthor/panthor_hw.h
@@ -105,4 +105,17 @@ static inline bool panthor_hw_is_devfreq_disabled(struct panthor_device *ptdev)
return data->devfreq_disabled;
}
+static inline bool panthor_hw_has_gpu_discover(struct panthor_device *ptdev)
+{
+ return ptdev->gpu_id.arch_major >= 15;
+}
+
+static inline u64 panthor_hw_get_l2_features(struct panthor_device *ptdev)
+{
+ if (panthor_hw_has_gpu_discover(ptdev))
+ return ptdev->gpu_info.l2_features_wide;
+
+ return ptdev->gpu_info.l2_features;
+}
+
#endif /* __PANTHOR_HW_H__ */
diff --git a/include/uapi/drm/panthor_drm.h b/include/uapi/drm/panthor_drm.h
index a2ff0f4ec6915..da9f8f82413cf 100644
--- a/include/uapi/drm/panthor_drm.h
+++ b/include/uapi/drm/panthor_drm.h
@@ -371,11 +371,30 @@ struct drm_panthor_gpu_info {
/** @core_features: Used to discriminate core variants when they exist. */
__u32 core_features;
- /** @pad: MBZ. */
- __u32 pad;
+ /** @thread_num_active_granularity: Granularity of number of active threads */
+ __u32 thread_num_active_granularity;
/** @gpu_features: Bitmask describing supported GPU-wide features */
__u64 gpu_features;
+
+ /**
+ * @gpu_id_wide: 64-bit GPU ID for v15 and later GPUs. @gpu_id is 0 when
+ * this is populated.
+ */
+ __u64 gpu_id_wide;
+#define DRM_PANTHOR_WIDE_ARCH_MAJOR(x) (((x) >> 56) & 0xff)
+#define DRM_PANTHOR_WIDE_ARCH_MINOR(x) (((x) >> 48) & 0xff)
+#define DRM_PANTHOR_WIDE_ARCH_REV(x) (((x) >> 40) & 0xff)
+#define DRM_PANTHOR_WIDE_PRODUCT_MAJOR(x) (((x) >> 32) & 0xff)
+#define DRM_PANTHOR_WIDE_VERSION_MAJOR(x) (((x) >> 16) & 0xff)
+#define DRM_PANTHOR_WIDE_VERSION_MINOR(x) (((x) >> 8) & 0xff)
+#define DRM_PANTHOR_WIDE_VERSION_STATUS(x) ((x) & 0xff)
+
+ /** @gpu_rev_wide: 64-bit GPU revision for v15 onwards */
+ __u64 gpu_rev_wide;
+
+ /** @l2_features_wide: 64-bit L2_FEATURES for v15 onwards */
+ __u64 l2_features_wide;
};
/**
--
2.43.0
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH v4 9/9] drm/panthor: Add Mali v15 hardware support
2026-11-19 15:45 ` [PATCH v4 9/9] drm/panthor: Add Mali v15 hardware support Karunika Choo
@ 2026-11-19 16:06 ` Boris Brezillon
0 siblings, 0 replies; 12+ messages in thread
From: Boris Brezillon @ 2026-11-19 16:06 UTC (permalink / raw)
To: Karunika Choo
Cc: dri-devel, nd, Steven Price, Liviu Dudau, linux-kernel,
Akash Goel, Lukas Zapolskas, Chris Diamand, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Daniel Almeida, Alice Ryhl, rust-for-linux
On Thu, 19 Nov 2026 15:45:59 +0000
Karunika Choo <karunika.choo@arm.com> wrote:
> Add the panthor hardware description for Mali v15 GPUs and hook it into
> device matching.
>
> This includes the v15 register map and product identification needed to
> populate the GPU information exposed by the driver and its uAPI, as well
> as add compatibility string for v15 GPUs.
>
> Mali v15 also exposes a 64-bit GPU_ID register with a different field
> layout from earlier GPUs. Add the register definitions and decoding
> helpers for the new format, read GPU_ID_WIDE when the compatibility
> value indicates a v15 GPU, and populate both the cached GPU_ID fields
> and the uAPI gpu_id_wide field.
>
> Bump drm minor to 10.
>
> Signed-off-by: Karunika Choo <karunika.choo@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> v4:
> - squashed 64-bit GPU_ID decoding into this patch. Resetting R-bs as
> a result.
> v2:
> - check as_count is non-zero before generating as_present mask per
> sashiko's comment.
> - Link: https://lore.kernel.org/all/20260922205812.C473B1F000FF@smtp.kernel.org/
> - clean up l2_features value assignment.
> - removed duplicated GPU_FEATURES macro definitions
> - Picked up R-b from Liviu
> v1:
> - make COHERENCY_FEATURES register read use cached gpu_info values.
> - Added Mali-G2 name variants and NX aware model identification.
> - fix premature reading of l2_features gpu_info field during
> panthor_hw_info_init().
> - build as_present using GENMASK.
>
> 64-bit GPU_ID:
> v3:
> - Fix the missing blank line after declarations in GPU_ID decoding.
> v2:
> - Picked up R-b from Liviu.
> - Rename the register macro from GPU_WIDE_ID to GPU_ID_WIDE.
> - Rename the uAPI field from gpu_wide_id to gpu_id_wide.
> - Print the upper 32 bits of GPU_ID_WIDE as the logged 'id' for v15 and
> later GPUs. Keep the existing output for earlier GPUs. Continuation
> fix for previous sashiko comment.
> - Link: https://lore.kernel.org/all/20260922205659.3C4F21F000FF@smtp.kernel.org/
> v1:
> - Decode selected GPU_ID format after checking compatibility value.
> - Document GPU_DISCOVER and GPU_CONTROL register offset differences
> between GPUs.
> - Fix mask generation in panthor_gpu_discover_regs.h
>
> drivers/gpu/drm/panthor/panthor_drv.c | 9 +-
> drivers/gpu/drm/panthor/panthor_fw.c | 1 +
> drivers/gpu/drm/panthor/panthor_gpu.c | 3 +-
> .../drm/panthor/panthor_gpu_discover_regs.h | 42 +++++
> drivers/gpu/drm/panthor/panthor_heap.c | 3 +-
> drivers/gpu/drm/panthor/panthor_hw.c | 159 ++++++++++++++++--
> drivers/gpu/drm/panthor/panthor_hw.h | 13 ++
> include/uapi/drm/panthor_drm.h | 23 ++-
> 8 files changed, 230 insertions(+), 23 deletions(-)
> create mode 100644 drivers/gpu/drm/panthor/panthor_gpu_discover_regs.h
>
> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> index b4d3d339b04b4..94320799d5d75 100644
> --- a/drivers/gpu/drm/panthor/panthor_drv.c
> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> @@ -1788,6 +1788,8 @@ static void panthor_debugfs_init(struct drm_minor *minor)
> * - 1.8 - extends DEV_QUERY_TIMESTAMP_INFO with flags
> * - 1.9 - adds DRM_PANTHOR_DEV_QUERY_MMU_INFO query
> * - adds DRM_PANTHOR_VM_BIND_OP_MAP_SPARSE flag
> + * - 1.10 - adds thread_num_active_granularity, gpu_rev_wide, l2_features_wide,
> + * and gpu_id_wide to drm_panthor_gpu_info
> */
> static const struct drm_driver panthor_drm_driver = {
> .driver_features = DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ |
> @@ -1801,7 +1803,7 @@ static const struct drm_driver panthor_drm_driver = {
> .name = "panthor",
> .desc = "Panthor DRM driver",
> .major = 1,
> - .minor = 9,
> + .minor = 10,
>
> .gem_prime_import_sg_table = panthor_gem_prime_import_sg_table,
> .gem_prime_import = panthor_gem_prime_import,
> @@ -1880,10 +1882,15 @@ static const struct panthor_soc_data soc_data_mediatek_mt8196 = {
> .asn_hash = { 0xb, 0xe, 0x0, },
> };
>
> +static const struct panthor_soc_data soc_data_gen5_am = {
> + .devfreq_disabled = true,
> +};
> +
> static const struct of_device_id dt_match[] = {
> { .compatible = "mediatek,mt8196-mali", .data = &soc_data_mediatek_mt8196, },
> { .compatible = "rockchip,rk3588-mali" },
> { .compatible = "arm,mali-valhall-csf" },
> + { .compatible = "arm,mali-gen5-am", .data = &soc_data_gen5_am, },
> {}
> };
> MODULE_DEVICE_TABLE(of, dt_match);
> diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c
> index 679ea1d233d53..1449d9a66302e 100644
> --- a/drivers/gpu/drm/panthor/panthor_fw.c
> +++ b/drivers/gpu/drm/panthor/panthor_fw.c
> @@ -1563,3 +1563,4 @@ MODULE_FIRMWARE("arm/mali/arch11.8/mali_csffw.bin");
> MODULE_FIRMWARE("arm/mali/arch12.8/mali_csffw.bin");
> MODULE_FIRMWARE("arm/mali/arch13.8/mali_csffw.bin");
> MODULE_FIRMWARE("arm/mali/arch14.8/mali_csffw.bin");
> +MODULE_FIRMWARE("arm/mali/arch15.8/mali_csffw.bin");
> diff --git a/drivers/gpu/drm/panthor/panthor_gpu.c b/drivers/gpu/drm/panthor/panthor_gpu.c
> index ab54119314da0..2e1b00e86cdea 100644
> --- a/drivers/gpu/drm/panthor/panthor_gpu.c
> +++ b/drivers/gpu/drm/panthor/panthor_gpu.c
> @@ -503,8 +503,7 @@ int panthor_gpu_coherency_init(struct panthor_device *ptdev)
> /* Check if the ACE-Lite coherency protocol is actually supported by the GPU.
> * ACE protocol has never been supported for command stream frontend GPUs.
> */
> - if ((gpu_read(ptdev->gpu->iomem, GPU_COHERENCY_FEATURES) &
> - GPU_COHERENCY_PROT_BIT(ACE_LITE))) {
> + if ((ptdev->gpu_info.coherency_features & GPU_COHERENCY_PROT_BIT(ACE_LITE))) {
> ptdev->gpu_info.selected_coherency = GPU_COHERENCY_ACE_LITE;
> return 0;
> }
> diff --git a/drivers/gpu/drm/panthor/panthor_gpu_discover_regs.h b/drivers/gpu/drm/panthor/panthor_gpu_discover_regs.h
> new file mode 100644
> index 0000000000000..05e90950ec6ad
> --- /dev/null
> +++ b/drivers/gpu/drm/panthor/panthor_gpu_discover_regs.h
> @@ -0,0 +1,42 @@
> +/* SPDX-License-Identifier: GPL-2.0 or MIT */
> +/* Copyright 2026 ARM Limited. All rights reserved. */
> +
> +#ifndef __PANTHOR_GPU_DISCOVER_REGS_H__
> +#define __PANTHOR_GPU_DISCOVER_REGS_H__
> +
> +#include <linux/bits.h>
> +
> +#define GPU_ID_WIDE 0x0
> +#define GPU_WIDE_COMPAT 0xF
> +#define GPU_WIDE_ARCH_MAJOR(x) (((x) & GENMASK_U64(63, 56)) >> 56)
> +#define GPU_WIDE_ARCH_MINOR(x) (((x) & GENMASK_U64(55, 48)) >> 48)
> +#define GPU_WIDE_ARCH_REV(x) (((x) & GENMASK_U64(47, 40)) >> 40)
> +#define GPU_WIDE_PROD_MAJOR(x) (((x) & GENMASK_U64(39, 32)) >> 32)
> +#define GPU_WIDE_VER_MAJOR(x) (((x) & GENMASK_U64(23, 16)) >> 16)
> +#define GPU_WIDE_VER_MINOR(x) (((x) & GENMASK_U64(15, 8)) >> 8)
> +#define GPU_WIDE_VER_STATUS(x) ((x) & GENMASK_U64(7, 0))
> +
> +#define DISCOVER_REVIDR 0x8
> +#define DISCOVER_GPU_FEATURES 0x20
> +#define GPU_FEATURES_VARIABLE_RATE_SHADING BIT(0)
> +#define GPU_FEATURES_SIMD_STATE BIT(1)
> +#define GPU_FEATURES_CROSS_STREAM_SYNC BIT(3)
> +#define GPU_FEATURES_LD_LEA_TENSOR_INSTRUCTIONS BIT(6)
> +#define DISCOVER_MCU_FEATURES 0x40
> +#define DISCOVER_PRFCNT_FEATURES 0x50
> +#define PRFCNT_FEATURES_COUNTER_BLOCK_SIZE(x) (((x) & GENMASK(7, 0)) << 8)
> +#define DISCOVER_DOORBELL_FEATURES 0x60
> +#define DISCOVER_MEM_FEATURES 0x100
> +#define DISCOVER_MMU_FEATURES 0x108
> +#define MMU_FEATURES_AS_COUNT(x) (((x) & GENMASK(23, 16)) >> 16)
> +#define DISCOVER_AMBA_FEATURES 0x120
> +
> +#define DISCOVER_L2_FEATURES 0x128
> +#define DISCOVER_TILER_FEATURES 0x200
> +#define DISCOVER_CORE_FEATURES 0x300
> +#define DISCOVER_THREAD_FEATURES 0x320
> +#define DISCOVER_THREAD_MAX_THREADS 0x330
> +#define DISCOVER_THREAD_NUM_ACTIVE_GRANULARITY 0x334
> +#define DISCOVER_TEXTURE_FEATURES 0x360
> +
> +#endif /* __PANTHOR_GPU_DISCOVER_REGS_H__ */
> diff --git a/drivers/gpu/drm/panthor/panthor_heap.c b/drivers/gpu/drm/panthor/panthor_heap.c
> index 99311abdf1e91..afb7d68abc874 100644
> --- a/drivers/gpu/drm/panthor/panthor_heap.c
> +++ b/drivers/gpu/drm/panthor/panthor_heap.c
> @@ -11,6 +11,7 @@
> #include "panthor_gem.h"
> #include "panthor_gpu_regs.h"
> #include "panthor_heap.h"
> +#include "panthor_hw.h"
> #include "panthor_mmu.h"
>
> /*
> @@ -105,7 +106,7 @@ struct panthor_heap_pool {
>
> static int panthor_heap_ctx_stride(struct panthor_device *ptdev)
> {
> - u32 l2_features = ptdev->gpu_info.l2_features;
> + u64 l2_features = panthor_hw_get_l2_features(ptdev);
> u32 gpu_cache_line_size = GPU_L2_FEATURES_LINE_SIZE(l2_features);
>
> return ALIGN(HEAP_CONTEXT_SIZE, gpu_cache_line_size);
> diff --git a/drivers/gpu/drm/panthor/panthor_hw.c b/drivers/gpu/drm/panthor/panthor_hw.c
> index 593bf6743d6df..fc81fabbe62fd 100644
> --- a/drivers/gpu/drm/panthor/panthor_hw.c
> +++ b/drivers/gpu/drm/panthor/panthor_hw.c
> @@ -1,13 +1,16 @@
> // SPDX-License-Identifier: GPL-2.0 or MIT
> /* Copyright 2025 ARM Limited. All rights reserved. */
>
> +#include <linux/bits.h>
> #include <linux/nvmem-consumer.h>
> #include <linux/platform_device.h>
> +#include <linux/wordpart.h>
>
> #include <drm/drm_print.h>
>
> #include "panthor_device.h"
> #include "panthor_gpu.h"
> +#include "panthor_gpu_discover_regs.h"
> #include "panthor_gpu_regs.h"
> #include "panthor_hw.h"
> #include "panthor_pwr.h"
> @@ -73,6 +76,29 @@ static struct panthor_hw panthor_hw_arch_v14 = {
> },
> };
>
> +static struct panthor_hw panthor_hw_arch_v15 = {
> + .ops = {
> + .soft_reset = panthor_pwr_reset_soft,
> + .l2_power_off = panthor_pwr_l2_power_off,
> + .l2_power_on = panthor_pwr_l2_power_on,
> + },
> + .regs = {
> + .gpu_control = {
> + .offset = 0x3000,
> + },
> + .mcu_control = {
> + .offset = 0x3100,
> + },
> + .pwr_control = {
> + .offset = 0x3800,
> + },
> + .mmu_as_control = {
> + .offset = 0x2800,
> + .stride = 0x80,
> + },
> + },
> +};
> +
> static struct panthor_hw_entry panthor_hw_match[] = {
> {
> .arch_min = 10,
> @@ -84,6 +110,11 @@ static struct panthor_hw_entry panthor_hw_match[] = {
> .arch_max = 14,
> .hwdev = &panthor_hw_arch_v14,
> },
> + {
> + .arch_min = 15,
> + .arch_max = 15,
> + .hwdev = &panthor_hw_arch_v15,
> + }
> };
>
> static int panthor_hw_set_power_tracing(struct device *dev, void *data)
> @@ -151,8 +182,11 @@ static char *get_gpu_model_name(struct panthor_device *ptdev)
> gpu_id->prod_major);
> const bool ray_intersection = !!(ptdev->gpu_info.gpu_features &
> GPU_FEATURES_RAY_INTERSECTION);
> + const bool neural_present = !!(ptdev->gpu_info.gpu_features &
> + GPU_FEATURES_NX);
> const u8 shader_core_count = hweight64(ptdev->gpu_info.shader_present);
>
> +
> switch (product_id) {
> case GPU_PROD_ID_MAKE(10, 2):
> return "Mali-G710";
> @@ -195,6 +229,18 @@ static char *get_gpu_model_name(struct panthor_device *ptdev)
> return "Mali-G1-Premium";
> case GPU_PROD_ID_MAKE(14, 3):
> return "Mali-G1-Pro";
> + case GPU_PROD_ID_MAKE(15, 0):
> + return "Mali-G2-Ultra-NX";
> + case GPU_PROD_ID_MAKE(15, 1):
> + if (neural_present)
> + return "Mali-G2-Premium-NX";
> +
> + return "Mali-G2-Premium";
> + case GPU_PROD_ID_MAKE(15, 3):
> + if (neural_present)
> + return "Mali-G2-Pro-NX";
> +
> + return "Mali-G2-Pro";
> }
>
> return "(Unknown Mali GPU)";
> @@ -218,7 +264,7 @@ static int overload_shader_present(struct panthor_device *ptdev)
> return 0;
> }
>
> -static int panthor_gpu_info_init(struct panthor_device *ptdev)
> +static void panthor_gpu_info_v10_init(struct panthor_device *ptdev)
> {
> unsigned int i;
>
> @@ -259,31 +305,86 @@ static int panthor_gpu_info_init(struct panthor_device *ptdev)
> ptdev->gpu_info.tiler_present = gpu_read64(gpu_iomem, GPU_TILER_PRESENT);
> ptdev->gpu_info.l2_present = gpu_read64(gpu_iomem, GPU_L2_PRESENT);
> }
> +}
> +
> +static void panthor_gpu_info_v15_init(struct panthor_device *ptdev)
> +{
> + void __iomem *pwr_iomem = ptdev->iomem + ptdev->hw->regs.pwr_control.offset;
> + u64 texture_features;
> + u32 as_count;
> +
> + ptdev->gpu_info.gpu_rev_wide = gpu_read64(ptdev->iomem, DISCOVER_REVIDR);
> + ptdev->gpu_info.l2_features_wide = gpu_read64(ptdev->iomem, DISCOVER_L2_FEATURES);
> +
> + texture_features = gpu_read64(ptdev->iomem, DISCOVER_TEXTURE_FEATURES);
> + ptdev->gpu_info.texture_features[0] = lower_32_bits(texture_features);
> + ptdev->gpu_info.texture_features[1] = upper_32_bits(texture_features);
> +
> + ptdev->gpu_info.thread_features = gpu_read(ptdev->iomem, DISCOVER_THREAD_FEATURES);
> + ptdev->gpu_info.max_threads = gpu_read(ptdev->iomem, DISCOVER_THREAD_MAX_THREADS);
> + ptdev->gpu_info.thread_num_active_granularity =
> + gpu_read(ptdev->iomem, DISCOVER_THREAD_NUM_ACTIVE_GRANULARITY);
> +
> + /* The upper 32-bits of following registers do not contain any information (yet) */
> + ptdev->gpu_info.gpu_features = gpu_read64(ptdev->iomem, DISCOVER_GPU_FEATURES);
> + ptdev->gpu_info.mem_features = gpu_read(ptdev->iomem, DISCOVER_MEM_FEATURES);
> + ptdev->gpu_info.mmu_features = gpu_read(ptdev->iomem, DISCOVER_MMU_FEATURES);
> + ptdev->gpu_info.coherency_features = gpu_read(ptdev->iomem, DISCOVER_AMBA_FEATURES);
> + ptdev->gpu_info.tiler_features = gpu_read(ptdev->iomem, DISCOVER_TILER_FEATURES);
> + ptdev->gpu_info.core_features = gpu_read(ptdev->iomem, DISCOVER_CORE_FEATURES);
> +
> + /* AS_PRESENT register removed on v15+ create virtual mask from MMU_FEATURES.AS_COUNT */
> + as_count = MMU_FEATURES_AS_COUNT(ptdev->gpu_info.mmu_features);
> + if (as_count)
> + ptdev->gpu_info.as_present = GENMASK(as_count - 1, 0);
> +
> + ptdev->gpu_info.l2_present = gpu_read64(pwr_iomem, PWR_L2_PRESENT);
> + ptdev->gpu_info.tiler_present = gpu_read64(pwr_iomem, PWR_TILER_PRESENT);
> + ptdev->gpu_info.shader_present = gpu_read64(pwr_iomem, PWR_SHADER_PRESENT);
> +}
> +
> +static int panthor_gpu_info_init(struct panthor_device *ptdev)
> +{
> + if (panthor_hw_has_gpu_discover(ptdev))
> + panthor_gpu_info_v15_init(ptdev);
> + else
> + panthor_gpu_info_v10_init(ptdev);
>
> return overload_shader_present(ptdev);
> }
>
> static int panthor_hw_info_init(struct panthor_device *ptdev)
> {
> - u32 major, minor, status;
> + u64 l2_features;
> + u32 prod_id, major, minor, status;
> int ret;
>
> ret = panthor_gpu_info_init(ptdev);
> if (ret)
> return ret;
>
> + /*
> + * The logged 'id' contains four 4-bit architecture and product fields
> + * in pre-v15 GPUs. In v15+ GPUs, this is now four 8-bit fields.
> + * Preserve the pre-v15 format for compatibility. Tools decoding these
> + * fields must handle the wider format for v15+ GPUs.
> + */
> + if (ptdev->gpu_id.arch_major < 15)
> + prod_id = upper_16_bits(ptdev->gpu_info.gpu_id);
> + else
> + prod_id = upper_32_bits(ptdev->gpu_info.gpu_id_wide);
> +
> major = ptdev->gpu_id.ver_major;
> minor = ptdev->gpu_id.ver_minor;
> status = ptdev->gpu_id.ver_status;
> + l2_features = panthor_hw_get_l2_features(ptdev);
>
> - drm_info(&ptdev->base,
> - "%s id 0x%x major 0x%x minor 0x%x status 0x%x",
> - get_gpu_model_name(ptdev), ptdev->gpu_info.gpu_id >> 16,
> - major, minor, status);
> + drm_info(&ptdev->base, "%s id 0x%x major 0x%x minor 0x%x status 0x%x",
> + get_gpu_model_name(ptdev), prod_id, major, minor, status);
>
> drm_info(&ptdev->base,
> - "Features: L2:%#x Tiler:%#x Mem:%#x MMU:%#x AS:%#x",
> - ptdev->gpu_info.l2_features,
> + "Features: L2:%#llx Tiler:%#x Mem:%#x MMU:%#x AS:%#x",
> + l2_features,
> ptdev->gpu_info.tiler_features,
> ptdev->gpu_info.mem_features,
> ptdev->gpu_info.mmu_features,
> @@ -323,18 +424,42 @@ static int panthor_hw_bind_device(struct panthor_device *ptdev)
> static int panthor_hw_gpu_id_init(struct panthor_device *ptdev)
> {
> struct panthor_gpu_id *gpu_id = &ptdev->gpu_id;
> - ptdev->gpu_info.gpu_id = gpu_read(ptdev->iomem, GPU_ID);
> + u32 gpu_id32 = gpu_read(ptdev->iomem, GPU_ID);
>
> - if (!ptdev->gpu_info.gpu_id)
> + if (!gpu_id32)
> return -ENXIO;
>
> - gpu_id->arch_major = GPU_ARCH_MAJOR(ptdev->gpu_info.gpu_id);
> - gpu_id->arch_minor = GPU_ARCH_MINOR(ptdev->gpu_info.gpu_id);
> - gpu_id->arch_rev = GPU_ARCH_REV(ptdev->gpu_info.gpu_id);
> - gpu_id->prod_major = GPU_PROD_MAJOR(ptdev->gpu_info.gpu_id);
> - gpu_id->ver_major = GPU_VER_MAJOR(ptdev->gpu_info.gpu_id);
> - gpu_id->ver_minor = GPU_VER_MINOR(ptdev->gpu_info.gpu_id);
> - gpu_id->ver_status = GPU_VER_STATUS(ptdev->gpu_info.gpu_id);
> + if (GPU_ARCH_MAJOR(gpu_id32) == GPU_WIDE_COMPAT) {
> + /*
> + * GPU_DISCOVER register block always starts at offset zero,
> + * so does the GPU_CONTROL register block on pre-v15 GPUs.
> + */
> + void __iomem *discover = ptdev->iomem;
> + u64 gpu_id64 = gpu_read64(discover, GPU_ID_WIDE);
> +
> + if (!gpu_id64)
> + return -ENXIO;
> +
> + ptdev->gpu_info.gpu_id_wide = gpu_id64;
> +
> + gpu_id->arch_major = GPU_WIDE_ARCH_MAJOR(gpu_id64);
> + gpu_id->arch_minor = GPU_WIDE_ARCH_MINOR(gpu_id64);
> + gpu_id->arch_rev = GPU_WIDE_ARCH_REV(gpu_id64);
> + gpu_id->prod_major = GPU_WIDE_PROD_MAJOR(gpu_id64);
> + gpu_id->ver_major = GPU_WIDE_VER_MAJOR(gpu_id64);
> + gpu_id->ver_minor = GPU_WIDE_VER_MINOR(gpu_id64);
> + gpu_id->ver_status = GPU_WIDE_VER_STATUS(gpu_id64);
> + } else {
> + ptdev->gpu_info.gpu_id = gpu_id32;
> +
> + gpu_id->arch_major = GPU_ARCH_MAJOR(gpu_id32);
> + gpu_id->arch_minor = GPU_ARCH_MINOR(gpu_id32);
> + gpu_id->arch_rev = GPU_ARCH_REV(gpu_id32);
> + gpu_id->prod_major = GPU_PROD_MAJOR(gpu_id32);
> + gpu_id->ver_major = GPU_VER_MAJOR(gpu_id32);
> + gpu_id->ver_minor = GPU_VER_MINOR(gpu_id32);
> + gpu_id->ver_status = GPU_VER_STATUS(gpu_id32);
> + }
>
> return 0;
> }
> diff --git a/drivers/gpu/drm/panthor/panthor_hw.h b/drivers/gpu/drm/panthor/panthor_hw.h
> index f93a6b16df2af..8d61a1099aa5e 100644
> --- a/drivers/gpu/drm/panthor/panthor_hw.h
> +++ b/drivers/gpu/drm/panthor/panthor_hw.h
> @@ -105,4 +105,17 @@ static inline bool panthor_hw_is_devfreq_disabled(struct panthor_device *ptdev)
> return data->devfreq_disabled;
> }
>
> +static inline bool panthor_hw_has_gpu_discover(struct panthor_device *ptdev)
> +{
> + return ptdev->gpu_id.arch_major >= 15;
> +}
> +
> +static inline u64 panthor_hw_get_l2_features(struct panthor_device *ptdev)
> +{
> + if (panthor_hw_has_gpu_discover(ptdev))
> + return ptdev->gpu_info.l2_features_wide;
> +
> + return ptdev->gpu_info.l2_features;
> +}
> +
> #endif /* __PANTHOR_HW_H__ */
> diff --git a/include/uapi/drm/panthor_drm.h b/include/uapi/drm/panthor_drm.h
> index a2ff0f4ec6915..da9f8f82413cf 100644
> --- a/include/uapi/drm/panthor_drm.h
> +++ b/include/uapi/drm/panthor_drm.h
> @@ -371,11 +371,30 @@ struct drm_panthor_gpu_info {
> /** @core_features: Used to discriminate core variants when they exist. */
> __u32 core_features;
>
> - /** @pad: MBZ. */
> - __u32 pad;
> + /** @thread_num_active_granularity: Granularity of number of active threads */
> + __u32 thread_num_active_granularity;
>
> /** @gpu_features: Bitmask describing supported GPU-wide features */
> __u64 gpu_features;
> +
> + /**
> + * @gpu_id_wide: 64-bit GPU ID for v15 and later GPUs. @gpu_id is 0 when
> + * this is populated.
> + */
> + __u64 gpu_id_wide;
> +#define DRM_PANTHOR_WIDE_ARCH_MAJOR(x) (((x) >> 56) & 0xff)
> +#define DRM_PANTHOR_WIDE_ARCH_MINOR(x) (((x) >> 48) & 0xff)
> +#define DRM_PANTHOR_WIDE_ARCH_REV(x) (((x) >> 40) & 0xff)
> +#define DRM_PANTHOR_WIDE_PRODUCT_MAJOR(x) (((x) >> 32) & 0xff)
> +#define DRM_PANTHOR_WIDE_VERSION_MAJOR(x) (((x) >> 16) & 0xff)
> +#define DRM_PANTHOR_WIDE_VERSION_MINOR(x) (((x) >> 8) & 0xff)
> +#define DRM_PANTHOR_WIDE_VERSION_STATUS(x) ((x) & 0xff)
> +
> + /** @gpu_rev_wide: 64-bit GPU revision for v15 onwards */
> + __u64 gpu_rev_wide;
> +
> + /** @l2_features_wide: 64-bit L2_FEATURES for v15 onwards */
> + __u64 l2_features_wide;
> };
>
> /**
^ permalink raw reply [flat|nested] 12+ messages in thread