]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/msm: Add an ftrace for gpu register access
authorAkhil P Oommen <akhilpo@oss.qualcomm.com>
Mon, 8 Sep 2025 08:26:59 +0000 (13:56 +0530)
committerRob Clark <robin.clark@oss.qualcomm.com>
Mon, 8 Sep 2025 14:24:59 +0000 (07:24 -0700)
With IFPC, there is a probability of accessing a GX domain register when
it is collapsed, which leads to gmu fence errors. To debug this, we need
to trace every gpu register accesses and identify the one just before a
gmu fence error. So, add an ftrace to track all gpu register accesses.

Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/673366/
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
drivers/gpu/drm/msm/msm_gpu.h
drivers/gpu/drm/msm/msm_gpu_trace.h

index b2a96544f92a55cdb372729498b8f0b0f9ca80bd..866bb090af064666586cea7125254bd375b7a35c 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "msm_drv.h"
 #include "msm_fence.h"
+#include "msm_gpu_trace.h"
 #include "msm_ringbuffer.h"
 #include "msm_gem.h"
 
@@ -613,16 +614,19 @@ struct msm_gpu_state {
 
 static inline void gpu_write(struct msm_gpu *gpu, u32 reg, u32 data)
 {
+       trace_msm_gpu_regaccess(reg);
        writel(data, gpu->mmio + (reg << 2));
 }
 
 static inline u32 gpu_read(struct msm_gpu *gpu, u32 reg)
 {
+       trace_msm_gpu_regaccess(reg);
        return readl(gpu->mmio + (reg << 2));
 }
 
 static inline void gpu_rmw(struct msm_gpu *gpu, u32 reg, u32 mask, u32 or)
 {
+       trace_msm_gpu_regaccess(reg);
        msm_rmw(gpu->mmio + (reg << 2), mask, or);
 }
 
@@ -644,7 +648,9 @@ static inline u64 gpu_read64(struct msm_gpu *gpu, u32 reg)
         * when the lo is read, so make sure to read the lo first to trigger
         * that
         */
+       trace_msm_gpu_regaccess(reg);
        val = (u64) readl(gpu->mmio + (reg << 2));
+       trace_msm_gpu_regaccess(reg+1);
        val |= ((u64) readl(gpu->mmio + ((reg + 1) << 2)) << 32);
 
        return val;
@@ -652,8 +658,10 @@ static inline u64 gpu_read64(struct msm_gpu *gpu, u32 reg)
 
 static inline void gpu_write64(struct msm_gpu *gpu, u32 reg, u64 val)
 {
+       trace_msm_gpu_regaccess(reg);
        /* Why not a writeq here? Read the screed above */
        writel(lower_32_bits(val), gpu->mmio + (reg << 2));
+       trace_msm_gpu_regaccess(reg+1);
        writel(upper_32_bits(val), gpu->mmio + ((reg + 1) << 2));
 }
 
index 781bbe5540bde6d9cd6758050229fd0406fad232..5417f8d389a370e8d0b9c7e447050e2965011c0a 100644 (file)
@@ -219,6 +219,18 @@ TRACE_EVENT(msm_mmu_prealloc_cleanup,
                TP_printk("count=%u, remaining=%u", __entry->count, __entry->remaining)
 );
 
+TRACE_EVENT(msm_gpu_regaccess,
+               TP_PROTO(u32 offset),
+               TP_ARGS(offset),
+               TP_STRUCT__entry(
+                       __field(u32, offset)
+                       ),
+               TP_fast_assign(
+                       __entry->offset = offset;
+                       ),
+               TP_printk("offset=0x%x", __entry->offset)
+);
+
 #endif
 
 #undef TRACE_INCLUDE_PATH