[PATCH] drm/amdgpu: add pci BDF info in trace amdgpu_device_r[w]reg()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



add pci BDF info in amdgpu_device_r[w]reg trace event to support
muti-device in one host.

Signed-off-by: Kevin Wang <kevin1.wang@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h  | 53 +++++++++++++---------
 2 files changed, 33 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 71805dfd9e25..8819672d3ecb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -355,7 +355,7 @@ uint32_t amdgpu_device_rreg(struct amdgpu_device *adev,
 		ret = adev->pcie_rreg(adev, reg * 4);
 	}
 
-	trace_amdgpu_device_rreg(adev->pdev->device, reg, ret);
+	trace_amdgpu_device_rreg(adev->pdev, reg, ret);
 
 	return ret;
 }
@@ -440,7 +440,7 @@ void amdgpu_device_wreg(struct amdgpu_device *adev,
 		adev->pcie_wreg(adev, reg * 4, v);
 	}
 
-	trace_amdgpu_device_wreg(adev->pdev->device, reg, v);
+	trace_amdgpu_device_wreg(adev->pdev, reg, v);
 }
 
 /*
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
index ce8dc995c10c..1fa774fb805e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
@@ -35,42 +35,51 @@
 #define AMDGPU_JOB_GET_TIMELINE_NAME(job) \
 	 job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished)
 
+
 TRACE_EVENT(amdgpu_device_rreg,
-	    TP_PROTO(unsigned did, uint32_t reg, uint32_t value),
-	    TP_ARGS(did, reg, value),
+	    TP_PROTO(struct pci_dev *pdev, uint32_t reg, uint32_t value),
+	    TP_ARGS(pdev, reg, value),
 	    TP_STRUCT__entry(
-				__field(unsigned, did)
-				__field(uint32_t, reg)
-				__field(uint32_t, value)
+			     __field(uint16_t, device)
+			     __field(uint8_t, bus)
+			     __field(uint8_t, devfn)
+			     __field(uint32_t, reg)
+			     __field(uint32_t, value)
 			    ),
 	    TP_fast_assign(
-			   __entry->did = did;
+			   __entry->device = pdev->device;
+			   __entry->bus = pdev->bus->number;
+			   __entry->devfn = pdev->devfn;
 			   __entry->reg = reg;
 			   __entry->value = value;
-			   ),
-	    TP_printk("0x%04lx, 0x%08lx, 0x%08lx",
-		      (unsigned long)__entry->did,
-		      (unsigned long)__entry->reg,
-		      (unsigned long)__entry->value)
+			  ),
+	    TP_printk("%04x %02x:%02x.%1x: 0x%08x, 0x%08x",
+		      __entry->device,
+		      __entry->bus, __entry->devfn >> 3, __entry->devfn & 0x7,
+		      __entry->reg, __entry->value)
 );
 
 TRACE_EVENT(amdgpu_device_wreg,
-	    TP_PROTO(unsigned did, uint32_t reg, uint32_t value),
-	    TP_ARGS(did, reg, value),
+	    TP_PROTO(struct pci_dev *pdev, uint32_t reg, uint32_t value),
+	    TP_ARGS(pdev, reg, value),
 	    TP_STRUCT__entry(
-				__field(unsigned, did)
-				__field(uint32_t, reg)
-				__field(uint32_t, value)
+			     __field(uint16_t, device)
+			     __field(uint8_t, bus)
+			     __field(uint8_t, devfn)
+			     __field(uint32_t, reg)
+			     __field(uint32_t, value)
 			    ),
 	    TP_fast_assign(
-			   __entry->did = did;
+			   __entry->device = pdev->device;
+			   __entry->bus = pdev->bus->number;
+			   __entry->devfn = pdev->devfn;
 			   __entry->reg = reg;
 			   __entry->value = value;
-			   ),
-	    TP_printk("0x%04lx, 0x%08lx, 0x%08lx",
-		      (unsigned long)__entry->did,
-		      (unsigned long)__entry->reg,
-		      (unsigned long)__entry->value)
+			  ),
+	    TP_printk("%04x %02x:%02x.%1x: 0x%08x, 0x%08x",
+		      __entry->device,
+		      __entry->bus, __entry->devfn >> 3, __entry->devfn & 0x7,
+		      __entry->reg, __entry->value)
 );
 
 TRACE_EVENT(amdgpu_iv,
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux