[Intel-gfx] [PATCH 1/2] drm/i915: move trace_i915_reg_rw() to a separate file

Lucas De Marchi lucas.demarchi at intel.com
Mon May 18 23:30:48 UTC 2020


Currently we can't call trace_i915_reg_rw() from some headers due to
include order and i915_trace.h needing some struct definitions.

Move the declaration of trace_i915_reg_rw() to another file so it can be
included separately. Note that the trace points are still defined by
i915_trace_point.c which contains all trace points for i915. As such the
i915_trace_reg_rw() is just declared in a separate header, but its
definition is still in a single place.

Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 drivers/gpu/drm/i915/i915_trace.h        | 30 ++---------------
 drivers/gpu/drm/i915/i915_trace_reg_rw.h | 42 ++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 28 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/i915_trace_reg_rw.h

diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
index bc854ad60954..24b8e41600af 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -914,34 +914,6 @@ DEFINE_EVENT(i915_request, i915_request_wait_end,
 	    TP_ARGS(rq)
 );
 
-TRACE_EVENT_CONDITION(i915_reg_rw,
-	TP_PROTO(bool write, i915_reg_t reg, u64 val, int len, bool trace),
-
-	TP_ARGS(write, reg, val, len, trace),
-
-	TP_CONDITION(trace),
-
-	TP_STRUCT__entry(
-		__field(u64, val)
-		__field(u32, reg)
-		__field(u16, write)
-		__field(u16, len)
-		),
-
-	TP_fast_assign(
-		__entry->val = (u64)val;
-		__entry->reg = i915_mmio_reg_offset(reg);
-		__entry->write = write;
-		__entry->len = len;
-		),
-
-	TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
-		__entry->write ? "write" : "read",
-		__entry->reg, __entry->len,
-		(u32)(__entry->val & 0xffffffff),
-		(u32)(__entry->val >> 32))
-);
-
 TRACE_EVENT(intel_gpu_freq_change,
 	    TP_PROTO(u32 freq),
 	    TP_ARGS(freq),
@@ -1031,6 +1003,8 @@ DEFINE_EVENT(i915_context, i915_context_free,
 	TP_ARGS(ctx)
 );
 
+#include "i915_trace_reg_rw.h"
+
 #endif /* _I915_TRACE_H_ */
 
 /* This part must be outside protection */
diff --git a/drivers/gpu/drm/i915/i915_trace_reg_rw.h b/drivers/gpu/drm/i915/i915_trace_reg_rw.h
new file mode 100644
index 000000000000..2b0f2f00fbc9
--- /dev/null
+++ b/drivers/gpu/drm/i915/i915_trace_reg_rw.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * protect against inclusions if it has already being included by the main file
+ */
+#if !defined(_I915_TRACE_REG_RW_H_) ||  defined(TRACE_HEADER_MULTI_READ)
+#define _I915_TRACE_REG_RW_H_
+
+#include <linux/stringify.h>
+#include <linux/types.h>
+#include <linux/tracepoint.h>
+
+#include "i915_reg.h"
+
+TRACE_EVENT_CONDITION(i915_reg_rw,
+	TP_PROTO(bool write, i915_reg_t reg, u64 val, int len, bool trace),
+
+	TP_ARGS(write, reg, val, len, trace),
+
+	TP_CONDITION(trace),
+
+	TP_STRUCT__entry(
+		__field(u64, val)
+		__field(u32, reg)
+		__field(u16, write)
+		__field(u16, len)
+		),
+
+	TP_fast_assign(
+		__entry->val = (u64)val;
+		__entry->reg = i915_mmio_reg_offset(reg);
+		__entry->write = write;
+		__entry->len = len;
+		),
+
+	TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)",
+		__entry->write ? "write" : "read",
+		__entry->reg, __entry->len,
+		(u32)(__entry->val & 0xffffffff),
+		(u32)(__entry->val >> 32))
+);
+
+#endif
-- 
2.26.0



More information about the Intel-gfx mailing list