blob: f808b5a6e52bdf85395ea8637afe67b82d53a1d7 [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
14TRACE_EVENT(amdgpu_bo_create,
15 TP_PROTO(struct amdgpu_bo *bo),
16 TP_ARGS(bo),
17 TP_STRUCT__entry(
18 __field(struct amdgpu_bo *, bo)
19 __field(u32, pages)
20 ),
21
22 TP_fast_assign(
23 __entry->bo = bo;
24 __entry->pages = bo->tbo.num_pages;
25 ),
26 TP_printk("bo=%p, pages=%u", __entry->bo, __entry->pages)
27);
28
29TRACE_EVENT(amdgpu_cs,
30 TP_PROTO(struct amdgpu_cs_parser *p, int i),
31 TP_ARGS(p, i),
32 TP_STRUCT__entry(
Christian Könige30590e2015-06-10 19:21:14 +020033 __field(struct amdgpu_bo_list *, bo_list)
Alex Deucherd38ceaf2015-04-20 16:55:21 -040034 __field(u32, ring)
35 __field(u32, dw)
36 __field(u32, fences)
37 ),
38
39 TP_fast_assign(
Christian Könige30590e2015-06-10 19:21:14 +020040 __entry->bo_list = p->bo_list;
Christian König50838c82016-02-03 13:44:52 +010041 __entry->ring = p->job->ibs[i].ring->idx;
42 __entry->dw = p->job->ibs[i].length_dw;
Alex Deucherd38ceaf2015-04-20 16:55:21 -040043 __entry->fences = amdgpu_fence_count_emitted(
Christian König50838c82016-02-03 13:44:52 +010044 p->job->ibs[i].ring);
Alex Deucherd38ceaf2015-04-20 16:55:21 -040045 ),
Christian Könige30590e2015-06-10 19:21:14 +020046 TP_printk("bo_list=%p, ring=%u, dw=%u, fences=%u",
47 __entry->bo_list, __entry->ring, __entry->dw,
Alex Deucherd38ceaf2015-04-20 16:55:21 -040048 __entry->fences)
49);
50
Chunming Zhou7034dec2015-11-11 14:56:00 +080051TRACE_EVENT(amdgpu_cs_ioctl,
52 TP_PROTO(struct amdgpu_job *job),
53 TP_ARGS(job),
54 TP_STRUCT__entry(
55 __field(struct amdgpu_device *, adev)
56 __field(struct amd_sched_job *, sched_job)
57 __field(struct amdgpu_ib *, ib)
58 __field(struct fence *, fence)
59 __field(char *, ring_name)
60 __field(u32, num_ibs)
61 ),
62
63 TP_fast_assign(
64 __entry->adev = job->adev;
65 __entry->sched_job = &job->base;
66 __entry->ib = job->ibs;
67 __entry->fence = &job->base.s_fence->base;
68 __entry->ring_name = job->ibs[0].ring->name;
69 __entry->num_ibs = job->num_ibs;
70 ),
71 TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name:%s, num_ibs:%u",
72 __entry->adev, __entry->sched_job, __entry->ib,
73 __entry->fence, __entry->ring_name, __entry->num_ibs)
74);
75
76TRACE_EVENT(amdgpu_sched_run_job,
77 TP_PROTO(struct amdgpu_job *job),
78 TP_ARGS(job),
79 TP_STRUCT__entry(
80 __field(struct amdgpu_device *, adev)
81 __field(struct amd_sched_job *, sched_job)
82 __field(struct amdgpu_ib *, ib)
83 __field(struct fence *, fence)
84 __field(char *, ring_name)
85 __field(u32, num_ibs)
86 ),
87
88 TP_fast_assign(
89 __entry->adev = job->adev;
90 __entry->sched_job = &job->base;
91 __entry->ib = job->ibs;
92 __entry->fence = &job->base.s_fence->base;
93 __entry->ring_name = job->ibs[0].ring->name;
94 __entry->num_ibs = job->num_ibs;
95 ),
96 TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name:%s, num_ibs:%u",
97 __entry->adev, __entry->sched_job, __entry->ib,
98 __entry->fence, __entry->ring_name, __entry->num_ibs)
99);
100
101
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400102TRACE_EVENT(amdgpu_vm_grab_id,
Christian König165e4e02016-01-07 18:15:22 +0100103 TP_PROTO(struct amdgpu_vm *vm, unsigned vmid, int ring),
104 TP_ARGS(vm, vmid, ring),
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400105 TP_STRUCT__entry(
Christian König165e4e02016-01-07 18:15:22 +0100106 __field(struct amdgpu_vm *, vm)
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400107 __field(u32, vmid)
108 __field(u32, ring)
109 ),
110
111 TP_fast_assign(
Christian König165e4e02016-01-07 18:15:22 +0100112 __entry->vm = vm;
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400113 __entry->vmid = vmid;
114 __entry->ring = ring;
115 ),
Christian König165e4e02016-01-07 18:15:22 +0100116 TP_printk("vm=%p, id=%u, ring=%u", __entry->vm, __entry->vmid,
117 __entry->ring)
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400118);
119
Christian König93e3e432015-06-09 16:58:33 +0200120TRACE_EVENT(amdgpu_vm_bo_map,
121 TP_PROTO(struct amdgpu_bo_va *bo_va,
122 struct amdgpu_bo_va_mapping *mapping),
123 TP_ARGS(bo_va, mapping),
124 TP_STRUCT__entry(
125 __field(struct amdgpu_bo *, bo)
126 __field(long, start)
127 __field(long, last)
128 __field(u64, offset)
129 __field(u32, flags)
130 ),
131
132 TP_fast_assign(
133 __entry->bo = bo_va->bo;
134 __entry->start = mapping->it.start;
135 __entry->last = mapping->it.last;
136 __entry->offset = mapping->offset;
137 __entry->flags = mapping->flags;
138 ),
139 TP_printk("bo=%p, start=%lx, last=%lx, offset=%010llx, flags=%08x",
140 __entry->bo, __entry->start, __entry->last,
141 __entry->offset, __entry->flags)
142);
143
144TRACE_EVENT(amdgpu_vm_bo_unmap,
145 TP_PROTO(struct amdgpu_bo_va *bo_va,
146 struct amdgpu_bo_va_mapping *mapping),
147 TP_ARGS(bo_va, mapping),
148 TP_STRUCT__entry(
149 __field(struct amdgpu_bo *, bo)
150 __field(long, start)
151 __field(long, last)
152 __field(u64, offset)
153 __field(u32, flags)
154 ),
155
156 TP_fast_assign(
157 __entry->bo = bo_va->bo;
158 __entry->start = mapping->it.start;
159 __entry->last = mapping->it.last;
160 __entry->offset = mapping->offset;
161 __entry->flags = mapping->flags;
162 ),
163 TP_printk("bo=%p, start=%lx, last=%lx, offset=%010llx, flags=%08x",
164 __entry->bo, __entry->start, __entry->last,
165 __entry->offset, __entry->flags)
166);
167
Christian Königd6c10f62015-09-28 12:00:23 +0200168DECLARE_EVENT_CLASS(amdgpu_vm_mapping,
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400169 TP_PROTO(struct amdgpu_bo_va_mapping *mapping),
170 TP_ARGS(mapping),
171 TP_STRUCT__entry(
172 __field(u64, soffset)
173 __field(u64, eoffset)
174 __field(u32, flags)
175 ),
176
177 TP_fast_assign(
178 __entry->soffset = mapping->it.start;
179 __entry->eoffset = mapping->it.last + 1;
180 __entry->flags = mapping->flags;
181 ),
182 TP_printk("soffs=%010llx, eoffs=%010llx, flags=%08x",
183 __entry->soffset, __entry->eoffset, __entry->flags)
184);
185
Christian Königd6c10f62015-09-28 12:00:23 +0200186DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_update,
187 TP_PROTO(struct amdgpu_bo_va_mapping *mapping),
188 TP_ARGS(mapping)
189);
190
191DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_mapping,
192 TP_PROTO(struct amdgpu_bo_va_mapping *mapping),
193 TP_ARGS(mapping)
194);
195
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400196TRACE_EVENT(amdgpu_vm_set_page,
197 TP_PROTO(uint64_t pe, uint64_t addr, unsigned count,
198 uint32_t incr, uint32_t flags),
199 TP_ARGS(pe, addr, count, incr, flags),
200 TP_STRUCT__entry(
201 __field(u64, pe)
202 __field(u64, addr)
203 __field(u32, count)
204 __field(u32, incr)
205 __field(u32, flags)
206 ),
207
208 TP_fast_assign(
209 __entry->pe = pe;
210 __entry->addr = addr;
211 __entry->count = count;
212 __entry->incr = incr;
213 __entry->flags = flags;
214 ),
215 TP_printk("pe=%010Lx, addr=%010Lx, incr=%u, flags=%08x, count=%u",
216 __entry->pe, __entry->addr, __entry->incr,
217 __entry->flags, __entry->count)
218);
219
220TRACE_EVENT(amdgpu_vm_flush,
221 TP_PROTO(uint64_t pd_addr, unsigned ring, unsigned id),
222 TP_ARGS(pd_addr, ring, id),
223 TP_STRUCT__entry(
224 __field(u64, pd_addr)
225 __field(u32, ring)
226 __field(u32, id)
227 ),
228
229 TP_fast_assign(
230 __entry->pd_addr = pd_addr;
231 __entry->ring = ring;
232 __entry->id = id;
233 ),
234 TP_printk("pd_addr=%010Lx, ring=%u, id=%u",
235 __entry->pd_addr, __entry->ring, __entry->id)
236);
237
Christian Königec744072015-06-10 14:45:21 +0200238TRACE_EVENT(amdgpu_bo_list_set,
239 TP_PROTO(struct amdgpu_bo_list *list, struct amdgpu_bo *bo),
240 TP_ARGS(list, bo),
241 TP_STRUCT__entry(
242 __field(struct amdgpu_bo_list *, list)
243 __field(struct amdgpu_bo *, bo)
244 ),
245
246 TP_fast_assign(
247 __entry->list = list;
248 __entry->bo = bo;
249 ),
250 TP_printk("list=%p, bo=%p", __entry->list, __entry->bo)
251);
252
Alex Deucherd38ceaf2015-04-20 16:55:21 -0400253#endif
254
255/* This part must be outside protection */
256#undef TRACE_INCLUDE_PATH
257#define TRACE_INCLUDE_PATH .
258#include <trace/define_trace.h>