1 #if !defined(_AMDGPU_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
2 #define _AMDGPU_TRACE_H_
4 #include <linux/stringify.h>
5 #include <linux/types.h>
6 #include <linux/tracepoint.h>
11 #define TRACE_SYSTEM amdgpu
12 #define TRACE_INCLUDE_FILE amdgpu_trace
14 TRACE_EVENT(amdgpu_bo_create
,
15 TP_PROTO(struct amdgpu_bo
*bo
),
18 __field(struct amdgpu_bo
*, bo
)
24 __entry
->pages
= bo
->tbo
.num_pages
;
26 TP_printk("bo=%p, pages=%u", __entry
->bo
, __entry
->pages
)
29 TRACE_EVENT(amdgpu_cs
,
30 TP_PROTO(struct amdgpu_cs_parser
*p
, int i
),
33 __field(struct amdgpu_bo_list
*, bo_list
)
40 __entry
->bo_list
= p
->bo_list
;
41 __entry
->ring
= p
->ibs
[i
].ring
->idx
;
42 __entry
->dw
= p
->ibs
[i
].length_dw
;
43 __entry
->fences
= amdgpu_fence_count_emitted(
46 TP_printk("bo_list=%p, ring=%u, dw=%u, fences=%u",
47 __entry
->bo_list
, __entry
->ring
, __entry
->dw
,
51 TRACE_EVENT(amdgpu_cs_ioctl
,
52 TP_PROTO(struct amdgpu_job
*job
),
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
)
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
;
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
)
76 TRACE_EVENT(amdgpu_sched_run_job
,
77 TP_PROTO(struct amdgpu_job
*job
),
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
)
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
;
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
)
102 TRACE_EVENT(amdgpu_vm_grab_id
,
103 TP_PROTO(unsigned vmid
, int ring
),
111 __entry
->vmid
= vmid
;
112 __entry
->ring
= ring
;
114 TP_printk("vmid=%u, ring=%u", __entry
->vmid
, __entry
->ring
)
117 TRACE_EVENT(amdgpu_vm_bo_map
,
118 TP_PROTO(struct amdgpu_bo_va
*bo_va
,
119 struct amdgpu_bo_va_mapping
*mapping
),
120 TP_ARGS(bo_va
, mapping
),
122 __field(struct amdgpu_bo
*, bo
)
130 __entry
->bo
= bo_va
->bo
;
131 __entry
->start
= mapping
->it
.start
;
132 __entry
->last
= mapping
->it
.last
;
133 __entry
->offset
= mapping
->offset
;
134 __entry
->flags
= mapping
->flags
;
136 TP_printk("bo=%p, start=%lx, last=%lx, offset=%010llx, flags=%08x",
137 __entry
->bo
, __entry
->start
, __entry
->last
,
138 __entry
->offset
, __entry
->flags
)
141 TRACE_EVENT(amdgpu_vm_bo_unmap
,
142 TP_PROTO(struct amdgpu_bo_va
*bo_va
,
143 struct amdgpu_bo_va_mapping
*mapping
),
144 TP_ARGS(bo_va
, mapping
),
146 __field(struct amdgpu_bo
*, bo
)
154 __entry
->bo
= bo_va
->bo
;
155 __entry
->start
= mapping
->it
.start
;
156 __entry
->last
= mapping
->it
.last
;
157 __entry
->offset
= mapping
->offset
;
158 __entry
->flags
= mapping
->flags
;
160 TP_printk("bo=%p, start=%lx, last=%lx, offset=%010llx, flags=%08x",
161 __entry
->bo
, __entry
->start
, __entry
->last
,
162 __entry
->offset
, __entry
->flags
)
165 DECLARE_EVENT_CLASS(amdgpu_vm_mapping
,
166 TP_PROTO(struct amdgpu_bo_va_mapping
*mapping
),
169 __field(u64
, soffset
)
170 __field(u64
, eoffset
)
175 __entry
->soffset
= mapping
->it
.start
;
176 __entry
->eoffset
= mapping
->it
.last
+ 1;
177 __entry
->flags
= mapping
->flags
;
179 TP_printk("soffs=%010llx, eoffs=%010llx, flags=%08x",
180 __entry
->soffset
, __entry
->eoffset
, __entry
->flags
)
183 DEFINE_EVENT(amdgpu_vm_mapping
, amdgpu_vm_bo_update
,
184 TP_PROTO(struct amdgpu_bo_va_mapping
*mapping
),
188 DEFINE_EVENT(amdgpu_vm_mapping
, amdgpu_vm_bo_mapping
,
189 TP_PROTO(struct amdgpu_bo_va_mapping
*mapping
),
193 TRACE_EVENT(amdgpu_vm_set_page
,
194 TP_PROTO(uint64_t pe
, uint64_t addr
, unsigned count
,
195 uint32_t incr
, uint32_t flags
),
196 TP_ARGS(pe
, addr
, count
, incr
, flags
),
207 __entry
->addr
= addr
;
208 __entry
->count
= count
;
209 __entry
->incr
= incr
;
210 __entry
->flags
= flags
;
212 TP_printk("pe=%010Lx, addr=%010Lx, incr=%u, flags=%08x, count=%u",
213 __entry
->pe
, __entry
->addr
, __entry
->incr
,
214 __entry
->flags
, __entry
->count
)
217 TRACE_EVENT(amdgpu_vm_flush
,
218 TP_PROTO(uint64_t pd_addr
, unsigned ring
, unsigned id
),
219 TP_ARGS(pd_addr
, ring
, id
),
221 __field(u64
, pd_addr
)
227 __entry
->pd_addr
= pd_addr
;
228 __entry
->ring
= ring
;
231 TP_printk("pd_addr=%010Lx, ring=%u, id=%u",
232 __entry
->pd_addr
, __entry
->ring
, __entry
->id
)
235 TRACE_EVENT(amdgpu_bo_list_set
,
236 TP_PROTO(struct amdgpu_bo_list
*list
, struct amdgpu_bo
*bo
),
239 __field(struct amdgpu_bo_list
*, list
)
240 __field(struct amdgpu_bo
*, bo
)
244 __entry
->list
= list
;
247 TP_printk("list=%p, bo=%p", __entry
->list
, __entry
->bo
)
250 DECLARE_EVENT_CLASS(amdgpu_semaphore_request
,
252 TP_PROTO(int ring
, struct amdgpu_semaphore
*sem
),
258 __field(signed, waiters
)
259 __field(uint64_t, gpu_addr
)
263 __entry
->ring
= ring
;
264 __entry
->waiters
= sem
->waiters
;
265 __entry
->gpu_addr
= sem
->gpu_addr
;
268 TP_printk("ring=%u, waiters=%d, addr=%010Lx", __entry
->ring
,
269 __entry
->waiters
, __entry
->gpu_addr
)
272 DEFINE_EVENT(amdgpu_semaphore_request
, amdgpu_semaphore_signale
,
274 TP_PROTO(int ring
, struct amdgpu_semaphore
*sem
),
279 DEFINE_EVENT(amdgpu_semaphore_request
, amdgpu_semaphore_wait
,
281 TP_PROTO(int ring
, struct amdgpu_semaphore
*sem
),
288 /* This part must be outside protection */
289 #undef TRACE_INCLUDE_PATH
290 #define TRACE_INCLUDE_PATH .
291 #include <trace/define_trace.h>