drm/tegra: dc: Trace register accesses
authorThierry Reding <treding@nvidia.com>
Tue, 15 Aug 2017 13:41:10 +0000 (15:41 +0200)
committerThierry Reding <treding@nvidia.com>
Thu, 17 Aug 2017 15:57:14 +0000 (17:57 +0200)
Add tracepoint events for display controller register accesses.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/Makefile
drivers/gpu/drm/tegra/drm.h
drivers/gpu/drm/tegra/trace.c [new file with mode: 0644]
drivers/gpu/drm/tegra/trace.h [new file with mode: 0644]

index 6af3a9ad65656c572dc07aa1d8b6619102e30597..8927784396e841105fef38ec566185019b7f09dc 100644 (file)
@@ -17,4 +17,6 @@ tegra-drm-y := \
        falcon.o \
        vic.o
 
+tegra-drm-y += trace.o
+
 obj-$(CONFIG_DRM_TEGRA) += tegra-drm.o
index de1bcc51990539530a602535f93e7bfee156e3ae..063f5d397526c10af3eb7f4d160f111a11a8124f 100644 (file)
@@ -23,6 +23,7 @@
 #include <drm/drm_fixed.h>
 
 #include "gem.h"
+#include "trace.h"
 
 struct reset_control;
 
@@ -174,12 +175,17 @@ static inline struct tegra_dc *to_tegra_dc(struct drm_crtc *crtc)
 static inline void tegra_dc_writel(struct tegra_dc *dc, u32 value,
                                   unsigned int offset)
 {
+       trace_dc_writel(dc->dev, offset, value);
        writel(value, dc->regs + (offset << 2));
 }
 
 static inline u32 tegra_dc_readl(struct tegra_dc *dc, unsigned int offset)
 {
-       return readl(dc->regs + (offset << 2));
+       u32 value = readl(dc->regs + (offset << 2));
+
+       trace_dc_readl(dc->dev, offset, value);
+
+       return value;
 }
 
 struct tegra_dc_window {
diff --git a/drivers/gpu/drm/tegra/trace.c b/drivers/gpu/drm/tegra/trace.c
new file mode 100644 (file)
index 0000000..006f65c
--- /dev/null
@@ -0,0 +1,2 @@
+#define CREATE_TRACE_POINTS
+#include "trace.h"
diff --git a/drivers/gpu/drm/tegra/trace.h b/drivers/gpu/drm/tegra/trace.h
new file mode 100644 (file)
index 0000000..b32d90c
--- /dev/null
@@ -0,0 +1,40 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM tegra
+
+#if !defined(DRM_TEGRA_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define DRM_TEGRA_TRACE_H 1
+
+#include <linux/device.h>
+#include <linux/tracepoint.h>
+
+DECLARE_EVENT_CLASS(register_access,
+       TP_PROTO(struct device *dev, unsigned int offset, u32 value),
+       TP_ARGS(dev, offset, value),
+       TP_STRUCT__entry(
+               __field(struct device *, dev)
+               __field(unsigned int, offset)
+               __field(u32, value)
+       ),
+       TP_fast_assign(
+               __entry->dev = dev;
+               __entry->offset = offset;
+               __entry->value = value;
+       ),
+       TP_printk("%s %04x %08x", dev_name(__entry->dev), __entry->offset,
+                 __entry->value)
+);
+
+DEFINE_EVENT(register_access, dc_writel,
+       TP_PROTO(struct device *dev, unsigned int offset, u32 value),
+       TP_ARGS(dev, offset, value));
+DEFINE_EVENT(register_access, dc_readl,
+       TP_PROTO(struct device *dev, unsigned int offset, u32 value),
+       TP_ARGS(dev, offset, value));
+
+#endif /* DRM_TEGRA_TRACE_H */
+
+/* This part must be outside protection */
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE trace
+#include <trace/define_trace.h>