blob: 042a091cc42d8592e7ed4fb7e7d3c55ba82f03a8 [file] [log] [blame]
Alex Deucherd38ceaf2015-04-20 16:55:21 -04001#if !defined(_AMDGPU_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _AMDGPU_TRACE_H_
3
4#include <linux/stringify.h>
5#include <linux/types.h>
6#include <linux/tracepoint.h>
7
8#include <drm/drmP.h>
9
10#undef TRACE_SYSTEM
11#define TRACE_SYSTEM amdgpu
Alex Deucherd38ceaf2015-04-20 16:55:21 -040012#define TRACE_INCLUDE_FILE amdgpu_trace
13
Tom St Denisf4b373f2016-05-31 08:02:27 -040014TRACE_EVENT(amdgpu_mm_rreg,
15 TP_PROTO(unsigned did, uint32_t reg, uint32_t value),
16 TP_ARGS(did, reg, value),
17 TP_STRUCT__entry(
18 __field(unsigned, did)
19 __field(uint32_t, reg)
20 __field(uint32_t, value)
21 ),
22 TP_fast_assign(
23 __entry->did = did;
24 __entry->reg = reg;
25 __entry->value = value;
26 ),
Tom St Denise11666e2016-12-14 10:52:00 -050027 TP_printk("0x%04lx, 0x%08lx, 0x%08lx",
Tom St Denisf4b373f2016-05-31 08:02:27 -040028 (unsigned long)__entry->did,
29 (unsigned long)__entry->reg,
30 (unsigned long)__entry->value)
31);
32
33TRACE_EVENT(amdgpu_mm_wreg,
34 TP_PROTO(unsigned did, uint32_t reg, uint32_t value),
35 TP_ARGS(did, reg, value),
36 TP_STRUCT__entry(
37 __field(unsigned, did)
38 __field(uint32_t, reg)
39 __field(uint32_t, value)
40 ),
41 TP_fast_assign(
42 __entry->did = did;
43 __entry->reg = reg;
44 __entry->value = value;
45 ),
Tom St Denise11666e2016-12-14 10:52:00 -050046 TP_printk("0x%04lx, 0x%08lx, 0x%08lx",
Tom St Denisf4b373f2016-05-31 08:02:27 -040047 (unsigned long)__entry->did,
48 (unsigned long)__entry->reg,
49 (unsigned long)__entry->value)
50);
51
Alex Deucherd38ceaf2015-04-20 16:55:21 -040052TRACE_EVENT(amdgpu_bo_create,
53 TP_PROTO(struct amdgpu_bo *bo),
54 TP_ARGS(bo),
55 TP_STRUCT__entry(
56 __field(struct amdgpu_bo *, bo)
57 __field(u32, pages)
David Mao42ffb582016-06-07 17:43:51 +080058 __field(u32, type)
59 __field(u32, prefer)
60 __field(u32, allow)
61 __field(u32, visible)
Alex Deucherd38ceaf2015-04-20 16:55:21 -040062 ),
63
64 TP_fast_assign(
65 __entry->bo = bo;
66 __entry->pages = bo->tbo.num_pages;
David Mao42ffb582016-06-07 17:43:51 +080067 __entry->type = bo->tbo.mem.mem_type;
68 __entry->prefer = bo->prefered_domains;
69 __entry->allow = bo->allowed_domains;
70 __entry->visible = bo->flags;
Alex Deucherd38ceaf2015-04-20 16:55:21 -040071 ),
David Mao42ffb582016-06-07 17:43:51 +080072
Andres Rodriguez373eadf2017-03-09 21:25:51 -050073 TP_printk("bo=%p, pages=%u, type=%d, prefered=%d, allowed=%d, visible=%d",
David Mao42ffb582016-06-07 17:43:51 +080074 __entry->bo, __entry->pages, __entry->type,
75 __entry->prefer, __entry->allow, __entry->visible)
Alex Deucherd38ceaf2015-04-20 16:55:21 -040076);
77
78TRACE_EVENT(amdgpu_cs,
79 TP_PROTO(struct amdgpu_cs_parser *p, int i),
80 TP_ARGS(p, i),
81 TP_STRUCT__entry(
Christian Könige30590e2015-06-10 19:21:14 +020082 __field(struct amdgpu_bo_list *, bo_list)
Alex Deucherd38ceaf2015-04-20 16:55:21 -040083 __field(u32, ring)
84 __field(u32, dw)
85 __field(u32, fences)
86 ),
87
88 TP_fast_assign(
Christian Könige30590e2015-06-10 19:21:14 +020089 __entry->bo_list = p->bo_list;
Christian Königb07c60c2016-01-31 12:29:04 +010090 __entry->ring = p->job->ring->idx;
Christian König50838c82016-02-03 13:44:52 +010091 __entry->dw = p->job->ibs[i].length_dw;
Alex Deucherd38ceaf2015-04-20 16:55:21 -040092 __entry->fences = amdgpu_fence_count_emitted(
Christian Königb07c60c2016-01-31 12:29:04 +010093 p->job->ring);
Alex Deucherd38ceaf2015-04-20 16:55:21 -040094 ),
Christian Könige30590e2015-06-10 19:21:14 +020095 TP_printk("bo_list=%p, ring=%u, dw=%u, fences=%u",
96 __entry->bo_list, __entry->ring, __entry->dw,
Alex Deucherd38ceaf2015-04-20 16:55:21 -040097 __entry->fences)
98);
99
Chunming Zhou7034dec2015-11-11 14:56:00 +0800100TRACE_EVENT(amdgpu_cs_ioctl,
101 TP_PROTO(struct amdgpu_job *job),
102 TP_ARGS(job),
103 TP_STRUCT__entry(
104 __field(struct amdgpu_device *, adev)
Andres Rodriguezf6fd2032017-03-09 21:25:52 -0500105 __field(uint64_t, sched_job_id)
Chunming Zhou7034dec2015-11-11 14:56:00 +0800106 __field(struct amdgpu_ib *, ib)
Chris Wilsonf54d1862016-10-25 13:00:45 +0100107 __field(struct dma_fence *, fence)
Chunming Zhou7034dec2015-11-11 14:56:00 +0800108 __field(char *, ring_name)
109 __field(u32, num_ibs)
110 ),
111
112 TP_fast_assign(
113 __entry->adev = job->adev;
Andres Rodriguezf6fd2032017-03-09 21:25:52 -0500114 __entry->sched_job_id = job->base.id;
Chunming Zhou7034dec2015-11-11 14:56:00 +0800115 __entry->ib = job->ibs;
Christian König6fc13672016-05-20 12:53:52 +0200116 __entry->fence = &job->base.s_fence->finished;
Christian Königb07c60c2016-01-31 12:29:04 +0100117 __entry->ring_name = job->ring->name;
Chunming Zhou7034dec2015-11-11 14:56:00 +0800118 __entry->num_ibs = job->num_ibs;
119 ),
Andres Rodriguezf6fd2032017-03-09 21:25:52 -0500120 TP_printk("adev=%p, sched_job=%llu, first_ib=%p, sched_fence=%p, ring_name=%s, num_ibs=%u",
121 __entry->adev, __entry->sched_job_id, __entry->ib,
Chunming Zhou7034dec2015-11-11 14:56:00 +0800122 __entry->fence, __entry->ring_name, __entry->num_ibs)
123);
124
125TRACE_EVENT(amdgpu_sched_run_job,
126 TP_PROTO(struct amdgpu_job *job),
127 TP_ARGS(job),
128 TP_STRUCT__entry(
129 __field(struct amdgpu_device *, adev)
Andres Rodriguezf6fd2032017-03-09 21:25:52 -0500130 __field(uint64_t, sched_job_id)
Chunming Zhou7034dec2015-11-11 14:56:00 +0800131 __field(struct amdgpu_ib *, ib)
Chris Wilsonf54d1862016-10-25 13:00:45 +0100132 __field(struct dma_fence *, fence)
Andres Rodriguez82c6bd42017-02-24 13:20:58 -0500133 __string(timeline, job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
134 __field(unsigned int, context)
135 __field(unsigned int, seqno)
Chunming Zhou7034dec2015-11-11 14:56:00 +0800136 __field(char *, ring_name)
137 __field(u32, num_ibs)
138 ),
139
140 TP_fast_assign(
141 __entry->adev = job->adev;
Andres Rodriguezf6fd2032017-03-09 21:25:52 -0500142 __entry->sched_job_id = job->base.id;
Chunming Zhou7034dec2015-11-11 14:56:00 +0800143 __entry->ib = job->ibs;
Christian König6fc13672016-05-20 12:53:52 +0200144 __entry->fence = &job->base.s_fence->finished;
Andres Rodriguez82c6bd42017-02-24 13:20:58 -0500145 __assign_str(timeline, job->base.s_fence->finished.ops->get_timeline_name(&job->base.s_fence->finished))
146 __entry->context = job->base.s_fence->finished.context;
147 __entry->seqno = job->base.s_fence->finished.seqno;
Christian Königb07c60c2016-01-31 12:29:04 +0100148 __entry->ring_name = job->ring->name;
Chunming Zhou7034dec2015-11-11 14:56:00 +0800149 __entry->num_ibs = job->num_ibs;
150 ),
Andres Rodriguezf6fd2032017-03-09 21:25:52 -0500151 TP_printk("adev=%p, sched_job=%llu, first_ib=%p, sched_fence=%p, timeline=%s, context=%u, seqno=%u, ring_name=%s, num_ibs=%u",
152 __entry->adev, __entry->sched_job_id, __entry->ib,
Andres Rodriguez82c6bd42017-02-24 13:20:58 -0500153 __entry->fence, __get_str(timeline), __entry->context, __entry->seqno,
154 __entry->ring_name, __entry->num_ibs)
Chunming Zhou7034dec2015-11-11 14:56:00 +0800155);
156
157
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400158TRACE_EVENT(amdgpu_vm_grab_id,
Christian König0c0fdf12016-07-08 10:48:24 +0200159 TP_PROTO(struct amdgpu_vm *vm, int ring, struct amdgpu_job *job),
160 TP_ARGS(vm, ring, job),
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400161 TP_STRUCT__entry(
Christian König165e4e02016-01-07 18:15:22 +0100162 __field(struct amdgpu_vm *, vm)
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400163 __field(u32, ring)
Christian König22073fe2016-02-26 16:18:36 +0100164 __field(u32, vmid)
165 __field(u64, pd_addr)
Christian König0c0fdf12016-07-08 10:48:24 +0200166 __field(u32, needs_flush)
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400167 ),
168
169 TP_fast_assign(
Christian König165e4e02016-01-07 18:15:22 +0100170 __entry->vm = vm;
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400171 __entry->ring = ring;
Christian König0c0fdf12016-07-08 10:48:24 +0200172 __entry->vmid = job->vm_id;
173 __entry->pd_addr = job->vm_pd_addr;
174 __entry->needs_flush = job->vm_needs_flush;
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400175 ),
Christian König0c0fdf12016-07-08 10:48:24 +0200176 TP_printk("vm=%p, ring=%u, id=%u, pd_addr=%010Lx needs_flush=%u",
177 __entry->vm, __entry->ring, __entry->vmid,
178 __entry->pd_addr, __entry->needs_flush)
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400179);
180
Christian König93e3e432015-06-09 16:58:33 +0200181TRACE_EVENT(amdgpu_vm_bo_map,
182 TP_PROTO(struct amdgpu_bo_va *bo_va,
183 struct amdgpu_bo_va_mapping *mapping),
184 TP_ARGS(bo_va, mapping),
185 TP_STRUCT__entry(
186 __field(struct amdgpu_bo *, bo)
187 __field(long, start)
188 __field(long, last)
189 __field(u64, offset)
190 __field(u32, flags)
191 ),
192
193 TP_fast_assign(
194 __entry->bo = bo_va->bo;
195 __entry->start = mapping->it.start;
196 __entry->last = mapping->it.last;
197 __entry->offset = mapping->offset;
198 __entry->flags = mapping->flags;
199 ),
200 TP_printk("bo=%p, start=%lx, last=%lx, offset=%010llx, flags=%08x",
201 __entry->bo, __entry->start, __entry->last,
202 __entry->offset, __entry->flags)
203);
204
205TRACE_EVENT(amdgpu_vm_bo_unmap,
206 TP_PROTO(struct amdgpu_bo_va *bo_va,
207 struct amdgpu_bo_va_mapping *mapping),
208 TP_ARGS(bo_va, mapping),
209 TP_STRUCT__entry(
210 __field(struct amdgpu_bo *, bo)
211 __field(long, start)
212 __field(long, last)
213 __field(u64, offset)
214 __field(u32, flags)
215 ),
216
217 TP_fast_assign(
218 __entry->bo = bo_va->bo;
219 __entry->start = mapping->it.start;
220 __entry->last = mapping->it.last;
221 __entry->offset = mapping->offset;
222 __entry->flags = mapping->flags;
223 ),
224 TP_printk("bo=%p, start=%lx, last=%lx, offset=%010llx, flags=%08x",
225 __entry->bo, __entry->start, __entry->last,
226 __entry->offset, __entry->flags)
227);
228
Christian Königd6c10f62015-09-28 12:00:23 +0200229DECLARE_EVENT_CLASS(amdgpu_vm_mapping,
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400230 TP_PROTO(struct amdgpu_bo_va_mapping *mapping),
231 TP_ARGS(mapping),
232 TP_STRUCT__entry(
233 __field(u64, soffset)
234 __field(u64, eoffset)
235 __field(u32, flags)
236 ),
237
238 TP_fast_assign(
239 __entry->soffset = mapping->it.start;
240 __entry->eoffset = mapping->it.last + 1;
241 __entry->flags = mapping->flags;
242 ),
243 TP_printk("soffs=%010llx, eoffs=%010llx, flags=%08x",
244 __entry->soffset, __entry->eoffset, __entry->flags)
245);
246
Christian Königd6c10f62015-09-28 12:00:23 +0200247DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_update,
248 TP_PROTO(struct amdgpu_bo_va_mapping *mapping),
249 TP_ARGS(mapping)
250);
251
252DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_mapping,
253 TP_PROTO(struct amdgpu_bo_va_mapping *mapping),
254 TP_ARGS(mapping)
255);
256
Christian Königec2f05f2016-09-25 16:11:52 +0200257TRACE_EVENT(amdgpu_vm_set_ptes,
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400258 TP_PROTO(uint64_t pe, uint64_t addr, unsigned count,
259 uint32_t incr, uint32_t flags),
260 TP_ARGS(pe, addr, count, incr, flags),
261 TP_STRUCT__entry(
262 __field(u64, pe)
263 __field(u64, addr)
264 __field(u32, count)
265 __field(u32, incr)
266 __field(u32, flags)
267 ),
268
269 TP_fast_assign(
270 __entry->pe = pe;
271 __entry->addr = addr;
272 __entry->count = count;
273 __entry->incr = incr;
274 __entry->flags = flags;
275 ),
276 TP_printk("pe=%010Lx, addr=%010Lx, incr=%u, flags=%08x, count=%u",
277 __entry->pe, __entry->addr, __entry->incr,
278 __entry->flags, __entry->count)
279);
280
Christian Königec2f05f2016-09-25 16:11:52 +0200281TRACE_EVENT(amdgpu_vm_copy_ptes,
282 TP_PROTO(uint64_t pe, uint64_t src, unsigned count),
283 TP_ARGS(pe, src, count),
284 TP_STRUCT__entry(
285 __field(u64, pe)
286 __field(u64, src)
287 __field(u32, count)
288 ),
289
290 TP_fast_assign(
291 __entry->pe = pe;
292 __entry->src = src;
293 __entry->count = count;
294 ),
295 TP_printk("pe=%010Lx, src=%010Lx, count=%u",
296 __entry->pe, __entry->src, __entry->count)
297);
298
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400299TRACE_EVENT(amdgpu_vm_flush,
300 TP_PROTO(uint64_t pd_addr, unsigned ring, unsigned id),
301 TP_ARGS(pd_addr, ring, id),
302 TP_STRUCT__entry(
303 __field(u64, pd_addr)
304 __field(u32, ring)
305 __field(u32, id)
306 ),
307
308 TP_fast_assign(
309 __entry->pd_addr = pd_addr;
310 __entry->ring = ring;
311 __entry->id = id;
312 ),
Christian König22073fe2016-02-26 16:18:36 +0100313 TP_printk("ring=%u, id=%u, pd_addr=%010Lx",
314 __entry->ring, __entry->id, __entry->pd_addr)
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400315);
316
Christian Königec744072015-06-10 14:45:21 +0200317TRACE_EVENT(amdgpu_bo_list_set,
318 TP_PROTO(struct amdgpu_bo_list *list, struct amdgpu_bo *bo),
319 TP_ARGS(list, bo),
320 TP_STRUCT__entry(
321 __field(struct amdgpu_bo_list *, list)
322 __field(struct amdgpu_bo *, bo)
David Mao42ffb582016-06-07 17:43:51 +0800323 __field(u64, bo_size)
Christian Königec744072015-06-10 14:45:21 +0200324 ),
325
326 TP_fast_assign(
327 __entry->list = list;
328 __entry->bo = bo;
David Mao42ffb582016-06-07 17:43:51 +0800329 __entry->bo_size = amdgpu_bo_size(bo);
Christian Königec744072015-06-10 14:45:21 +0200330 ),
Andres Rodriguez373eadf2017-03-09 21:25:51 -0500331 TP_printk("list=%p, bo=%p, bo_size=%Ld",
David Mao42ffb582016-06-07 17:43:51 +0800332 __entry->list,
333 __entry->bo,
334 __entry->bo_size)
Christian Königec744072015-06-10 14:45:21 +0200335);
336
David Mao15da3012016-06-07 17:48:52 +0800337TRACE_EVENT(amdgpu_cs_bo_status,
338 TP_PROTO(uint64_t total_bo, uint64_t total_size),
339 TP_ARGS(total_bo, total_size),
340 TP_STRUCT__entry(
341 __field(u64, total_bo)
342 __field(u64, total_size)
343 ),
344
345 TP_fast_assign(
346 __entry->total_bo = total_bo;
347 __entry->total_size = total_size;
348 ),
Andres Rodriguez373eadf2017-03-09 21:25:51 -0500349 TP_printk("total_bo_size=%Ld, total_bo_count=%Ld",
David Mao15da3012016-06-07 17:48:52 +0800350 __entry->total_bo, __entry->total_size)
351);
352
353TRACE_EVENT(amdgpu_ttm_bo_move,
354 TP_PROTO(struct amdgpu_bo* bo, uint32_t new_placement, uint32_t old_placement),
355 TP_ARGS(bo, new_placement, old_placement),
356 TP_STRUCT__entry(
357 __field(struct amdgpu_bo *, bo)
358 __field(u64, bo_size)
359 __field(u32, new_placement)
360 __field(u32, old_placement)
361 ),
362
363 TP_fast_assign(
364 __entry->bo = bo;
365 __entry->bo_size = amdgpu_bo_size(bo);
366 __entry->new_placement = new_placement;
367 __entry->old_placement = old_placement;
368 ),
Andres Rodriguezf8d56902017-02-24 13:20:57 -0500369 TP_printk("bo=%p, from=%d, to=%d, size=%Ld",
David Mao15da3012016-06-07 17:48:52 +0800370 __entry->bo, __entry->old_placement,
371 __entry->new_placement, __entry->bo_size)
372);
373
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400374#endif
375
376/* This part must be outside protection */
377#undef TRACE_INCLUDE_PATH
378#define TRACE_INCLUDE_PATH .
379#include <trace/define_trace.h>