1 /*************************************************************************/ /*!
3 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @License Dual MIT/GPLv2
6 The contents of this file are subject to the MIT license as set out below.
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
18 Alternatively, the contents of this file may be used under the terms of
19 the GNU General Public License Version 2 ("GPL") in which case the provisions
20 of GPL are applicable instead of those above.
22 If you wish to allow use of your version of this file only under the terms of
23 GPL, and not to allow others to use your version of this file under the terms
24 of the MIT license, indicate your decision by deleting the provisions above
25 and replace them with the notice and other provisions required by GPL as set
26 out in the file called "GPL-COPYING" included in this distribution. If you do
27 not delete the provisions above, a recipient may use your version of this file
28 under the terms of either the MIT license or GPL.
30 This License is also included in this distribution in the file called
33 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
34 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
35 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
37 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
38 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
39 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40 */ /**************************************************************************/
42 #define TRACE_SYSTEM rogue
44 #if !defined(_ROGUE_TRACE_EVENTS_H) || defined(TRACE_HEADER_MULTI_READ)
45 #define _ROGUE_TRACE_EVENTS_H
47 #include <linux/tracepoint.h>
48 #include <linux/time.h>
50 #define show_secs_from_ns(ns) \
52 u64 t = ns + (NSEC_PER_USEC / 2); \
53 do_div(t, NSEC_PER_SEC); \
57 #define show_usecs_from_ns(ns) \
59 u64 t = ns + (NSEC_PER_USEC / 2) ; \
61 do_div(t, NSEC_PER_USEC); \
62 rem = do_div(t, USEC_PER_SEC); \
65 void trace_fence_update_enabled_callback(void);
66 void trace_fence_update_disabled_callback(void);
68 TRACE_EVENT_FN(rogue_fence_update,
70 TP_PROTO(const char *comm, const char *cmd, const char *dm, u32 ctx_id, u32 offset,
71 u32 sync_fwaddr, u32 sync_value),
73 TP_ARGS(comm, cmd, dm, ctx_id, offset, sync_fwaddr, sync_value),
76 __string( comm, comm )
79 __field( u32, ctx_id )
80 __field( u32, offset )
81 __field( u32, sync_fwaddr )
82 __field( u32, sync_value )
86 __assign_str(comm, comm);
87 __assign_str(cmd, cmd);
89 __entry->ctx_id = ctx_id;
90 __entry->offset = offset;
91 __entry->sync_fwaddr = sync_fwaddr;
92 __entry->sync_value = sync_value;
95 TP_printk("comm=%s cmd=%s dm=%s ctx_id=%lu offset=%lu sync_fwaddr=%#lx sync_value=%#lx",
99 (unsigned long)__entry->ctx_id,
100 (unsigned long)__entry->offset,
101 (unsigned long)__entry->sync_fwaddr,
102 (unsigned long)__entry->sync_value),
104 trace_fence_update_enabled_callback,
105 trace_fence_update_disabled_callback
108 void trace_fence_check_enabled_callback(void);
109 void trace_fence_check_disabled_callback(void);
111 TRACE_EVENT_FN(rogue_fence_check,
113 TP_PROTO(const char *comm, const char *cmd, const char *dm, u32 ctx_id, u32 offset,
114 u32 sync_fwaddr, u32 sync_value),
116 TP_ARGS(comm, cmd, dm, ctx_id, offset, sync_fwaddr, sync_value),
119 __string( comm, comm )
122 __field( u32, ctx_id )
123 __field( u32, offset )
124 __field( u32, sync_fwaddr )
125 __field( u32, sync_value )
129 __assign_str(comm, comm);
130 __assign_str(cmd, cmd);
131 __assign_str(dm, dm);
132 __entry->ctx_id = ctx_id;
133 __entry->offset = offset;
134 __entry->sync_fwaddr = sync_fwaddr;
135 __entry->sync_value = sync_value;
138 TP_printk("comm=%s cmd=%s dm=%s ctx_id=%lu offset=%lu sync_fwaddr=%#lx sync_value=%#lx",
142 (unsigned long)__entry->ctx_id,
143 (unsigned long)__entry->offset,
144 (unsigned long)__entry->sync_fwaddr,
145 (unsigned long)__entry->sync_value),
147 trace_fence_check_enabled_callback,
148 trace_fence_check_disabled_callback
151 TRACE_EVENT(rogue_create_fw_context,
153 TP_PROTO(const char *comm, const char *dm, u32 ctx_id),
155 TP_ARGS(comm, dm, ctx_id),
158 __string( comm, comm )
160 __field( u32, ctx_id )
164 __assign_str(comm, comm);
165 __assign_str(dm, dm);
166 __entry->ctx_id = ctx_id;
169 TP_printk("comm=%s dm=%s ctx_id=%lu",
172 (unsigned long)__entry->ctx_id)
175 #if defined(SUPPORT_GPUTRACE_EVENTS)
177 void PVRGpuTraceEnableUfoCallback(void);
178 void PVRGpuTraceDisableUfoCallback(void);
180 TRACE_EVENT_FN(rogue_ufo_update,
182 TP_PROTO(u64 timestamp, u32 ctx_id, u32 job_id, u32 fwaddr,
183 u32 old_value, u32 new_value),
185 TP_ARGS(timestamp, ctx_id, job_id, fwaddr, old_value, new_value),
188 __field( u64, timestamp )
189 __field( u32, ctx_id )
190 __field( u32, job_id )
191 __field( u32, fwaddr )
192 __field( u32, old_value )
193 __field( u32, new_value )
197 __entry->timestamp = timestamp;
198 __entry->ctx_id = ctx_id;
199 __entry->job_id = job_id;
200 __entry->fwaddr = fwaddr;
201 __entry->old_value = old_value;
202 __entry->new_value = new_value;
205 TP_printk("ts=%llu.%06lu ctx_id=%lu job_id=%lu fwaddr=%#lx "
206 "old_value=%#lx new_value=%#lx",
207 (unsigned long long)show_secs_from_ns(__entry->timestamp),
208 (unsigned long)show_usecs_from_ns(__entry->timestamp),
209 (unsigned long)__entry->ctx_id,
210 (unsigned long)__entry->job_id,
211 (unsigned long)__entry->fwaddr,
212 (unsigned long)__entry->old_value,
213 (unsigned long)__entry->new_value),
214 PVRGpuTraceEnableUfoCallback,
215 PVRGpuTraceDisableUfoCallback
218 TRACE_EVENT_FN(rogue_ufo_check_fail,
220 TP_PROTO(u64 timestamp, u32 ctx_id, u32 job_id, u32 fwaddr,
221 u32 value, u32 required),
223 TP_ARGS(timestamp, ctx_id, job_id, fwaddr, value, required),
226 __field( u64, timestamp )
227 __field( u32, ctx_id )
228 __field( u32, job_id )
229 __field( u32, fwaddr )
230 __field( u32, value )
231 __field( u32, required )
235 __entry->timestamp = timestamp;
236 __entry->ctx_id = ctx_id;
237 __entry->job_id = job_id;
238 __entry->fwaddr = fwaddr;
239 __entry->value = value;
240 __entry->required = required;
243 TP_printk("ts=%llu.%06lu ctx_id=%lu job_id=%lu fwaddr=%#lx "
244 "value=%#lx required=%#lx",
245 (unsigned long long)show_secs_from_ns(__entry->timestamp),
246 (unsigned long)show_usecs_from_ns(__entry->timestamp),
247 (unsigned long)__entry->ctx_id,
248 (unsigned long)__entry->job_id,
249 (unsigned long)__entry->fwaddr,
250 (unsigned long)__entry->value,
251 (unsigned long)__entry->required),
252 PVRGpuTraceEnableUfoCallback,
253 PVRGpuTraceDisableUfoCallback
256 TRACE_EVENT_FN(rogue_ufo_pr_check_fail,
258 TP_PROTO(u64 timestamp, u32 ctx_id, u32 job_id, u32 fwaddr,
259 u32 value, u32 required),
261 TP_ARGS(timestamp, ctx_id, job_id, fwaddr, value, required),
264 __field( u64, timestamp )
265 __field( u32, ctx_id )
266 __field( u32, job_id )
267 __field( u32, fwaddr )
268 __field( u32, value )
269 __field( u32, required )
273 __entry->timestamp = timestamp;
274 __entry->ctx_id = ctx_id;
275 __entry->job_id = job_id;
276 __entry->fwaddr = fwaddr;
277 __entry->value = value;
278 __entry->required = required;
281 TP_printk("ts=%llu.%06lu ctx_id=%lu job_id=%lu fwaddr=%#lx "
282 "value=%#lx required=%#lx",
283 (unsigned long long)show_secs_from_ns(__entry->timestamp),
284 (unsigned long)show_usecs_from_ns(__entry->timestamp),
285 (unsigned long)__entry->ctx_id,
286 (unsigned long)__entry->job_id,
287 (unsigned long)__entry->fwaddr,
288 (unsigned long)__entry->value,
289 (unsigned long)__entry->required),
290 PVRGpuTraceEnableUfoCallback,
291 PVRGpuTraceDisableUfoCallback
294 TRACE_EVENT_FN(rogue_ufo_check_success,
296 TP_PROTO(u64 timestamp, u32 ctx_id, u32 job_id, u32 fwaddr, u32 value),
298 TP_ARGS(timestamp, ctx_id, job_id, fwaddr, value),
301 __field( u64, timestamp )
302 __field( u32, ctx_id )
303 __field( u32, job_id )
304 __field( u32, fwaddr )
305 __field( u32, value )
309 __entry->timestamp = timestamp;
310 __entry->ctx_id = ctx_id;
311 __entry->job_id = job_id;
312 __entry->fwaddr = fwaddr;
313 __entry->value = value;
316 TP_printk("ts=%llu.%06lu ctx_id=%lu job_id=%lu fwaddr=%#lx value=%#lx",
317 (unsigned long long)show_secs_from_ns(__entry->timestamp),
318 (unsigned long)show_usecs_from_ns(__entry->timestamp),
319 (unsigned long)__entry->ctx_id,
320 (unsigned long)__entry->job_id,
321 (unsigned long)__entry->fwaddr,
322 (unsigned long)__entry->value),
323 PVRGpuTraceEnableUfoCallback,
324 PVRGpuTraceDisableUfoCallback
327 TRACE_EVENT_FN(rogue_ufo_pr_check_success,
329 TP_PROTO(u64 timestamp, u32 ctx_id, u32 job_id, u32 fwaddr, u32 value),
331 TP_ARGS(timestamp, ctx_id, job_id, fwaddr, value),
334 __field( u64, timestamp )
335 __field( u32, ctx_id )
336 __field( u32, job_id )
337 __field( u32, fwaddr )
338 __field( u32, value )
342 __entry->timestamp = timestamp;
343 __entry->ctx_id = ctx_id;
344 __entry->job_id = job_id;
345 __entry->fwaddr = fwaddr;
346 __entry->value = value;
349 TP_printk("ts=%llu.%06lu ctx_id=%lu job_id=%lu fwaddr=%#lx value=%#lx",
350 (unsigned long long)show_secs_from_ns(__entry->timestamp),
351 (unsigned long)show_usecs_from_ns(__entry->timestamp),
352 (unsigned long)__entry->ctx_id,
353 (unsigned long)__entry->job_id,
354 (unsigned long)__entry->fwaddr,
355 (unsigned long)__entry->value),
356 PVRGpuTraceEnableUfoCallback,
357 PVRGpuTraceDisableUfoCallback
360 TRACE_EVENT(rogue_events_lost,
362 TP_PROTO(u32 event_source, u32 last_ordinal, u32 curr_ordinal),
364 TP_ARGS(event_source, last_ordinal, curr_ordinal),
367 __field( u32, event_source )
368 __field( u32, last_ordinal )
369 __field( u32, curr_ordinal )
373 __entry->event_source = event_source;
374 __entry->last_ordinal = last_ordinal;
375 __entry->curr_ordinal = curr_ordinal;
378 TP_printk("event_source=%s last_ordinal=%u curr_ordinal=%u",
379 __print_symbolic(__entry->event_source, {0, "GPU"}, {1, "Host"}),
380 __entry->last_ordinal,
381 __entry->curr_ordinal)
384 void PVRGpuTraceEnableFirmwareActivityCallback(void);
385 void PVRGpuTraceDisableFirmwareActivityCallback(void);
387 TRACE_EVENT_FN(rogue_firmware_activity,
389 TP_PROTO(u64 timestamp, const char *task, u32 fw_event),
391 TP_ARGS(timestamp, task, fw_event),
394 __field( u64, timestamp )
395 __string( task, task )
396 __field( u32, fw_event )
400 __entry->timestamp = timestamp;
401 __assign_str(task, task);
402 __entry->fw_event = fw_event;
405 TP_printk("ts=%llu.%06lu task=%s event=%s",
406 (unsigned long long)show_secs_from_ns(__entry->timestamp),
407 (unsigned long)show_usecs_from_ns(__entry->timestamp),
409 __print_symbolic(__entry->fw_event,
410 /* These values are from pvr_gputrace.h. */
414 PVRGpuTraceEnableFirmwareActivityCallback,
415 PVRGpuTraceDisableFirmwareActivityCallback
418 #endif /* defined(SUPPORT_GPUTRACE_EVENTS) */
420 #undef show_secs_from_ns
421 #undef show_usecs_from_ns
423 #endif /* _ROGUE_TRACE_EVENTS_H */
425 #undef TRACE_INCLUDE_PATH
426 #undef TRACE_INCLUDE_FILE
427 #define TRACE_INCLUDE_PATH .
429 /* This is needed because the name of this file doesn't match TRACE_SYSTEM. */
430 #define TRACE_INCLUDE_FILE rogue_trace_events
432 /* This part must be outside protection */
433 #include <trace/define_trace.h>