Mali-G715 introduces a new GPU_FEATURES register that provides
information about GPU-wide supported features. The register value will
be passed on to userspace via gpu_info. It also adds the following
registers that are specific to the kernel driver only:
- ASN_HASH_0~2
- DOORBELL_FEATURES
- PRFCNT_FEATURES
- SYSC_ALLOC0~7
- SYSC_PBHA_OVERRIDE0~3

Additionally, Mali-G715 presents an 'Immortalis' naming variant
depending on the shader core count and presence of Ray Intersection
feature support.

This patch adds:
- support for correctly identifying the model names for the Mali-G715
  and Mali-G615 GPUs.
- arch 11.8 FW binary support

Signed-off-by: Karunika Choo <karunika.c...@arm.com>
---
 drivers/gpu/drm/panthor/panthor_fw.c   |  1 +
 drivers/gpu/drm/panthor/panthor_hw.c   | 18 ++++++++++++++++++
 drivers/gpu/drm/panthor/panthor_regs.h | 11 +++++++++++
 include/uapi/drm/panthor_drm.h         |  3 +++
 4 files changed, 33 insertions(+)

diff --git a/drivers/gpu/drm/panthor/panthor_fw.c 
b/drivers/gpu/drm/panthor/panthor_fw.c
index b7b454d16f12..fa6e0b48a0b2 100644
--- a/drivers/gpu/drm/panthor/panthor_fw.c
+++ b/drivers/gpu/drm/panthor/panthor_fw.c
@@ -1404,3 +1404,4 @@ int panthor_fw_init(struct panthor_device *ptdev)
 MODULE_FIRMWARE("arm/mali/arch10.8/mali_csffw.bin");
 MODULE_FIRMWARE("arm/mali/arch10.10/mali_csffw.bin");
 MODULE_FIRMWARE("arm/mali/arch10.12/mali_csffw.bin");
+MODULE_FIRMWARE("arm/mali/arch11.8/mali_csffw.bin");
diff --git a/drivers/gpu/drm/panthor/panthor_hw.c 
b/drivers/gpu/drm/panthor/panthor_hw.c
index 5e423122cd4e..f5127a4b02dc 100644
--- a/drivers/gpu/drm/panthor/panthor_hw.c
+++ b/drivers/gpu/drm/panthor/panthor_hw.c
@@ -29,6 +29,9 @@ static void panthor_gpu_info_init(struct panthor_device 
*ptdev)
        ptdev->gpu_info.shader_present = gpu_read64(ptdev, GPU_SHADER_PRESENT);
        ptdev->gpu_info.tiler_present = gpu_read64(ptdev, GPU_TILER_PRESENT);
        ptdev->gpu_info.l2_present = gpu_read64(ptdev, GPU_L2_PRESENT);
+
+       /* Introduced in arch 11.x */
+       ptdev->gpu_info.gpu_features = gpu_read64(ptdev, GPU_FEATURES);
 }
 
 static char *get_gpu_model_name(struct panthor_device *ptdev)
@@ -36,6 +39,9 @@ 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 bool ray_intersection = !!(ptdev->gpu_info.gpu_features &
+                                        GPU_FEATURES_RAY_INTERSECTION);
+       const u8 shader_core_count = hweight64(ptdev->gpu_info.shader_present);
 
        switch (product_id) {
        case GPU_PROD_ID_MAKE(10, 2):
@@ -46,6 +52,15 @@ static char *get_gpu_model_name(struct panthor_device *ptdev)
                return "Mali-G510";
        case GPU_PROD_ID_MAKE(10, 4):
                return "Mali-G310";
+       case GPU_PROD_ID_MAKE(11, 2):
+               if (shader_core_count > 10 && ray_intersection)
+                       return "Mali-G715-Immortalis";
+               else if (shader_core_count >= 7)
+                       return "Mali-G715";
+
+               fallthrough;
+       case GPU_PROD_ID_MAKE(11, 3):
+               return "Mali-G615";
        }
 
        return "(Unknown Mali GPU)";
@@ -85,6 +100,9 @@ static struct panthor_hw panthor_hw_devices[] = {
        {
                .arch_major = 10,
        },
+       {
+               .arch_major = 11,
+       },
 };
 
 static int init_gpu_id(struct panthor_device *ptdev)
diff --git a/drivers/gpu/drm/panthor/panthor_regs.h 
b/drivers/gpu/drm/panthor/panthor_regs.h
index e7a81686afdb..4eaa2b612756 100644
--- a/drivers/gpu/drm/panthor/panthor_regs.h
+++ b/drivers/gpu/drm/panthor/panthor_regs.h
@@ -72,6 +72,10 @@
 #define GPU_PWR_OVERRIDE0                              0x54
 #define GPU_PWR_OVERRIDE1                              0x58
 
+#define GPU_FEATURES                                   0x60
+#define   GPU_FEATURES_RAY_INTERSECTION                        BIT(2)
+#define GPU_PRFCNT_FEATURES                            0x68
+
 #define GPU_TIMESTAMP_OFFSET                           0x88
 #define GPU_CYCLE_COUNT                                        0x90
 #define GPU_TIMESTAMP                                  0x98
@@ -83,6 +87,8 @@
 
 #define GPU_TEXTURE_FEATURES(n)                                (0xB0 + ((n) * 
4))
 
+#define GPU_DOORBELL_FEATURES                          0xC0
+
 #define GPU_SHADER_PRESENT                             0x100
 #define GPU_TILER_PRESENT                              0x110
 #define GPU_L2_PRESENT                                 0x120
@@ -109,6 +115,8 @@
 
 #define GPU_REVID                                      0x280
 
+#define GPU_ASN_HASH(n)                                        (0x2C0 + ((n) * 
4))
+
 #define GPU_COHERENCY_FEATURES                         0x300
 #define GPU_COHERENCY_PROT_BIT(name)                   BIT(GPU_COHERENCY_  ## 
name)
 
@@ -117,6 +125,9 @@
 #define   GPU_COHERENCY_ACE                            1
 #define   GPU_COHERENCY_NONE                           31
 
+#define GPU_SYSC_PBHA_OVERRIDE(n)                      (0x320 + ((n) * 4))
+#define GPU_SYSC_ALLOC(n)                              (0x340 + ((n) * 4))
+
 #define MCU_CONTROL                                    0x700
 #define MCU_CONTROL_ENABLE                             1
 #define MCU_CONTROL_AUTO                               2
diff --git a/include/uapi/drm/panthor_drm.h b/include/uapi/drm/panthor_drm.h
index ad9a70afea6c..888179effdee 100644
--- a/include/uapi/drm/panthor_drm.h
+++ b/include/uapi/drm/panthor_drm.h
@@ -310,6 +310,9 @@ struct drm_panthor_gpu_info {
 
        /** @pad: MBZ. */
        __u32 pad;
+
+       /** @gpu_features: Bitmask describing supported GPU-wide features */
+       __u64 gpu_features;
 };
 
 /**
-- 
2.49.0

Reply via email to