Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 1 | #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 Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 12 | #define TRACE_INCLUDE_FILE amdgpu_trace |
| 13 | |
Tom St Denis | f4b373f | 2016-05-31 08:02:27 -0400 | [diff] [blame] | 14 | TRACE_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 | ), |
| 27 | TP_printk("0x%04lx, 0x%04lx, 0x%08lx", |
| 28 | (unsigned long)__entry->did, |
| 29 | (unsigned long)__entry->reg, |
| 30 | (unsigned long)__entry->value) |
| 31 | ); |
| 32 | |
| 33 | TRACE_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 | ), |
| 46 | TP_printk("0x%04lx, 0x%04lx, 0x%08lx", |
| 47 | (unsigned long)__entry->did, |
| 48 | (unsigned long)__entry->reg, |
| 49 | (unsigned long)__entry->value) |
| 50 | ); |
| 51 | |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 52 | TRACE_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) |
| 58 | ), |
| 59 | |
| 60 | TP_fast_assign( |
| 61 | __entry->bo = bo; |
| 62 | __entry->pages = bo->tbo.num_pages; |
| 63 | ), |
| 64 | TP_printk("bo=%p, pages=%u", __entry->bo, __entry->pages) |
| 65 | ); |
| 66 | |
| 67 | TRACE_EVENT(amdgpu_cs, |
| 68 | TP_PROTO(struct amdgpu_cs_parser *p, int i), |
| 69 | TP_ARGS(p, i), |
| 70 | TP_STRUCT__entry( |
Christian König | e30590e | 2015-06-10 19:21:14 +0200 | [diff] [blame] | 71 | __field(struct amdgpu_bo_list *, bo_list) |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 72 | __field(u32, ring) |
| 73 | __field(u32, dw) |
| 74 | __field(u32, fences) |
| 75 | ), |
| 76 | |
| 77 | TP_fast_assign( |
Christian König | e30590e | 2015-06-10 19:21:14 +0200 | [diff] [blame] | 78 | __entry->bo_list = p->bo_list; |
Christian König | b07c60c | 2016-01-31 12:29:04 +0100 | [diff] [blame] | 79 | __entry->ring = p->job->ring->idx; |
Christian König | 50838c8 | 2016-02-03 13:44:52 +0100 | [diff] [blame] | 80 | __entry->dw = p->job->ibs[i].length_dw; |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 81 | __entry->fences = amdgpu_fence_count_emitted( |
Christian König | b07c60c | 2016-01-31 12:29:04 +0100 | [diff] [blame] | 82 | p->job->ring); |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 83 | ), |
Christian König | e30590e | 2015-06-10 19:21:14 +0200 | [diff] [blame] | 84 | TP_printk("bo_list=%p, ring=%u, dw=%u, fences=%u", |
| 85 | __entry->bo_list, __entry->ring, __entry->dw, |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 86 | __entry->fences) |
| 87 | ); |
| 88 | |
Chunming Zhou | 7034dec | 2015-11-11 14:56:00 +0800 | [diff] [blame] | 89 | TRACE_EVENT(amdgpu_cs_ioctl, |
| 90 | TP_PROTO(struct amdgpu_job *job), |
| 91 | TP_ARGS(job), |
| 92 | TP_STRUCT__entry( |
| 93 | __field(struct amdgpu_device *, adev) |
| 94 | __field(struct amd_sched_job *, sched_job) |
| 95 | __field(struct amdgpu_ib *, ib) |
| 96 | __field(struct fence *, fence) |
| 97 | __field(char *, ring_name) |
| 98 | __field(u32, num_ibs) |
| 99 | ), |
| 100 | |
| 101 | TP_fast_assign( |
| 102 | __entry->adev = job->adev; |
| 103 | __entry->sched_job = &job->base; |
| 104 | __entry->ib = job->ibs; |
| 105 | __entry->fence = &job->base.s_fence->base; |
Christian König | b07c60c | 2016-01-31 12:29:04 +0100 | [diff] [blame] | 106 | __entry->ring_name = job->ring->name; |
Chunming Zhou | 7034dec | 2015-11-11 14:56:00 +0800 | [diff] [blame] | 107 | __entry->num_ibs = job->num_ibs; |
| 108 | ), |
| 109 | TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name:%s, num_ibs:%u", |
| 110 | __entry->adev, __entry->sched_job, __entry->ib, |
| 111 | __entry->fence, __entry->ring_name, __entry->num_ibs) |
| 112 | ); |
| 113 | |
| 114 | TRACE_EVENT(amdgpu_sched_run_job, |
| 115 | TP_PROTO(struct amdgpu_job *job), |
| 116 | TP_ARGS(job), |
| 117 | TP_STRUCT__entry( |
| 118 | __field(struct amdgpu_device *, adev) |
| 119 | __field(struct amd_sched_job *, sched_job) |
| 120 | __field(struct amdgpu_ib *, ib) |
| 121 | __field(struct fence *, fence) |
| 122 | __field(char *, ring_name) |
| 123 | __field(u32, num_ibs) |
| 124 | ), |
| 125 | |
| 126 | TP_fast_assign( |
| 127 | __entry->adev = job->adev; |
| 128 | __entry->sched_job = &job->base; |
| 129 | __entry->ib = job->ibs; |
| 130 | __entry->fence = &job->base.s_fence->base; |
Christian König | b07c60c | 2016-01-31 12:29:04 +0100 | [diff] [blame] | 131 | __entry->ring_name = job->ring->name; |
Chunming Zhou | 7034dec | 2015-11-11 14:56:00 +0800 | [diff] [blame] | 132 | __entry->num_ibs = job->num_ibs; |
| 133 | ), |
| 134 | TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name:%s, num_ibs:%u", |
| 135 | __entry->adev, __entry->sched_job, __entry->ib, |
| 136 | __entry->fence, __entry->ring_name, __entry->num_ibs) |
| 137 | ); |
| 138 | |
| 139 | |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 140 | TRACE_EVENT(amdgpu_vm_grab_id, |
Christian König | 22073fe | 2016-02-26 16:18:36 +0100 | [diff] [blame] | 141 | TP_PROTO(struct amdgpu_vm *vm, int ring, unsigned vmid, |
| 142 | uint64_t pd_addr), |
| 143 | TP_ARGS(vm, ring, vmid, pd_addr), |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 144 | TP_STRUCT__entry( |
Christian König | 165e4e0 | 2016-01-07 18:15:22 +0100 | [diff] [blame] | 145 | __field(struct amdgpu_vm *, vm) |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 146 | __field(u32, ring) |
Christian König | 22073fe | 2016-02-26 16:18:36 +0100 | [diff] [blame] | 147 | __field(u32, vmid) |
| 148 | __field(u64, pd_addr) |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 149 | ), |
| 150 | |
| 151 | TP_fast_assign( |
Christian König | 165e4e0 | 2016-01-07 18:15:22 +0100 | [diff] [blame] | 152 | __entry->vm = vm; |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 153 | __entry->ring = ring; |
Christian König | 22073fe | 2016-02-26 16:18:36 +0100 | [diff] [blame] | 154 | __entry->vmid = vmid; |
| 155 | __entry->pd_addr = pd_addr; |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 156 | ), |
Christian König | 22073fe | 2016-02-26 16:18:36 +0100 | [diff] [blame] | 157 | TP_printk("vm=%p, ring=%u, id=%u, pd_addr=%010Lx", __entry->vm, |
| 158 | __entry->ring, __entry->vmid, __entry->pd_addr) |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 159 | ); |
| 160 | |
Christian König | 93e3e43 | 2015-06-09 16:58:33 +0200 | [diff] [blame] | 161 | TRACE_EVENT(amdgpu_vm_bo_map, |
| 162 | TP_PROTO(struct amdgpu_bo_va *bo_va, |
| 163 | struct amdgpu_bo_va_mapping *mapping), |
| 164 | TP_ARGS(bo_va, mapping), |
| 165 | TP_STRUCT__entry( |
| 166 | __field(struct amdgpu_bo *, bo) |
| 167 | __field(long, start) |
| 168 | __field(long, last) |
| 169 | __field(u64, offset) |
| 170 | __field(u32, flags) |
| 171 | ), |
| 172 | |
| 173 | TP_fast_assign( |
| 174 | __entry->bo = bo_va->bo; |
| 175 | __entry->start = mapping->it.start; |
| 176 | __entry->last = mapping->it.last; |
| 177 | __entry->offset = mapping->offset; |
| 178 | __entry->flags = mapping->flags; |
| 179 | ), |
| 180 | TP_printk("bo=%p, start=%lx, last=%lx, offset=%010llx, flags=%08x", |
| 181 | __entry->bo, __entry->start, __entry->last, |
| 182 | __entry->offset, __entry->flags) |
| 183 | ); |
| 184 | |
| 185 | TRACE_EVENT(amdgpu_vm_bo_unmap, |
| 186 | TP_PROTO(struct amdgpu_bo_va *bo_va, |
| 187 | struct amdgpu_bo_va_mapping *mapping), |
| 188 | TP_ARGS(bo_va, mapping), |
| 189 | TP_STRUCT__entry( |
| 190 | __field(struct amdgpu_bo *, bo) |
| 191 | __field(long, start) |
| 192 | __field(long, last) |
| 193 | __field(u64, offset) |
| 194 | __field(u32, flags) |
| 195 | ), |
| 196 | |
| 197 | TP_fast_assign( |
| 198 | __entry->bo = bo_va->bo; |
| 199 | __entry->start = mapping->it.start; |
| 200 | __entry->last = mapping->it.last; |
| 201 | __entry->offset = mapping->offset; |
| 202 | __entry->flags = mapping->flags; |
| 203 | ), |
| 204 | TP_printk("bo=%p, start=%lx, last=%lx, offset=%010llx, flags=%08x", |
| 205 | __entry->bo, __entry->start, __entry->last, |
| 206 | __entry->offset, __entry->flags) |
| 207 | ); |
| 208 | |
Christian König | d6c10f6 | 2015-09-28 12:00:23 +0200 | [diff] [blame] | 209 | DECLARE_EVENT_CLASS(amdgpu_vm_mapping, |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 210 | TP_PROTO(struct amdgpu_bo_va_mapping *mapping), |
| 211 | TP_ARGS(mapping), |
| 212 | TP_STRUCT__entry( |
| 213 | __field(u64, soffset) |
| 214 | __field(u64, eoffset) |
| 215 | __field(u32, flags) |
| 216 | ), |
| 217 | |
| 218 | TP_fast_assign( |
| 219 | __entry->soffset = mapping->it.start; |
| 220 | __entry->eoffset = mapping->it.last + 1; |
| 221 | __entry->flags = mapping->flags; |
| 222 | ), |
| 223 | TP_printk("soffs=%010llx, eoffs=%010llx, flags=%08x", |
| 224 | __entry->soffset, __entry->eoffset, __entry->flags) |
| 225 | ); |
| 226 | |
Christian König | d6c10f6 | 2015-09-28 12:00:23 +0200 | [diff] [blame] | 227 | DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_update, |
| 228 | TP_PROTO(struct amdgpu_bo_va_mapping *mapping), |
| 229 | TP_ARGS(mapping) |
| 230 | ); |
| 231 | |
| 232 | DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_mapping, |
| 233 | TP_PROTO(struct amdgpu_bo_va_mapping *mapping), |
| 234 | TP_ARGS(mapping) |
| 235 | ); |
| 236 | |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 237 | TRACE_EVENT(amdgpu_vm_set_page, |
| 238 | TP_PROTO(uint64_t pe, uint64_t addr, unsigned count, |
| 239 | uint32_t incr, uint32_t flags), |
| 240 | TP_ARGS(pe, addr, count, incr, flags), |
| 241 | TP_STRUCT__entry( |
| 242 | __field(u64, pe) |
| 243 | __field(u64, addr) |
| 244 | __field(u32, count) |
| 245 | __field(u32, incr) |
| 246 | __field(u32, flags) |
| 247 | ), |
| 248 | |
| 249 | TP_fast_assign( |
| 250 | __entry->pe = pe; |
| 251 | __entry->addr = addr; |
| 252 | __entry->count = count; |
| 253 | __entry->incr = incr; |
| 254 | __entry->flags = flags; |
| 255 | ), |
| 256 | TP_printk("pe=%010Lx, addr=%010Lx, incr=%u, flags=%08x, count=%u", |
| 257 | __entry->pe, __entry->addr, __entry->incr, |
| 258 | __entry->flags, __entry->count) |
| 259 | ); |
| 260 | |
| 261 | TRACE_EVENT(amdgpu_vm_flush, |
| 262 | TP_PROTO(uint64_t pd_addr, unsigned ring, unsigned id), |
| 263 | TP_ARGS(pd_addr, ring, id), |
| 264 | TP_STRUCT__entry( |
| 265 | __field(u64, pd_addr) |
| 266 | __field(u32, ring) |
| 267 | __field(u32, id) |
| 268 | ), |
| 269 | |
| 270 | TP_fast_assign( |
| 271 | __entry->pd_addr = pd_addr; |
| 272 | __entry->ring = ring; |
| 273 | __entry->id = id; |
| 274 | ), |
Christian König | 22073fe | 2016-02-26 16:18:36 +0100 | [diff] [blame] | 275 | TP_printk("ring=%u, id=%u, pd_addr=%010Lx", |
| 276 | __entry->ring, __entry->id, __entry->pd_addr) |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 277 | ); |
| 278 | |
Christian König | ec74407 | 2015-06-10 14:45:21 +0200 | [diff] [blame] | 279 | TRACE_EVENT(amdgpu_bo_list_set, |
| 280 | TP_PROTO(struct amdgpu_bo_list *list, struct amdgpu_bo *bo), |
| 281 | TP_ARGS(list, bo), |
| 282 | TP_STRUCT__entry( |
| 283 | __field(struct amdgpu_bo_list *, list) |
| 284 | __field(struct amdgpu_bo *, bo) |
| 285 | ), |
| 286 | |
| 287 | TP_fast_assign( |
| 288 | __entry->list = list; |
| 289 | __entry->bo = bo; |
| 290 | ), |
| 291 | TP_printk("list=%p, bo=%p", __entry->list, __entry->bo) |
| 292 | ); |
| 293 | |
Alex Deucher | d38ceaf | 2015-04-20 16:55:21 -0400 | [diff] [blame] | 294 | #endif |
| 295 | |
| 296 | /* This part must be outside protection */ |
| 297 | #undef TRACE_INCLUDE_PATH |
| 298 | #define TRACE_INCLUDE_PATH . |
| 299 | #include <trace/define_trace.h> |