blob: c7690a14abcda4778d470eb5db5ecbefd3220c5b [file] [log] [blame]
Shrenuj Bansala419c792016-10-20 14:05:11 -07001/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#if !defined(_KGSL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
15#define _KGSL_TRACE_H
16
17#undef TRACE_SYSTEM
18#define TRACE_SYSTEM kgsl
19#undef TRACE_INCLUDE_PATH
20#define TRACE_INCLUDE_PATH .
21#undef TRACE_INCLUDE_FILE
22#define TRACE_INCLUDE_FILE kgsl_trace
23
24#include <linux/tracepoint.h>
25#include "kgsl_device.h"
26#include "adreno_drawctxt.h"
27
28struct kgsl_device;
29struct kgsl_ringbuffer_issueibcmds;
30struct kgsl_device_waittimestamp;
31
32/*
33 * Tracepoint for kgsl issue ib commands
34 */
35TRACE_EVENT(kgsl_issueibcmds,
36
37 TP_PROTO(struct kgsl_device *device,
38 int drawctxt_id,
39 unsigned int numibs,
40 int timestamp,
41 int flags,
42 int result,
43 unsigned int type),
44
45 TP_ARGS(device, drawctxt_id, numibs, timestamp,
46 flags, result, type),
47
48 TP_STRUCT__entry(
49 __string(device_name, device->name)
50 __field(unsigned int, drawctxt_id)
51 __field(unsigned int, numibs)
52 __field(unsigned int, timestamp)
53 __field(unsigned int, flags)
54 __field(int, result)
55 __field(unsigned int, drawctxt_type)
56 ),
57
58 TP_fast_assign(
59 __assign_str(device_name, device->name);
60 __entry->drawctxt_id = drawctxt_id;
61 __entry->numibs = numibs;
62 __entry->timestamp = timestamp;
63 __entry->flags = flags;
64 __entry->result = result;
65 __entry->drawctxt_type = type;
66 ),
67
68 TP_printk(
69 "d_name=%s ctx=%u ib=0x0 numibs=%u ts=%u flags=%s result=%d type=%s",
70 __get_str(device_name),
71 __entry->drawctxt_id,
72 __entry->numibs,
73 __entry->timestamp,
74 __entry->flags ? __print_flags(__entry->flags, "|",
75 KGSL_DRAWOBJ_FLAGS) : "None",
76 __entry->result,
77 __print_symbolic(__entry->drawctxt_type, KGSL_CONTEXT_TYPES)
78 )
79);
80
81/*
82 * Tracepoint for kgsl readtimestamp
83 */
84TRACE_EVENT(kgsl_readtimestamp,
85
86 TP_PROTO(struct kgsl_device *device,
87 unsigned int context_id,
88 unsigned int type,
89 unsigned int timestamp),
90
91 TP_ARGS(device, context_id, type, timestamp),
92
93 TP_STRUCT__entry(
94 __string(device_name, device->name)
95 __field(unsigned int, context_id)
96 __field(unsigned int, type)
97 __field(unsigned int, timestamp)
98 ),
99
100 TP_fast_assign(
101 __assign_str(device_name, device->name);
102 __entry->context_id = context_id;
103 __entry->type = type;
104 __entry->timestamp = timestamp;
105 ),
106
107 TP_printk(
108 "d_name=%s context_id=%u type=%u ts=%u",
109 __get_str(device_name),
110 __entry->context_id,
111 __entry->type,
112 __entry->timestamp
113 )
114);
115
116/*
117 * Tracepoint for kgsl waittimestamp entry
118 */
119TRACE_EVENT(kgsl_waittimestamp_entry,
120
121 TP_PROTO(struct kgsl_device *device,
122 unsigned int context_id,
123 unsigned int curr_ts,
124 unsigned int wait_ts,
125 unsigned int timeout),
126
127 TP_ARGS(device, context_id, curr_ts, wait_ts, timeout),
128
129 TP_STRUCT__entry(
130 __string(device_name, device->name)
131 __field(unsigned int, context_id)
132 __field(unsigned int, curr_ts)
133 __field(unsigned int, wait_ts)
134 __field(unsigned int, timeout)
135 ),
136
137 TP_fast_assign(
138 __assign_str(device_name, device->name);
139 __entry->context_id = context_id;
140 __entry->curr_ts = curr_ts;
141 __entry->wait_ts = wait_ts;
142 __entry->timeout = timeout;
143 ),
144
145 TP_printk(
146 "d_name=%s ctx=%u curr_ts=%u ts=%u timeout=%u",
147 __get_str(device_name),
148 __entry->context_id,
149 __entry->curr_ts,
150 __entry->wait_ts,
151 __entry->timeout
152 )
153);
154
155/*
156 * Tracepoint for kgsl waittimestamp exit
157 */
158TRACE_EVENT(kgsl_waittimestamp_exit,
159
160 TP_PROTO(struct kgsl_device *device, unsigned int curr_ts,
161 int result),
162
163 TP_ARGS(device, curr_ts, result),
164
165 TP_STRUCT__entry(
166 __string(device_name, device->name)
167 __field(unsigned int, curr_ts)
168 __field(int, result)
169 ),
170
171 TP_fast_assign(
172 __assign_str(device_name, device->name);
173 __entry->curr_ts = curr_ts;
174 __entry->result = result;
175 ),
176
177 TP_printk(
178 "d_name=%s curr_ts=%u result=%d",
179 __get_str(device_name),
180 __entry->curr_ts,
181 __entry->result
182 )
183);
184
185DECLARE_EVENT_CLASS(kgsl_pwr_template,
186 TP_PROTO(struct kgsl_device *device, int on),
187
188 TP_ARGS(device, on),
189
190 TP_STRUCT__entry(
191 __string(device_name, device->name)
192 __field(int, on)
193 ),
194
195 TP_fast_assign(
196 __assign_str(device_name, device->name);
197 __entry->on = on;
198 ),
199
200 TP_printk(
201 "d_name=%s flag=%s",
202 __get_str(device_name),
203 __entry->on ? "on" : "off"
204 )
205);
206
207DEFINE_EVENT(kgsl_pwr_template, kgsl_irq,
208 TP_PROTO(struct kgsl_device *device, int on),
209 TP_ARGS(device, on)
210);
211
212DEFINE_EVENT(kgsl_pwr_template, kgsl_bus,
213 TP_PROTO(struct kgsl_device *device, int on),
214 TP_ARGS(device, on)
215);
216
217DEFINE_EVENT(kgsl_pwr_template, kgsl_rail,
218 TP_PROTO(struct kgsl_device *device, int on),
219 TP_ARGS(device, on)
220);
221
222TRACE_EVENT(kgsl_clk,
223
224 TP_PROTO(struct kgsl_device *device, unsigned int on,
225 unsigned int freq),
226
227 TP_ARGS(device, on, freq),
228
229 TP_STRUCT__entry(
230 __string(device_name, device->name)
231 __field(int, on)
232 __field(unsigned int, freq)
233 ),
234
235 TP_fast_assign(
236 __assign_str(device_name, device->name);
237 __entry->on = on;
238 __entry->freq = freq;
239 ),
240
241 TP_printk(
242 "d_name=%s flag=%s active_freq=%d",
243 __get_str(device_name),
244 __entry->on ? "on" : "off",
245 __entry->freq
246 )
247);
248
249TRACE_EVENT(kgsl_pwrlevel,
250
251 TP_PROTO(struct kgsl_device *device,
252 unsigned int pwrlevel,
253 unsigned int freq,
254 unsigned int prev_pwrlevel,
255 unsigned int prev_freq),
256
257 TP_ARGS(device, pwrlevel, freq, prev_pwrlevel, prev_freq),
258
259 TP_STRUCT__entry(
260 __string(device_name, device->name)
261 __field(unsigned int, pwrlevel)
262 __field(unsigned int, freq)
263 __field(unsigned int, prev_pwrlevel)
264 __field(unsigned int, prev_freq)
265 ),
266
267 TP_fast_assign(
268 __assign_str(device_name, device->name);
269 __entry->pwrlevel = pwrlevel;
270 __entry->freq = freq;
271 __entry->prev_pwrlevel = prev_pwrlevel;
272 __entry->prev_freq = prev_freq;
273 ),
274
275 TP_printk(
276 "d_name=%s pwrlevel=%d freq=%d prev_pwrlevel=%d prev_freq=%d",
277 __get_str(device_name),
278 __entry->pwrlevel,
279 __entry->freq,
280 __entry->prev_pwrlevel,
281 __entry->prev_freq
282 )
283);
284
285TRACE_EVENT(kgsl_buslevel,
286
287 TP_PROTO(struct kgsl_device *device, unsigned int pwrlevel,
288 unsigned int bus),
289
290 TP_ARGS(device, pwrlevel, bus),
291
292 TP_STRUCT__entry(
293 __string(device_name, device->name)
294 __field(unsigned int, pwrlevel)
295 __field(unsigned int, bus)
296 ),
297
298 TP_fast_assign(
299 __assign_str(device_name, device->name);
300 __entry->pwrlevel = pwrlevel;
301 __entry->bus = bus;
302 ),
303
304 TP_printk(
305 "d_name=%s pwrlevel=%d bus=%d",
306 __get_str(device_name),
307 __entry->pwrlevel,
308 __entry->bus
309 )
310);
311
312TRACE_EVENT(kgsl_gpubusy,
313 TP_PROTO(struct kgsl_device *device, unsigned int busy,
314 unsigned int elapsed),
315
316 TP_ARGS(device, busy, elapsed),
317
318 TP_STRUCT__entry(
319 __string(device_name, device->name)
320 __field(unsigned int, busy)
321 __field(unsigned int, elapsed)
322 ),
323
324 TP_fast_assign(
325 __assign_str(device_name, device->name);
326 __entry->busy = busy;
327 __entry->elapsed = elapsed;
328 ),
329
330 TP_printk(
331 "d_name=%s busy=%u elapsed=%d",
332 __get_str(device_name),
333 __entry->busy,
334 __entry->elapsed
335 )
336);
337
338TRACE_EVENT(kgsl_pwrstats,
339 TP_PROTO(struct kgsl_device *device, s64 time,
340 struct kgsl_power_stats *pstats, u32 ctxt_count),
341
342 TP_ARGS(device, time, pstats, ctxt_count),
343
344 TP_STRUCT__entry(
345 __string(device_name, device->name)
346 __field(s64, total_time)
347 __field(u64, busy_time)
348 __field(u64, ram_time)
349 __field(u64, ram_wait)
350 __field(u32, context_count)
351 ),
352
353 TP_fast_assign(
354 __assign_str(device_name, device->name);
355 __entry->total_time = time;
356 __entry->busy_time = pstats->busy_time;
357 __entry->ram_time = pstats->ram_time;
358 __entry->ram_wait = pstats->ram_wait;
359 __entry->context_count = ctxt_count;
360 ),
361
362 TP_printk(
363 "d_name=%s total=%lld busy=%lld ram_time=%lld ram_wait=%lld context_count=%u",
364 __get_str(device_name), __entry->total_time, __entry->busy_time,
365 __entry->ram_time, __entry->ram_wait, __entry->context_count
366 )
367);
368
369DECLARE_EVENT_CLASS(kgsl_pwrstate_template,
370 TP_PROTO(struct kgsl_device *device, unsigned int state),
371
372 TP_ARGS(device, state),
373
374 TP_STRUCT__entry(
375 __string(device_name, device->name)
376 __field(unsigned int, state)
377 ),
378
379 TP_fast_assign(
380 __assign_str(device_name, device->name);
381 __entry->state = state;
382 ),
383
384 TP_printk(
385 "d_name=%s state=%s",
386 __get_str(device_name),
387 kgsl_pwrstate_to_str(__entry->state)
388 )
389);
390
391DEFINE_EVENT(kgsl_pwrstate_template, kgsl_pwr_set_state,
392 TP_PROTO(struct kgsl_device *device, unsigned int state),
393 TP_ARGS(device, state)
394);
395
396DEFINE_EVENT(kgsl_pwrstate_template, kgsl_pwr_request_state,
397 TP_PROTO(struct kgsl_device *device, unsigned int state),
398 TP_ARGS(device, state)
399);
400
401TRACE_EVENT(kgsl_mem_alloc,
402
403 TP_PROTO(struct kgsl_mem_entry *mem_entry),
404
405 TP_ARGS(mem_entry),
406
407 TP_STRUCT__entry(
408 __field(uint64_t, gpuaddr)
409 __field(uint64_t, size)
410 __field(unsigned int, tgid)
411 __array(char, usage, 16)
412 __field(unsigned int, id)
413 __field(uint64_t, flags)
414 ),
415
416 TP_fast_assign(
417 __entry->gpuaddr = mem_entry->memdesc.gpuaddr;
418 __entry->size = mem_entry->memdesc.size;
419 __entry->tgid = mem_entry->priv->pid;
420 kgsl_get_memory_usage(__entry->usage, sizeof(__entry->usage),
421 mem_entry->memdesc.flags);
422 __entry->id = mem_entry->id;
423 __entry->flags = mem_entry->memdesc.flags;
424 ),
425
426 TP_printk(
427 "gpuaddr=0x%llx size=%llu tgid=%u usage=%s id=%u flags=0x%llx",
428 __entry->gpuaddr, __entry->size, __entry->tgid,
429 __entry->usage, __entry->id, __entry->flags
430 )
431);
432
433TRACE_EVENT(kgsl_mem_mmap,
434
435 TP_PROTO(struct kgsl_mem_entry *mem_entry),
436
437 TP_ARGS(mem_entry),
438
439 TP_STRUCT__entry(
440 __field(unsigned long, useraddr)
441 __field(uint64_t, gpuaddr)
442 __field(uint64_t, size)
443 __array(char, usage, 16)
444 __field(unsigned int, id)
445 __field(uint64_t, flags)
446 ),
447
448 TP_fast_assign(
449 __entry->useraddr = mem_entry->memdesc.useraddr;
450 __entry->gpuaddr = mem_entry->memdesc.gpuaddr;
451 __entry->size = mem_entry->memdesc.size;
452 kgsl_get_memory_usage(__entry->usage, sizeof(__entry->usage),
453 mem_entry->memdesc.flags);
454 __entry->id = mem_entry->id;
455 __entry->flags = mem_entry->memdesc.flags;
456 ),
457
458 TP_printk(
459 "useraddr=0x%lx gpuaddr=0x%llx size=%llu usage=%s id=%u flags=0x%llx",
460 __entry->useraddr, __entry->gpuaddr, __entry->size,
461 __entry->usage, __entry->id, __entry->flags
462 )
463);
464
465TRACE_EVENT(kgsl_mem_unmapped_area_collision,
466
467 TP_PROTO(struct kgsl_mem_entry *mem_entry,
468 unsigned long addr,
469 unsigned long len),
470
471 TP_ARGS(mem_entry, addr, len),
472
473 TP_STRUCT__entry(
474 __field(unsigned int, id)
475 __field(unsigned long, addr)
476 __field(unsigned long, len)
477 ),
478
479 TP_fast_assign(
480 __entry->id = mem_entry->id;
481 __entry->len = len;
482 __entry->addr = addr;
483 ),
484
485 TP_printk(
486 "id=%u len=%lu addr=0x%lx",
487 __entry->id, __entry->len, __entry->addr
488 )
489);
490
491TRACE_EVENT(kgsl_mem_map,
492
493 TP_PROTO(struct kgsl_mem_entry *mem_entry, int fd),
494
495 TP_ARGS(mem_entry, fd),
496
497 TP_STRUCT__entry(
498 __field(uint64_t, gpuaddr)
499 __field(uint64_t, size)
500 __field(int, fd)
501 __field(int, type)
502 __field(unsigned int, tgid)
503 __array(char, usage, 16)
504 __field(unsigned int, id)
505 ),
506
507 TP_fast_assign(
508 __entry->gpuaddr = mem_entry->memdesc.gpuaddr;
509 __entry->size = mem_entry->memdesc.size;
510 __entry->fd = fd;
511 __entry->type = kgsl_memdesc_usermem_type(&mem_entry->memdesc);
512 __entry->tgid = mem_entry->priv->pid;
513 kgsl_get_memory_usage(__entry->usage, sizeof(__entry->usage),
514 mem_entry->memdesc.flags);
515 __entry->id = mem_entry->id;
516 ),
517
518 TP_printk(
519 "gpuaddr=0x%llx size=%llu type=%s fd=%d tgid=%u usage=%s id=%u",
520 __entry->gpuaddr, __entry->size,
521 __print_symbolic(__entry->type, KGSL_MEM_TYPES),
522 __entry->fd, __entry->tgid,
523 __entry->usage, __entry->id
524 )
525);
526
527TRACE_EVENT(kgsl_mem_free,
528
529 TP_PROTO(struct kgsl_mem_entry *mem_entry),
530
531 TP_ARGS(mem_entry),
532
533 TP_STRUCT__entry(
534 __field(uint64_t, gpuaddr)
535 __field(uint64_t, size)
536 __field(int, type)
537 __field(int, fd)
538 __field(unsigned int, tgid)
539 __array(char, usage, 16)
540 __field(unsigned int, id)
541 ),
542
543 TP_fast_assign(
544 __entry->gpuaddr = mem_entry->memdesc.gpuaddr;
545 __entry->size = mem_entry->memdesc.size;
546 __entry->type = kgsl_memdesc_usermem_type(&mem_entry->memdesc);
547 __entry->tgid = mem_entry->priv->pid;
548 kgsl_get_memory_usage(__entry->usage, sizeof(__entry->usage),
549 mem_entry->memdesc.flags);
550 __entry->id = mem_entry->id;
551 ),
552
553 TP_printk(
554 "gpuaddr=0x%llx size=%llu type=%s tgid=%u usage=%s id=%u",
555 __entry->gpuaddr, __entry->size,
556 __print_symbolic(__entry->type, KGSL_MEM_TYPES),
557 __entry->tgid, __entry->usage, __entry->id
558 )
559);
560
561TRACE_EVENT(kgsl_mem_sync_cache,
562
563 TP_PROTO(struct kgsl_mem_entry *mem_entry, uint64_t offset,
564 uint64_t length, unsigned int op),
565
566 TP_ARGS(mem_entry, offset, length, op),
567
568 TP_STRUCT__entry(
569 __field(uint64_t, gpuaddr)
570 __array(char, usage, 16)
571 __field(unsigned int, tgid)
572 __field(unsigned int, id)
573 __field(unsigned int, op)
574 __field(uint64_t, offset)
575 __field(uint64_t, length)
576 ),
577
578 TP_fast_assign(
579 __entry->gpuaddr = mem_entry->memdesc.gpuaddr;
580 kgsl_get_memory_usage(__entry->usage, sizeof(__entry->usage),
581 mem_entry->memdesc.flags);
582 __entry->tgid = mem_entry->priv->pid;
583 __entry->id = mem_entry->id;
584 __entry->op = op;
585 __entry->offset = offset;
586 __entry->length = (length == 0) ?
587 mem_entry->memdesc.size : length;
588 ),
589
590 TP_printk(
591 "gpuaddr=0x%llx size=%llu tgid=%u usage=%s id=%u op=%c%c offset=%llu",
592 __entry->gpuaddr, __entry->length,
593 __entry->tgid, __entry->usage, __entry->id,
594 (__entry->op & KGSL_GPUMEM_CACHE_CLEAN) ? 'c' : '.',
595 (__entry->op & KGSL_GPUMEM_CACHE_INV) ? 'i' : '.',
596 __entry->offset
597 )
598);
599
600TRACE_EVENT(kgsl_mem_sync_full_cache,
601
602 TP_PROTO(unsigned int num_bufs, uint64_t bulk_size),
603 TP_ARGS(num_bufs, bulk_size),
604
605 TP_STRUCT__entry(
606 __field(unsigned int, num_bufs)
607 __field(uint64_t, bulk_size)
608 ),
609
610 TP_fast_assign(
611 __entry->num_bufs = num_bufs;
612 __entry->bulk_size = bulk_size;
613 ),
614
615 TP_printk(
616 "num_bufs=%u bulk_size=%llu op=ci",
617 __entry->num_bufs, __entry->bulk_size
618 )
619);
620
621DECLARE_EVENT_CLASS(kgsl_mem_timestamp_template,
622
623 TP_PROTO(struct kgsl_device *device, struct kgsl_mem_entry *mem_entry,
624 unsigned int id, unsigned int curr_ts, unsigned int free_ts),
625
626 TP_ARGS(device, mem_entry, id, curr_ts, free_ts),
627
628 TP_STRUCT__entry(
629 __string(device_name, device->name)
630 __field(uint64_t, gpuaddr)
631 __field(uint64_t, size)
632 __field(int, type)
633 __array(char, usage, 16)
634 __field(unsigned int, id)
635 __field(unsigned int, drawctxt_id)
636 __field(unsigned int, curr_ts)
637 __field(unsigned int, free_ts)
638 ),
639
640 TP_fast_assign(
641 __assign_str(device_name, device->name);
642 __entry->gpuaddr = mem_entry->memdesc.gpuaddr;
643 __entry->size = mem_entry->memdesc.size;
644 kgsl_get_memory_usage(__entry->usage, sizeof(__entry->usage),
645 mem_entry->memdesc.flags);
646 __entry->id = mem_entry->id;
647 __entry->drawctxt_id = id;
648 __entry->type = kgsl_memdesc_usermem_type(&mem_entry->memdesc);
649 __entry->curr_ts = curr_ts;
650 __entry->free_ts = free_ts;
651 ),
652
653 TP_printk(
654 "d_name=%s gpuaddr=0x%llx size=%llu type=%s usage=%s id=%u ctx=%u curr_ts=%u free_ts=%u",
655 __get_str(device_name),
656 __entry->gpuaddr,
657 __entry->size,
658 __print_symbolic(__entry->type, KGSL_MEM_TYPES),
659 __entry->usage,
660 __entry->id,
661 __entry->drawctxt_id,
662 __entry->curr_ts,
663 __entry->free_ts
664 )
665);
666
667DEFINE_EVENT(kgsl_mem_timestamp_template, kgsl_mem_timestamp_queue,
668 TP_PROTO(struct kgsl_device *device, struct kgsl_mem_entry *mem_entry,
669 unsigned int id, unsigned int curr_ts, unsigned int free_ts),
670 TP_ARGS(device, mem_entry, id, curr_ts, free_ts)
671);
672
673DEFINE_EVENT(kgsl_mem_timestamp_template, kgsl_mem_timestamp_free,
674 TP_PROTO(struct kgsl_device *device, struct kgsl_mem_entry *mem_entry,
675 unsigned int id, unsigned int curr_ts, unsigned int free_ts),
676 TP_ARGS(device, mem_entry, id, curr_ts, free_ts)
677);
678
679TRACE_EVENT(kgsl_context_create,
680
681 TP_PROTO(struct kgsl_device *device, struct kgsl_context *context,
682 unsigned int flags),
683
684 TP_ARGS(device, context, flags),
685
686 TP_STRUCT__entry(
687 __string(device_name, device->name)
688 __field(unsigned int, id)
689 __field(unsigned int, flags)
690 __field(unsigned int, priority)
691 __field(unsigned int, type)
692 ),
693
694 TP_fast_assign(
695 __assign_str(device_name, device->name);
696 __entry->id = context->id;
697 __entry->flags = flags & ~(KGSL_CONTEXT_PRIORITY_MASK |
698 KGSL_CONTEXT_TYPE_MASK);
699 __entry->priority =
700 (flags & KGSL_CONTEXT_PRIORITY_MASK)
701 >> KGSL_CONTEXT_PRIORITY_SHIFT;
702 __entry->type =
703 (flags & KGSL_CONTEXT_TYPE_MASK)
704 >> KGSL_CONTEXT_TYPE_SHIFT;
705 ),
706
707 TP_printk(
708 "d_name=%s ctx=%u flags=%s priority=%u type=%s",
709 __get_str(device_name), __entry->id,
710 __entry->flags ? __print_flags(__entry->flags, "|",
711 KGSL_CONTEXT_FLAGS) : "None",
712 __entry->priority,
713 __print_symbolic(__entry->type, KGSL_CONTEXT_TYPES)
714 )
715);
716
717TRACE_EVENT(kgsl_context_detach,
718
719 TP_PROTO(struct kgsl_device *device, struct kgsl_context *context),
720
721 TP_ARGS(device, context),
722
723 TP_STRUCT__entry(
724 __string(device_name, device->name)
725 __field(unsigned int, id)
726 ),
727
728 TP_fast_assign(
729 __assign_str(device_name, device->name);
730 __entry->id = context->id;
731 ),
732
733 TP_printk(
734 "d_name=%s ctx=%u",
735 __get_str(device_name), __entry->id
736 )
737);
738
739TRACE_EVENT(kgsl_context_destroy,
740
741 TP_PROTO(struct kgsl_device *device, struct kgsl_context *context),
742
743 TP_ARGS(device, context),
744
745 TP_STRUCT__entry(
746 __string(device_name, device->name)
747 __field(unsigned int, id)
748 ),
749
750 TP_fast_assign(
751 __assign_str(device_name, device->name);
752 __entry->id = context->id;
753 ),
754
755 TP_printk(
756 "d_name=%s ctx=%u",
757 __get_str(device_name), __entry->id
758 )
759);
760
761TRACE_EVENT(kgsl_user_pwrlevel_constraint,
762
763 TP_PROTO(struct kgsl_device *device, unsigned int id, unsigned int type,
764 unsigned int sub_type),
765
766 TP_ARGS(device, id, type, sub_type),
767
768 TP_STRUCT__entry(
769 __string(device_name, device->name)
770 __field(unsigned int, id)
771 __field(unsigned int, type)
772 __field(unsigned int, sub_type)
773 ),
774
775 TP_fast_assign(
776 __assign_str(device_name, device->name);
777 __entry->id = id;
778 __entry->type = type;
779 __entry->sub_type = sub_type;
780 ),
781
782 TP_printk(
783 "d_name=%s ctx=%u constraint_type=%s constraint_subtype=%s",
784 __get_str(device_name), __entry->id,
785 __print_symbolic(__entry->type, KGSL_CONSTRAINT_TYPES),
786 __print_symbolic(__entry->sub_type,
787 KGSL_CONSTRAINT_PWRLEVEL_SUBTYPES)
788 )
789);
790
791TRACE_EVENT(kgsl_constraint,
792
793 TP_PROTO(struct kgsl_device *device, unsigned int type,
794 unsigned int value, unsigned int on),
795
796 TP_ARGS(device, type, value, on),
797
798 TP_STRUCT__entry(
799 __string(device_name, device->name)
800 __field(unsigned int, type)
801 __field(unsigned int, value)
802 __field(unsigned int, on)
803 ),
804
805 TP_fast_assign(
806 __assign_str(device_name, device->name);
807 __entry->type = type;
808 __entry->value = value;
809 __entry->on = on;
810 ),
811
812 TP_printk(
813 "d_name=%s constraint_type=%s constraint_value=%u status=%s",
814 __get_str(device_name),
815 __print_symbolic(__entry->type, KGSL_CONSTRAINT_TYPES),
816 __entry->value,
817 __entry->on ? "ON" : "OFF"
818 )
819);
820
821TRACE_EVENT(kgsl_mmu_pagefault,
822
Harshdeep Dhatt8a238b42017-07-03 15:47:38 -0600823 TP_PROTO(struct kgsl_device *device, unsigned long page,
Shrenuj Bansala419c792016-10-20 14:05:11 -0700824 unsigned int pt, const char *op),
825
826 TP_ARGS(device, page, pt, op),
827
828 TP_STRUCT__entry(
829 __string(device_name, device->name)
Harshdeep Dhatt8a238b42017-07-03 15:47:38 -0600830 __field(unsigned long, page)
Shrenuj Bansala419c792016-10-20 14:05:11 -0700831 __field(unsigned int, pt)
832 __string(op, op)
833 ),
834
835 TP_fast_assign(
836 __assign_str(device_name, device->name);
837 __entry->page = page;
838 __entry->pt = pt;
839 __assign_str(op, op);
840 ),
841
842 TP_printk(
Harshdeep Dhatt8a238b42017-07-03 15:47:38 -0600843 "d_name=%s page=0x%lx pt=%u op=%s",
Shrenuj Bansala419c792016-10-20 14:05:11 -0700844 __get_str(device_name), __entry->page, __entry->pt,
845 __get_str(op)
846 )
847);
848
849TRACE_EVENT(kgsl_regwrite,
850
851 TP_PROTO(struct kgsl_device *device, unsigned int offset,
852 unsigned int value),
853
854 TP_ARGS(device, offset, value),
855
856 TP_STRUCT__entry(
857 __string(device_name, device->name)
858 __field(unsigned int, offset)
859 __field(unsigned int, value)
860 ),
861
862 TP_fast_assign(
863 __assign_str(device_name, device->name);
864 __entry->offset = offset;
865 __entry->value = value;
866 ),
867
868 TP_printk(
869 "d_name=%s reg=0x%x value=0x%x",
870 __get_str(device_name), __entry->offset, __entry->value
871 )
872);
873
874TRACE_EVENT(kgsl_popp_level,
875
876 TP_PROTO(struct kgsl_device *device, int level1, int level2),
877
878 TP_ARGS(device, level1, level2),
879
880 TP_STRUCT__entry(
881 __string(device_name, device->name)
882 __field(int, level1)
883 __field(int, level2)
884 ),
885
886 TP_fast_assign(
887 __assign_str(device_name, device->name);
888 __entry->level1 = level1;
889 __entry->level2 = level2;
890 ),
891
892 TP_printk(
893 "d_name=%s old level=%d new level=%d",
894 __get_str(device_name), __entry->level1, __entry->level2)
895);
896
897TRACE_EVENT(kgsl_popp_mod,
898
899 TP_PROTO(struct kgsl_device *device, int x, int y),
900
901 TP_ARGS(device, x, y),
902
903 TP_STRUCT__entry(
904 __string(device_name, device->name)
905 __field(int, x)
906 __field(int, y)
907 ),
908
909 TP_fast_assign(
910 __assign_str(device_name, device->name);
911 __entry->x = x;
912 __entry->y = y;
913 ),
914
915 TP_printk(
916 "d_name=%s GPU busy mod=%d bus busy mod=%d",
917 __get_str(device_name), __entry->x, __entry->y)
918);
919
920TRACE_EVENT(kgsl_popp_nap,
921
922 TP_PROTO(struct kgsl_device *device, int t, int nap, int percent),
923
924 TP_ARGS(device, t, nap, percent),
925
926 TP_STRUCT__entry(
927 __string(device_name, device->name)
928 __field(int, t)
929 __field(int, nap)
930 __field(int, percent)
931 ),
932
933 TP_fast_assign(
934 __assign_str(device_name, device->name);
935 __entry->t = t;
936 __entry->nap = nap;
937 __entry->percent = percent;
938 ),
939
940 TP_printk(
941 "d_name=%s nap time=%d number of naps=%d percentage=%d",
942 __get_str(device_name), __entry->t, __entry->nap,
943 __entry->percent)
944);
945
946TRACE_EVENT(kgsl_register_event,
947 TP_PROTO(unsigned int id, unsigned int timestamp, void *func),
948 TP_ARGS(id, timestamp, func),
949 TP_STRUCT__entry(
950 __field(unsigned int, id)
951 __field(unsigned int, timestamp)
952 __field(void *, func)
953 ),
954 TP_fast_assign(
955 __entry->id = id;
956 __entry->timestamp = timestamp;
957 __entry->func = func;
958 ),
959 TP_printk(
960 "ctx=%u ts=%u cb=%pF",
961 __entry->id, __entry->timestamp, __entry->func)
962);
963
964TRACE_EVENT(kgsl_fire_event,
965 TP_PROTO(unsigned int id, unsigned int ts,
966 unsigned int type, unsigned int age, void *func),
967 TP_ARGS(id, ts, type, age, func),
968 TP_STRUCT__entry(
969 __field(unsigned int, id)
970 __field(unsigned int, ts)
971 __field(unsigned int, type)
972 __field(unsigned int, age)
973 __field(void *, func)
974 ),
975 TP_fast_assign(
976 __entry->id = id;
977 __entry->ts = ts;
978 __entry->type = type;
979 __entry->age = age;
980 __entry->func = func;
981 ),
982 TP_printk(
983 "ctx=%u ts=%u type=%s age=%u cb=%pF",
984 __entry->id, __entry->ts,
985 __print_symbolic(__entry->type, KGSL_EVENT_TYPES),
986 __entry->age, __entry->func)
987);
988
989TRACE_EVENT(kgsl_active_count,
990
991 TP_PROTO(struct kgsl_device *device, unsigned long ip),
992
993 TP_ARGS(device, ip),
994
995 TP_STRUCT__entry(
996 __string(device_name, device->name)
997 __field(unsigned int, count)
998 __field(unsigned long, ip)
999 ),
1000
1001 TP_fast_assign(
1002 __assign_str(device_name, device->name);
1003 __entry->count = atomic_read(&device->active_cnt);
1004 __entry->ip = ip;
1005 ),
1006
1007 TP_printk(
1008 "d_name=%s active_cnt=%u func=%pf",
1009 __get_str(device_name), __entry->count, (void *) __entry->ip
1010 )
1011);
1012
1013TRACE_EVENT(kgsl_pagetable_destroy,
1014 TP_PROTO(u64 ptbase, unsigned int name),
1015 TP_ARGS(ptbase, name),
1016 TP_STRUCT__entry(
1017 __field(u64, ptbase)
1018 __field(unsigned int, name)
1019 ),
1020 TP_fast_assign(
1021 __entry->ptbase = ptbase;
1022 __entry->name = name;
1023 ),
1024 TP_printk("ptbase=%llx name=%u", __entry->ptbase, __entry->name)
1025);
1026
1027DECLARE_EVENT_CLASS(syncpoint_timestamp_template,
1028 TP_PROTO(struct kgsl_drawobj_sync *syncobj,
1029 struct kgsl_context *context,
1030 unsigned int timestamp),
1031 TP_ARGS(syncobj, context, timestamp),
1032 TP_STRUCT__entry(
1033 __field(unsigned int, syncobj_context_id)
1034 __field(unsigned int, context_id)
1035 __field(unsigned int, timestamp)
1036 ),
1037 TP_fast_assign(
1038 __entry->syncobj_context_id = syncobj->base.context->id;
1039 __entry->context_id = context->id;
1040 __entry->timestamp = timestamp;
1041 ),
1042 TP_printk("ctx=%d sync ctx=%d ts=%d",
1043 __entry->syncobj_context_id, __entry->context_id,
1044 __entry->timestamp)
1045);
1046
1047DEFINE_EVENT(syncpoint_timestamp_template, syncpoint_timestamp,
1048 TP_PROTO(struct kgsl_drawobj_sync *syncobj,
1049 struct kgsl_context *context,
1050 unsigned int timestamp),
1051 TP_ARGS(syncobj, context, timestamp)
1052);
1053
1054DEFINE_EVENT(syncpoint_timestamp_template, syncpoint_timestamp_expire,
1055 TP_PROTO(struct kgsl_drawobj_sync *syncobj,
1056 struct kgsl_context *context,
1057 unsigned int timestamp),
1058 TP_ARGS(syncobj, context, timestamp)
1059);
1060
1061DECLARE_EVENT_CLASS(syncpoint_fence_template,
1062 TP_PROTO(struct kgsl_drawobj_sync *syncobj, char *name),
1063 TP_ARGS(syncobj, name),
1064 TP_STRUCT__entry(
1065 __string(fence_name, name)
1066 __field(unsigned int, syncobj_context_id)
1067 ),
1068 TP_fast_assign(
1069 __entry->syncobj_context_id = syncobj->base.context->id;
1070 __assign_str(fence_name, name);
1071 ),
1072 TP_printk("ctx=%d fence=%s",
1073 __entry->syncobj_context_id, __get_str(fence_name))
1074);
1075
1076DEFINE_EVENT(syncpoint_fence_template, syncpoint_fence,
1077 TP_PROTO(struct kgsl_drawobj_sync *syncobj, char *name),
1078 TP_ARGS(syncobj, name)
1079);
1080
1081DEFINE_EVENT(syncpoint_fence_template, syncpoint_fence_expire,
1082 TP_PROTO(struct kgsl_drawobj_sync *syncobj, char *name),
1083 TP_ARGS(syncobj, name)
1084);
1085
1086TRACE_EVENT(kgsl_msg,
1087 TP_PROTO(const char *msg),
1088 TP_ARGS(msg),
1089 TP_STRUCT__entry(
1090 __string(msg, msg)
1091 ),
1092 TP_fast_assign(
1093 __assign_str(msg, msg);
1094 ),
1095 TP_printk(
1096 "%s", __get_str(msg)
1097 )
1098);
1099
1100DECLARE_EVENT_CLASS(sparse_alloc_template,
1101 TP_PROTO(unsigned int id, uint64_t size, unsigned int pagesize),
1102 TP_ARGS(id, size, pagesize),
1103 TP_STRUCT__entry(
1104 __field(unsigned int, id)
1105 __field(uint64_t, size)
1106 __field(unsigned int, pagesize)
1107 ),
1108 TP_fast_assign(
1109 __entry->id = id;
1110 __entry->size = size;
1111 __entry->pagesize = pagesize;
1112 ),
1113 TP_printk("id=%d size=0x%llX pagesize=0x%X",
1114 __entry->id, __entry->size, __entry->pagesize)
1115);
1116
1117DEFINE_EVENT(sparse_alloc_template, sparse_phys_alloc,
1118 TP_PROTO(unsigned int id, uint64_t size, unsigned int pagesize),
1119 TP_ARGS(id, size, pagesize)
1120);
1121
1122DEFINE_EVENT(sparse_alloc_template, sparse_virt_alloc,
1123 TP_PROTO(unsigned int id, uint64_t size, unsigned int pagesize),
1124 TP_ARGS(id, size, pagesize)
1125);
1126
1127DECLARE_EVENT_CLASS(sparse_free_template,
1128 TP_PROTO(unsigned int id),
1129 TP_ARGS(id),
1130 TP_STRUCT__entry(
1131 __field(unsigned int, id)
1132 ),
1133 TP_fast_assign(
1134 __entry->id = id;
1135 ),
1136 TP_printk("id=%d", __entry->id)
1137);
1138
1139DEFINE_EVENT(sparse_free_template, sparse_phys_free,
1140 TP_PROTO(unsigned int id),
1141 TP_ARGS(id)
1142);
1143
1144DEFINE_EVENT(sparse_free_template, sparse_virt_free,
1145 TP_PROTO(unsigned int id),
1146 TP_ARGS(id)
1147);
1148
1149TRACE_EVENT(sparse_bind,
1150 TP_PROTO(unsigned int v_id, uint64_t v_off,
1151 unsigned int p_id, uint64_t p_off,
1152 uint64_t size, uint64_t flags),
1153 TP_ARGS(v_id, v_off, p_id, p_off, size, flags),
1154 TP_STRUCT__entry(
1155 __field(unsigned int, v_id)
1156 __field(uint64_t, v_off)
1157 __field(unsigned int, p_id)
1158 __field(uint64_t, p_off)
1159 __field(uint64_t, size)
1160 __field(uint64_t, flags)
1161 ),
1162 TP_fast_assign(
1163 __entry->v_id = v_id;
1164 __entry->v_off = v_off;
1165 __entry->p_id = p_id;
1166 __entry->p_off = p_off;
1167 __entry->size = size;
1168 __entry->flags = flags;
1169 ),
1170 TP_printk(
1171 "v_id=%d v_off=0x%llX p_id=%d p_off=0x%llX size=0x%llX flags=0x%llX",
1172 __entry->v_id, __entry->v_off,
1173 __entry->p_id, __entry->p_off,
1174 __entry->size, __entry->flags)
1175);
1176
1177TRACE_EVENT(sparse_unbind,
1178 TP_PROTO(unsigned int v_id, uint64_t v_off, uint64_t size),
1179 TP_ARGS(v_id, v_off, size),
1180 TP_STRUCT__entry(
1181 __field(unsigned int, v_id)
1182 __field(uint64_t, v_off)
1183 __field(uint64_t, size)
1184 ),
1185 TP_fast_assign(
1186 __entry->v_id = v_id;
1187 __entry->v_off = v_off;
1188 __entry->size = size;
1189 ),
1190 TP_printk("v_id=%d v_off=0x%llX size=0x%llX",
1191 __entry->v_id, __entry->v_off, __entry->size)
1192);
1193
1194
1195TRACE_EVENT(kgsl_clock_throttling,
1196 TP_PROTO(
1197 int idle_10pct,
1198 int crc_50pct,
1199 int crc_more50pct,
1200 int crc_less50pct,
1201 int adj
1202 ),
1203 TP_ARGS(
1204 idle_10pct,
1205 crc_50pct,
1206 crc_more50pct,
1207 crc_less50pct,
1208 adj
1209 ),
1210 TP_STRUCT__entry(
1211 __field(int, idle_10pct)
1212 __field(int, crc_50pct)
1213 __field(int, crc_more50pct)
1214 __field(int, crc_less50pct)
1215 __field(int, adj)
1216 ),
1217 TP_fast_assign(
1218 __entry->idle_10pct = idle_10pct;
1219 __entry->crc_50pct = crc_50pct;
1220 __entry->crc_more50pct = crc_more50pct;
1221 __entry->crc_less50pct = crc_less50pct;
1222 __entry->adj = adj;
1223 ),
1224 TP_printk("idle_10=%d crc_50=%d crc_more50=%d crc_less50=%d adj=%d",
1225 __entry->idle_10pct, __entry->crc_50pct, __entry->crc_more50pct,
1226 __entry->crc_less50pct, __entry->adj
1227 )
1228);
1229
Kyle Pieferb1027b02017-02-10 13:58:58 -08001230DECLARE_EVENT_CLASS(gmu_oob_template,
1231 TP_PROTO(unsigned int mask),
1232 TP_ARGS(mask),
1233 TP_STRUCT__entry(
1234 __field(unsigned int, mask)
1235 ),
1236 TP_fast_assign(
1237 __entry->mask = mask;
1238 ),
1239 TP_printk("mask=0x%08x", __entry->mask)
1240);
1241
1242DEFINE_EVENT(gmu_oob_template, kgsl_gmu_oob_set,
1243 TP_PROTO(unsigned int mask),
1244 TP_ARGS(mask)
1245);
1246
1247DEFINE_EVENT(gmu_oob_template, kgsl_gmu_oob_clear,
1248 TP_PROTO(unsigned int mask),
1249 TP_ARGS(mask)
1250);
1251
1252DECLARE_EVENT_CLASS(hfi_msg_template,
1253 TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum),
1254 TP_ARGS(id, size, seqnum),
1255 TP_STRUCT__entry(
1256 __field(unsigned int, id)
1257 __field(unsigned int, size)
1258 __field(unsigned int, seq)
1259 ),
1260 TP_fast_assign(
1261 __entry->id = id;
1262 __entry->size = size;
1263 __entry->seq = seqnum;
1264 ),
1265 TP_printk("id=0x%x size=0x%x seqnum=0x%x",
1266 __entry->id, __entry->size, __entry->seq)
1267);
1268
1269DEFINE_EVENT(hfi_msg_template, kgsl_hfi_send,
1270 TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum),
1271 TP_ARGS(id, size, seqnum)
1272);
1273
1274DEFINE_EVENT(hfi_msg_template, kgsl_hfi_receive,
1275 TP_PROTO(unsigned int id, unsigned int size, unsigned int seqnum),
1276 TP_ARGS(id, size, seqnum)
1277);
1278
Shrenuj Bansala419c792016-10-20 14:05:11 -07001279#endif /* _KGSL_TRACE_H */
1280
1281/* This part must be outside protection */
1282#include <trace/define_trace.h>