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 12 #define TRACE_INCLUDE_FILE amdgpu_trace 13 14 TRACE_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 29 TRACE_EVENT(amdgpu_cs, 30 TP_PROTO(struct amdgpu_cs_parser *p, int i), 31 TP_ARGS(p, i), 32 TP_STRUCT__entry( 33 __field(struct amdgpu_bo_list *, bo_list) 34 __field(u32, ring) 35 __field(u32, dw) 36 __field(u32, fences) 37 ), 38 39 TP_fast_assign( 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( 44 p->ibs[i].ring); 45 ), 46 TP_printk("bo_list=%p, ring=%u, dw=%u, fences=%u", 47 __entry->bo_list, __entry->ring, __entry->dw, 48 __entry->fences) 49 ); 50 51 TRACE_EVENT(amdgpu_vm_grab_id, 52 TP_PROTO(unsigned vmid, int ring), 53 TP_ARGS(vmid, ring), 54 TP_STRUCT__entry( 55 __field(u32, vmid) 56 __field(u32, ring) 57 ), 58 59 TP_fast_assign( 60 __entry->vmid = vmid; 61 __entry->ring = ring; 62 ), 63 TP_printk("vmid=%u, ring=%u", __entry->vmid, __entry->ring) 64 ); 65 66 TRACE_EVENT(amdgpu_vm_bo_map, 67 TP_PROTO(struct amdgpu_bo_va *bo_va, 68 struct amdgpu_bo_va_mapping *mapping), 69 TP_ARGS(bo_va, mapping), 70 TP_STRUCT__entry( 71 __field(struct amdgpu_bo *, bo) 72 __field(long, start) 73 __field(long, last) 74 __field(u64, offset) 75 __field(u32, flags) 76 ), 77 78 TP_fast_assign( 79 __entry->bo = bo_va->bo; 80 __entry->start = mapping->it.start; 81 __entry->last = mapping->it.last; 82 __entry->offset = mapping->offset; 83 __entry->flags = mapping->flags; 84 ), 85 TP_printk("bo=%p, start=%lx, last=%lx, offset=%010llx, flags=%08x", 86 __entry->bo, __entry->start, __entry->last, 87 __entry->offset, __entry->flags) 88 ); 89 90 TRACE_EVENT(amdgpu_vm_bo_unmap, 91 TP_PROTO(struct amdgpu_bo_va *bo_va, 92 struct amdgpu_bo_va_mapping *mapping), 93 TP_ARGS(bo_va, mapping), 94 TP_STRUCT__entry( 95 __field(struct amdgpu_bo *, bo) 96 __field(long, start) 97 __field(long, last) 98 __field(u64, offset) 99 __field(u32, flags) 100 ), 101 102 TP_fast_assign( 103 __entry->bo = bo_va->bo; 104 __entry->start = mapping->it.start; 105 __entry->last = mapping->it.last; 106 __entry->offset = mapping->offset; 107 __entry->flags = mapping->flags; 108 ), 109 TP_printk("bo=%p, start=%lx, last=%lx, offset=%010llx, flags=%08x", 110 __entry->bo, __entry->start, __entry->last, 111 __entry->offset, __entry->flags) 112 ); 113 114 DECLARE_EVENT_CLASS(amdgpu_vm_mapping, 115 TP_PROTO(struct amdgpu_bo_va_mapping *mapping), 116 TP_ARGS(mapping), 117 TP_STRUCT__entry( 118 __field(u64, soffset) 119 __field(u64, eoffset) 120 __field(u32, flags) 121 ), 122 123 TP_fast_assign( 124 __entry->soffset = mapping->it.start; 125 __entry->eoffset = mapping->it.last + 1; 126 __entry->flags = mapping->flags; 127 ), 128 TP_printk("soffs=%010llx, eoffs=%010llx, flags=%08x", 129 __entry->soffset, __entry->eoffset, __entry->flags) 130 ); 131 132 DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_update, 133 TP_PROTO(struct amdgpu_bo_va_mapping *mapping), 134 TP_ARGS(mapping) 135 ); 136 137 DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_mapping, 138 TP_PROTO(struct amdgpu_bo_va_mapping *mapping), 139 TP_ARGS(mapping) 140 ); 141 142 TRACE_EVENT(amdgpu_vm_set_page, 143 TP_PROTO(uint64_t pe, uint64_t addr, unsigned count, 144 uint32_t incr, uint32_t flags), 145 TP_ARGS(pe, addr, count, incr, flags), 146 TP_STRUCT__entry( 147 __field(u64, pe) 148 __field(u64, addr) 149 __field(u32, count) 150 __field(u32, incr) 151 __field(u32, flags) 152 ), 153 154 TP_fast_assign( 155 __entry->pe = pe; 156 __entry->addr = addr; 157 __entry->count = count; 158 __entry->incr = incr; 159 __entry->flags = flags; 160 ), 161 TP_printk("pe=%010Lx, addr=%010Lx, incr=%u, flags=%08x, count=%u", 162 __entry->pe, __entry->addr, __entry->incr, 163 __entry->flags, __entry->count) 164 ); 165 166 TRACE_EVENT(amdgpu_vm_flush, 167 TP_PROTO(uint64_t pd_addr, unsigned ring, unsigned id), 168 TP_ARGS(pd_addr, ring, id), 169 TP_STRUCT__entry( 170 __field(u64, pd_addr) 171 __field(u32, ring) 172 __field(u32, id) 173 ), 174 175 TP_fast_assign( 176 __entry->pd_addr = pd_addr; 177 __entry->ring = ring; 178 __entry->id = id; 179 ), 180 TP_printk("pd_addr=%010Lx, ring=%u, id=%u", 181 __entry->pd_addr, __entry->ring, __entry->id) 182 ); 183 184 TRACE_EVENT(amdgpu_bo_list_set, 185 TP_PROTO(struct amdgpu_bo_list *list, struct amdgpu_bo *bo), 186 TP_ARGS(list, bo), 187 TP_STRUCT__entry( 188 __field(struct amdgpu_bo_list *, list) 189 __field(struct amdgpu_bo *, bo) 190 ), 191 192 TP_fast_assign( 193 __entry->list = list; 194 __entry->bo = bo; 195 ), 196 TP_printk("list=%p, bo=%p", __entry->list, __entry->bo) 197 ); 198 199 DECLARE_EVENT_CLASS(amdgpu_fence_request, 200 201 TP_PROTO(struct drm_device *dev, int ring, u32 seqno), 202 203 TP_ARGS(dev, ring, seqno), 204 205 TP_STRUCT__entry( 206 __field(u32, dev) 207 __field(int, ring) 208 __field(u32, seqno) 209 ), 210 211 TP_fast_assign( 212 __entry->dev = dev->primary->index; 213 __entry->ring = ring; 214 __entry->seqno = seqno; 215 ), 216 217 TP_printk("dev=%u, ring=%d, seqno=%u", 218 __entry->dev, __entry->ring, __entry->seqno) 219 ); 220 221 DEFINE_EVENT(amdgpu_fence_request, amdgpu_fence_emit, 222 223 TP_PROTO(struct drm_device *dev, int ring, u32 seqno), 224 225 TP_ARGS(dev, ring, seqno) 226 ); 227 228 DEFINE_EVENT(amdgpu_fence_request, amdgpu_fence_wait_begin, 229 230 TP_PROTO(struct drm_device *dev, int ring, u32 seqno), 231 232 TP_ARGS(dev, ring, seqno) 233 ); 234 235 DEFINE_EVENT(amdgpu_fence_request, amdgpu_fence_wait_end, 236 237 TP_PROTO(struct drm_device *dev, int ring, u32 seqno), 238 239 TP_ARGS(dev, ring, seqno) 240 ); 241 242 DECLARE_EVENT_CLASS(amdgpu_semaphore_request, 243 244 TP_PROTO(int ring, struct amdgpu_semaphore *sem), 245 246 TP_ARGS(ring, sem), 247 248 TP_STRUCT__entry( 249 __field(int, ring) 250 __field(signed, waiters) 251 __field(uint64_t, gpu_addr) 252 ), 253 254 TP_fast_assign( 255 __entry->ring = ring; 256 __entry->waiters = sem->waiters; 257 __entry->gpu_addr = sem->gpu_addr; 258 ), 259 260 TP_printk("ring=%u, waiters=%d, addr=%010Lx", __entry->ring, 261 __entry->waiters, __entry->gpu_addr) 262 ); 263 264 DEFINE_EVENT(amdgpu_semaphore_request, amdgpu_semaphore_signale, 265 266 TP_PROTO(int ring, struct amdgpu_semaphore *sem), 267 268 TP_ARGS(ring, sem) 269 ); 270 271 DEFINE_EVENT(amdgpu_semaphore_request, amdgpu_semaphore_wait, 272 273 TP_PROTO(int ring, struct amdgpu_semaphore *sem), 274 275 TP_ARGS(ring, sem) 276 ); 277 278 #endif 279 280 /* This part must be outside protection */ 281 #undef TRACE_INCLUDE_PATH 282 #define TRACE_INCLUDE_PATH . 283 #include <trace/define_trace.h> 284