1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2015 Broadcom
4  */
5 
6 #if !defined(_VC4_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
7 #define _VC4_TRACE_H_
8 
9 #include <linux/stringify.h>
10 #include <linux/types.h>
11 #include <linux/tracepoint.h>
12 
13 #undef TRACE_SYSTEM
14 #define TRACE_SYSTEM vc4
15 #define TRACE_INCLUDE_FILE vc4_trace
16 
17 TRACE_EVENT(vc4_wait_for_seqno_begin,
18 	    TP_PROTO(struct drm_device *dev, uint64_t seqno, uint64_t timeout),
19 	    TP_ARGS(dev, seqno, timeout),
20 
21 	    TP_STRUCT__entry(
22 			     __field(u32, dev)
23 			     __field(u64, seqno)
24 			     __field(u64, timeout)
25 			     ),
26 
27 	    TP_fast_assign(
28 			   __entry->dev = dev->primary->index;
29 			   __entry->seqno = seqno;
30 			   __entry->timeout = timeout;
31 			   ),
32 
33 	    TP_printk("dev=%u, seqno=%llu, timeout=%llu",
34 		      __entry->dev, __entry->seqno, __entry->timeout)
35 );
36 
37 TRACE_EVENT(vc4_wait_for_seqno_end,
38 	    TP_PROTO(struct drm_device *dev, uint64_t seqno),
39 	    TP_ARGS(dev, seqno),
40 
41 	    TP_STRUCT__entry(
42 			     __field(u32, dev)
43 			     __field(u64, seqno)
44 			     ),
45 
46 	    TP_fast_assign(
47 			   __entry->dev = dev->primary->index;
48 			   __entry->seqno = seqno;
49 			   ),
50 
51 	    TP_printk("dev=%u, seqno=%llu",
52 		      __entry->dev, __entry->seqno)
53 );
54 
55 TRACE_EVENT(vc4_submit_cl_ioctl,
56 	    TP_PROTO(struct drm_device *dev, u32 bin_cl_size, u32 shader_rec_size, u32 bo_count),
57 	    TP_ARGS(dev, bin_cl_size, shader_rec_size, bo_count),
58 
59 	    TP_STRUCT__entry(
60 			     __field(u32, dev)
61 			     __field(u32, bin_cl_size)
62 			     __field(u32, shader_rec_size)
63 			     __field(u32, bo_count)
64 			     ),
65 
66 	    TP_fast_assign(
67 			   __entry->dev = dev->primary->index;
68 			   __entry->bin_cl_size = bin_cl_size;
69 			   __entry->shader_rec_size = shader_rec_size;
70 			   __entry->bo_count = bo_count;
71 			   ),
72 
73 	    TP_printk("dev=%u, bin_cl_size=%u, shader_rec_size=%u, bo_count=%u",
74 		      __entry->dev,
75 		      __entry->bin_cl_size,
76 		      __entry->shader_rec_size,
77 		      __entry->bo_count)
78 );
79 
80 TRACE_EVENT(vc4_submit_cl,
81 	    TP_PROTO(struct drm_device *dev, bool is_render,
82 		     uint64_t seqno,
83 		     u32 ctnqba, u32 ctnqea),
84 	    TP_ARGS(dev, is_render, seqno, ctnqba, ctnqea),
85 
86 	    TP_STRUCT__entry(
87 			     __field(u32, dev)
88 			     __field(bool, is_render)
89 			     __field(u64, seqno)
90 			     __field(u32, ctnqba)
91 			     __field(u32, ctnqea)
92 			     ),
93 
94 	    TP_fast_assign(
95 			   __entry->dev = dev->primary->index;
96 			   __entry->is_render = is_render;
97 			   __entry->seqno = seqno;
98 			   __entry->ctnqba = ctnqba;
99 			   __entry->ctnqea = ctnqea;
100 			   ),
101 
102 	    TP_printk("dev=%u, %s, seqno=%llu, 0x%08x..0x%08x",
103 		      __entry->dev,
104 		      __entry->is_render ? "RCL" : "BCL",
105 		      __entry->seqno,
106 		      __entry->ctnqba,
107 		      __entry->ctnqea)
108 );
109 
110 TRACE_EVENT(vc4_bcl_end_irq,
111 	    TP_PROTO(struct drm_device *dev,
112 		     uint64_t seqno),
113 	    TP_ARGS(dev, seqno),
114 
115 	    TP_STRUCT__entry(
116 			     __field(u32, dev)
117 			     __field(u64, seqno)
118 			     ),
119 
120 	    TP_fast_assign(
121 			   __entry->dev = dev->primary->index;
122 			   __entry->seqno = seqno;
123 			   ),
124 
125 	    TP_printk("dev=%u, seqno=%llu",
126 		      __entry->dev,
127 		      __entry->seqno)
128 );
129 
130 TRACE_EVENT(vc4_rcl_end_irq,
131 	    TP_PROTO(struct drm_device *dev,
132 		     uint64_t seqno),
133 	    TP_ARGS(dev, seqno),
134 
135 	    TP_STRUCT__entry(
136 			     __field(u32, dev)
137 			     __field(u64, seqno)
138 			     ),
139 
140 	    TP_fast_assign(
141 			   __entry->dev = dev->primary->index;
142 			   __entry->seqno = seqno;
143 			   ),
144 
145 	    TP_printk("dev=%u, seqno=%llu",
146 		      __entry->dev,
147 		      __entry->seqno)
148 );
149 
150 #endif /* _VC4_TRACE_H_ */
151 
152 /* This part must be outside protection */
153 #undef TRACE_INCLUDE_PATH
154 #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/vc4
155 #include <trace/define_trace.h>
156