]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
drm/amdgpu/trace: Add tracepoints to MMIO read/writes
authorTom St Denis <tom.stdenis@amd.com>
Tue, 31 May 2016 12:02:27 +0000 (08:02 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 18:51:15 +0000 (14:51 -0400)
Add tracepoints to the MMIO read/write so we can log
MMIO traffic.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h

index aa146452b4f695b1212ff2957af62bea28bc1c1e..df0953d3b1abb5a0c302307cfedfc99930f98b75 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/vga_switcheroo.h>
 #include <linux/efi.h>
 #include "amdgpu.h"
+#include "amdgpu_trace.h"
 #include "amdgpu_i2c.h"
 #include "atom.h"
 #include "amdgpu_atombios.h"
@@ -79,24 +80,27 @@ bool amdgpu_device_is_px(struct drm_device *dev)
 uint32_t amdgpu_mm_rreg(struct amdgpu_device *adev, uint32_t reg,
                        bool always_indirect)
 {
+       uint32_t ret;
+
        if ((reg * 4) < adev->rmmio_size && !always_indirect)
-               return readl(((void __iomem *)adev->rmmio) + (reg * 4));
+               ret = readl(((void __iomem *)adev->rmmio) + (reg * 4));
        else {
                unsigned long flags;
-               uint32_t ret;
 
                spin_lock_irqsave(&adev->mmio_idx_lock, flags);
                writel((reg * 4), ((void __iomem *)adev->rmmio) + (mmMM_INDEX * 4));
                ret = readl(((void __iomem *)adev->rmmio) + (mmMM_DATA * 4));
                spin_unlock_irqrestore(&adev->mmio_idx_lock, flags);
-
-               return ret;
        }
+       trace_amdgpu_mm_rreg(adev->pdev->device, reg, ret);
+       return ret;
 }
 
 void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v,
                    bool always_indirect)
 {
+       trace_amdgpu_mm_wreg(adev->pdev->device, reg, v);
+       
        if ((reg * 4) < adev->rmmio_size && !always_indirect)
                writel(v, ((void __iomem *)adev->rmmio) + (reg * 4));
        else {
index 26a5f4acf5840ed6218a49cd654b678005431481..38e56890043c34ff9bccc0dcd328bf66eb7cf7c3 100644 (file)
 #define TRACE_SYSTEM amdgpu
 #define TRACE_INCLUDE_FILE amdgpu_trace
 
+TRACE_EVENT(amdgpu_mm_rreg,
+           TP_PROTO(unsigned did, uint32_t reg, uint32_t value),
+           TP_ARGS(did, reg, value),
+           TP_STRUCT__entry(
+                               __field(unsigned, did)
+                               __field(uint32_t, reg)
+                               __field(uint32_t, value)
+                           ),
+           TP_fast_assign(
+                          __entry->did = did;
+                          __entry->reg = reg;
+                          __entry->value = value;
+                          ),
+           TP_printk("0x%04lx, 0x%04lx, 0x%08lx",
+                     (unsigned long)__entry->did,
+                     (unsigned long)__entry->reg,
+                     (unsigned long)__entry->value)
+);
+
+TRACE_EVENT(amdgpu_mm_wreg,
+           TP_PROTO(unsigned did, uint32_t reg, uint32_t value),
+           TP_ARGS(did, reg, value),
+           TP_STRUCT__entry(
+                               __field(unsigned, did)
+                               __field(uint32_t, reg)
+                               __field(uint32_t, value)
+                           ),
+           TP_fast_assign(
+                          __entry->did = did;
+                          __entry->reg = reg;
+                          __entry->value = value;
+                          ),
+           TP_printk("0x%04lx, 0x%04lx, 0x%08lx",
+                     (unsigned long)__entry->did,
+                     (unsigned long)__entry->reg,
+                     (unsigned long)__entry->value)
+);
+
 TRACE_EVENT(amdgpu_bo_create,
            TP_PROTO(struct amdgpu_bo *bo),
            TP_ARGS(bo),