]> Gentwo Git Trees - linux/.git/commitdiff
drm/panthor: Add architecture-specific function operations
authorKarunika Choo <karunika.choo@arm.com>
Tue, 25 Nov 2025 12:55:42 +0000 (12:55 +0000)
committerBoris Brezillon <boris.brezillon@collabora.com>
Wed, 26 Nov 2025 09:56:18 +0000 (10:56 +0100)
Introduce architecture-specific function pointers to support
architecture-dependent behaviours. This patch adds the following
function pointers and updates their usage accordingly:

- soft_reset
- l2_power_on
- l2_power_off

Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Karunika Choo <karunika.choo@arm.com>
Link: https://patch.msgid.link/20251125125548.3282320-3-karunika.choo@arm.com
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
drivers/gpu/drm/panthor/panthor_device.c
drivers/gpu/drm/panthor/panthor_fw.c
drivers/gpu/drm/panthor/panthor_gpu.c
drivers/gpu/drm/panthor/panthor_gpu.h
drivers/gpu/drm/panthor/panthor_hw.c
drivers/gpu/drm/panthor/panthor_hw.h

index 31fb8ed68199b4ab30bdfb1f2166126a120387eb..0ecf552caa5cd6c2366fb1fb4d4759b97385847f 100644 (file)
@@ -152,8 +152,8 @@ static void panthor_device_reset_work(struct work_struct *work)
        panthor_sched_pre_reset(ptdev);
        panthor_fw_pre_reset(ptdev, true);
        panthor_mmu_pre_reset(ptdev);
-       panthor_gpu_soft_reset(ptdev);
-       panthor_gpu_l2_power_on(ptdev);
+       panthor_hw_soft_reset(ptdev);
+       panthor_hw_l2_power_on(ptdev);
        panthor_mmu_post_reset(ptdev);
        ret = panthor_fw_post_reset(ptdev);
        atomic_set(&ptdev->reset.pending, 0);
index 38d87ab92eda49bb8a9a6ba25c7d078ff4d1e5aa..027c4529f3f2b5d2de9bee4f2ebe7908d67d1e42 100644 (file)
@@ -22,6 +22,7 @@
 #include "panthor_fw.h"
 #include "panthor_gem.h"
 #include "panthor_gpu.h"
+#include "panthor_hw.h"
 #include "panthor_mmu.h"
 #include "panthor_regs.h"
 #include "panthor_sched.h"
@@ -1186,7 +1187,7 @@ void panthor_fw_unplug(struct panthor_device *ptdev)
        ptdev->fw->vm = NULL;
 
        if (!IS_ENABLED(CONFIG_PM) || pm_runtime_active(ptdev->base.dev))
-               panthor_gpu_power_off(ptdev, L2, ptdev->gpu_info.l2_present, 20000);
+               panthor_hw_l2_power_off(ptdev);
 }
 
 /**
@@ -1365,7 +1366,7 @@ int panthor_fw_init(struct panthor_device *ptdev)
                return ret;
        }
 
-       ret = panthor_gpu_l2_power_on(ptdev);
+       ret = panthor_hw_l2_power_on(ptdev);
        if (ret)
                return ret;
 
index eda6702291841a94ebd7d3f2b5bfb416e0222201..06b231b2460ab5cc34013e7a398c21b66367bdbb 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "panthor_device.h"
 #include "panthor_gpu.h"
+#include "panthor_hw.h"
 #include "panthor_regs.h"
 
 /**
@@ -241,6 +242,11 @@ int panthor_gpu_block_power_on(struct panthor_device *ptdev,
        return 0;
 }
 
+void panthor_gpu_l2_power_off(struct panthor_device *ptdev)
+{
+       panthor_gpu_power_off(ptdev, L2, ptdev->gpu_info.l2_present, 20000);
+}
+
 /**
  * panthor_gpu_l2_power_on() - Power-on the L2-cache
  * @ptdev: Device.
@@ -368,9 +374,9 @@ void panthor_gpu_suspend(struct panthor_device *ptdev)
 {
        /* On a fast reset, simply power down the L2. */
        if (!ptdev->reset.fast)
-               panthor_gpu_soft_reset(ptdev);
+               panthor_hw_soft_reset(ptdev);
        else
-               panthor_gpu_power_off(ptdev, L2, 1, 20000);
+               panthor_hw_l2_power_off(ptdev);
 
        panthor_gpu_irq_suspend(&ptdev->gpu->irq);
 }
@@ -385,6 +391,6 @@ void panthor_gpu_suspend(struct panthor_device *ptdev)
 void panthor_gpu_resume(struct panthor_device *ptdev)
 {
        panthor_gpu_irq_resume(&ptdev->gpu->irq, GPU_INTERRUPTS_MASK);
-       panthor_gpu_l2_power_on(ptdev);
+       panthor_hw_l2_power_on(ptdev);
 }
 
index 7c17a8c0685816327a46071f0607a1381a7a7233..12e66f48ced154e4ff35455ab9c40316cdc82b2c 100644 (file)
@@ -46,6 +46,7 @@ int panthor_gpu_block_power_off(struct panthor_device *ptdev,
                                   type ## _PWRTRANS, \
                                   mask, timeout_us)
 
+void panthor_gpu_l2_power_off(struct panthor_device *ptdev);
 int panthor_gpu_l2_power_on(struct panthor_device *ptdev);
 int panthor_gpu_flush_caches(struct panthor_device *ptdev,
                             u32 l2, u32 lsc, u32 other);
index 5b5a82e15f86e8d1707ae565b283920e29e743c2..5d220a0e2c2242714118c4915ba92f2a27b126ad 100644 (file)
@@ -4,6 +4,7 @@
 #include <drm/drm_print.h>
 
 #include "panthor_device.h"
+#include "panthor_gpu.h"
 #include "panthor_hw.h"
 #include "panthor_regs.h"
 
@@ -22,7 +23,13 @@ struct panthor_hw_entry {
        struct panthor_hw *hwdev;
 };
 
-static struct panthor_hw panthor_hw_arch_v10 = {};
+static struct panthor_hw panthor_hw_arch_v10 = {
+       .ops = {
+               .soft_reset = panthor_gpu_soft_reset,
+               .l2_power_off = panthor_gpu_l2_power_off,
+               .l2_power_on = panthor_gpu_l2_power_on,
+       },
+};
 
 static struct panthor_hw_entry panthor_hw_match[] = {
        {
index 39752de3e7adcfe97aa4173b0f45f1a18774a5a3..64616caa6f05e6f0f7c8754fe0e6d886400696ed 100644 (file)
@@ -4,14 +4,47 @@
 #ifndef __PANTHOR_HW_H__
 #define __PANTHOR_HW_H__
 
-struct panthor_device;
+#include "panthor_device.h"
+
+/**
+ * struct panthor_hw_ops - HW operations that are specific to a GPU
+ */
+struct panthor_hw_ops {
+       /** @soft_reset: Soft reset function pointer */
+       int (*soft_reset)(struct panthor_device *ptdev);
+
+       /** @l2_power_off: L2 power off function pointer */
+       void (*l2_power_off)(struct panthor_device *ptdev);
+
+       /** @l2_power_on: L2 power on function pointer */
+       int (*l2_power_on)(struct panthor_device *ptdev);
+};
 
 /**
  * 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;
 };
 
 int panthor_hw_init(struct panthor_device *ptdev);
 
+static inline int panthor_hw_soft_reset(struct panthor_device *ptdev)
+{
+       return ptdev->hw->ops.soft_reset(ptdev);
+}
+
+static inline int panthor_hw_l2_power_on(struct panthor_device *ptdev)
+{
+       return ptdev->hw->ops.l2_power_on(ptdev);
+}
+
+static inline void panthor_hw_l2_power_off(struct panthor_device *ptdev)
+{
+       ptdev->hw->ops.l2_power_off(ptdev);
+}
+
 #endif /* __PANTHOR_HW_H__ */