Skip to content

Commit ac9098b

Browse files
akhilpo-qcomRob Clark
authored andcommitted
drm/msm: Add an ftrace for gpu register access
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>
1 parent a477aa6 commit ac9098b

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

drivers/gpu/drm/msm/msm_gpu.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "msm_drv.h"
1818
#include "msm_fence.h"
19+
#include "msm_gpu_trace.h"
1920
#include "msm_ringbuffer.h"
2021
#include "msm_gem.h"
2122

@@ -613,16 +614,19 @@ struct msm_gpu_state {
613614

614615
static inline void gpu_write(struct msm_gpu *gpu, u32 reg, u32 data)
615616
{
617+
trace_msm_gpu_regaccess(reg);
616618
writel(data, gpu->mmio + (reg << 2));
617619
}
618620

619621
static inline u32 gpu_read(struct msm_gpu *gpu, u32 reg)
620622
{
623+
trace_msm_gpu_regaccess(reg);
621624
return readl(gpu->mmio + (reg << 2));
622625
}
623626

624627
static inline void gpu_rmw(struct msm_gpu *gpu, u32 reg, u32 mask, u32 or)
625628
{
629+
trace_msm_gpu_regaccess(reg);
626630
msm_rmw(gpu->mmio + (reg << 2), mask, or);
627631
}
628632

@@ -644,16 +648,20 @@ static inline u64 gpu_read64(struct msm_gpu *gpu, u32 reg)
644648
* when the lo is read, so make sure to read the lo first to trigger
645649
* that
646650
*/
651+
trace_msm_gpu_regaccess(reg);
647652
val = (u64) readl(gpu->mmio + (reg << 2));
653+
trace_msm_gpu_regaccess(reg+1);
648654
val |= ((u64) readl(gpu->mmio + ((reg + 1) << 2)) << 32);
649655

650656
return val;
651657
}
652658

653659
static inline void gpu_write64(struct msm_gpu *gpu, u32 reg, u64 val)
654660
{
661+
trace_msm_gpu_regaccess(reg);
655662
/* Why not a writeq here? Read the screed above */
656663
writel(lower_32_bits(val), gpu->mmio + (reg << 2));
664+
trace_msm_gpu_regaccess(reg+1);
657665
writel(upper_32_bits(val), gpu->mmio + ((reg + 1) << 2));
658666
}
659667

drivers/gpu/drm/msm/msm_gpu_trace.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,18 @@ TRACE_EVENT(msm_mmu_prealloc_cleanup,
219219
TP_printk("count=%u, remaining=%u", __entry->count, __entry->remaining)
220220
);
221221

222+
TRACE_EVENT(msm_gpu_regaccess,
223+
TP_PROTO(u32 offset),
224+
TP_ARGS(offset),
225+
TP_STRUCT__entry(
226+
__field(u32, offset)
227+
),
228+
TP_fast_assign(
229+
__entry->offset = offset;
230+
),
231+
TP_printk("offset=0x%x", __entry->offset)
232+
);
233+
222234
#endif
223235

224236
#undef TRACE_INCLUDE_PATH

0 commit comments

Comments
 (0)