linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Akhil P Oommen <akhilpo@oss.qualcomm.com>
To: Rob Clark <robin.clark@oss.qualcomm.com>,
	Sean Paul <sean@poorly.run>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Dmitry Baryshkov <lumag@kernel.org>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Jessica Zhang <jessica.zhang@oss.qualcomm.com>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Akhil P Oommen <akhilpo@oss.qualcomm.com>
Subject: [PATCH 06/17] drm/msm: Add an ftrace for gpu register access
Date: Sun, 20 Jul 2025 17:46:07 +0530	[thread overview]
Message-ID: <20250720-ifpc-support-v1-6-9347aa5bcbd6@oss.qualcomm.com> (raw)
In-Reply-To: <20250720-ifpc-support-v1-0-9347aa5bcbd6@oss.qualcomm.com>

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>
---
 drivers/gpu/drm/msm/msm_gpu.h       |  8 ++++++++
 drivers/gpu/drm/msm/msm_gpu_trace.h | 12 ++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index 5bf7cd985b9c50e38468fed695234f787919a8aa..a0a0cf9efb3a8035a80cbbbf30ad294a72ccbd48 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -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"
 
@@ -555,16 +556,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);
 }
 
@@ -586,7 +590,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;
@@ -594,8 +600,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));
 }
 
diff --git a/drivers/gpu/drm/msm/msm_gpu_trace.h b/drivers/gpu/drm/msm/msm_gpu_trace.h
index 7f863282db0d7812c8fd53b3f1fc0cd5635028ba..193dc9c8a7705c8988b8c4b60aa78a74e00af932 100644
--- a/drivers/gpu/drm/msm/msm_gpu_trace.h
+++ b/drivers/gpu/drm/msm/msm_gpu_trace.h
@@ -205,6 +205,18 @@ TRACE_EVENT(msm_gpu_preemption_irq,
 		TP_printk("preempted to %u", __entry->ring_id)
 );
 
+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

-- 
2.50.1


  parent reply	other threads:[~2025-07-20 12:17 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-20 12:16 [PATCH 00/17] drm/msm: Support for Inter Frame Power Collapse (IFPC) feature Akhil P Oommen
2025-07-20 12:16 ` [PATCH 01/17] drm/msm: Update GMU register xml Akhil P Oommen
2025-07-20 12:16 ` [PATCH 02/17] drm/msm: a6xx: Refactor a6xx_sptprac_enable() Akhil P Oommen
2025-07-22 14:30   ` Konrad Dybcio
2025-07-22 19:47     ` Akhil P Oommen
2025-07-23 10:13       ` Konrad Dybcio
2025-07-23 19:10         ` Akhil P Oommen
2025-07-20 12:16 ` [PATCH 03/17] drm/msm: a6xx: Fix gx_is_on check for a7x family Akhil P Oommen
2025-07-20 18:46   ` Dmitry Baryshkov
2025-07-22 14:33   ` Konrad Dybcio
2025-07-22 19:52     ` Akhil P Oommen
2025-07-23 11:10       ` Dmitry Baryshkov
2025-07-23 19:11         ` Akhil P Oommen
2025-07-20 12:16 ` [PATCH 04/17] drm/msm/a6xx: Poll additional DRV status Akhil P Oommen
2025-07-22 13:31   ` Dmitry Baryshkov
2025-07-22 19:55     ` Akhil P Oommen
2025-07-23 10:01   ` Konrad Dybcio
2025-07-23 19:28     ` Akhil P Oommen
2025-07-24 11:39       ` Konrad Dybcio
2025-07-20 12:16 ` [PATCH 05/17] drm/msm/a6xx: Fix PDC sleep sequence Akhil P Oommen
2025-07-22 13:33   ` Dmitry Baryshkov
2025-07-22 17:26     ` Rob Clark
2025-07-22 21:05       ` Akhil P Oommen
2025-07-23 11:11         ` Dmitry Baryshkov
2025-08-07 13:51   ` Konrad Dybcio
2025-08-08 17:22     ` Akhil P Oommen
2025-08-11  8:40       ` Konrad Dybcio
2025-08-13 21:15         ` Akhil P Oommen
2025-07-20 12:16 ` Akhil P Oommen [this message]
2025-07-20 12:16 ` [PATCH 07/17] drm/msm/adreno: Add fenced regwrite support Akhil P Oommen
2025-07-22 13:39   ` Dmitry Baryshkov
2025-07-22 14:52     ` Konrad Dybcio
2025-07-23 21:06       ` Akhil P Oommen
2025-07-24 11:46         ` Konrad Dybcio
2025-07-24 16:54           ` Akhil P Oommen
2025-07-29 13:01             ` Konrad Dybcio
2025-07-29 21:40               ` Akhil P Oommen
2025-07-29 21:49                 ` Akhil P Oommen
2025-07-30  7:49                   ` Konrad Dybcio
2025-07-23 21:04     ` Akhil P Oommen
2025-07-20 12:16 ` [PATCH 08/17] drm/msm/a6xx: Set Keep-alive votes to block IFPC Akhil P Oommen
2025-07-22 13:44   ` Dmitry Baryshkov
2025-07-22 21:24     ` Akhil P Oommen
2025-07-23 10:05       ` Konrad Dybcio
2025-07-23 21:22         ` Akhil P Oommen
2025-07-23 21:53           ` Dmitry Baryshkov
2025-07-23 11:13       ` Dmitry Baryshkov
2025-07-20 12:16 ` [PATCH 09/17] drm/msm/a6xx: Switch to GMU AO counter Akhil P Oommen
2025-07-23 10:19   ` Konrad Dybcio
2025-07-23 12:15     ` Rob Clark
2025-07-29 13:30       ` Konrad Dybcio
2025-07-20 12:16 ` [PATCH 10/17] drm/msm/a6xx: Poll AHB fence status in GPU IRQ handler Akhil P Oommen
2025-07-23 10:10   ` Konrad Dybcio
2025-07-20 12:16 ` [PATCH 11/17] drm/msm: Add support for IFPC Akhil P Oommen
2025-07-22 13:49   ` Dmitry Baryshkov
2025-07-22 21:27     ` Akhil P Oommen
2025-07-23 10:27       ` Konrad Dybcio
2025-07-23 21:43         ` Akhil P Oommen
2025-07-23 10:22   ` Konrad Dybcio
2025-07-20 12:16 ` [PATCH 12/17] drm/msm: Skip devfreq IDLE when possible Akhil P Oommen
2025-07-21  4:00   ` kernel test robot
2025-07-22 13:50   ` Dmitry Baryshkov
2025-07-22 15:38     ` Rob Clark
2025-07-22 19:23       ` Akhil P Oommen
2025-07-22 20:13         ` Rob Clark
2025-07-23 21:46           ` Akhil P Oommen
2025-07-23 10:28   ` Konrad Dybcio
2025-07-20 12:16 ` [PATCH 13/17] drm/msm/a6xx: Fix hangcheck for IFPC Akhil P Oommen
2025-07-22 13:52   ` Dmitry Baryshkov
2025-07-22 21:33     ` Akhil P Oommen
2025-07-20 12:16 ` [PATCH 14/17] drm/msm/adreno: Disable IFPC when sysprof is active Akhil P Oommen
2025-07-20 12:16 ` [PATCH 15/17] drm/msm/a6xx: Make crashstate capture IFPC safe Akhil P Oommen
2025-07-23 10:32   ` Konrad Dybcio
2025-07-23 21:53     ` Akhil P Oommen
2025-07-20 12:16 ` [PATCH 16/17] drm/msm/a6xx: Enable IFPC on Adreno X1-85 Akhil P Oommen
2025-07-22 13:55   ` Dmitry Baryshkov
2025-07-22 21:37     ` Akhil P Oommen
2025-07-23 10:33       ` Konrad Dybcio
2025-07-23 21:57         ` Akhil P Oommen
2025-07-22 14:55   ` Konrad Dybcio
2025-07-22 21:41     ` Akhil P Oommen
2025-07-29 14:06   ` neil.armstrong
2025-07-29 18:19     ` Akhil P Oommen
2025-07-20 12:16 ` [PATCH 17/17] drm/msm/adreno: Relax devfreq tunings Akhil P Oommen
2025-07-27  0:49   ` Anthony Ruhier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250720-ifpc-support-v1-6-9347aa5bcbd6@oss.qualcomm.com \
    --to=akhilpo@oss.qualcomm.com \
    --cc=abhinav.kumar@linux.dev \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jessica.zhang@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=robin.clark@oss.qualcomm.com \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).