| xj | b04a402 | 2021-11-25 15:01:52 +0800 | [diff] [blame] | 1 | /* | 
 | 2 |  * include/trace/events/host1x.h | 
 | 3 |  * | 
 | 4 |  * host1x event logging to ftrace. | 
 | 5 |  * | 
 | 6 |  * Copyright (c) 2010-2013, NVIDIA Corporation. | 
 | 7 |  * | 
 | 8 |  * This program is free software; you can redistribute it and/or modify | 
 | 9 |  * it under the terms of the GNU General Public License as published by | 
 | 10 |  * the Free Software Foundation; either version 2 of the License, or | 
 | 11 |  * (at your option) any later version. | 
 | 12 |  * | 
 | 13 |  * This program is distributed in the hope that it will be useful, but WITHOUT | 
 | 14 |  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 
 | 15 |  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | 
 | 16 |  * more details. | 
 | 17 |  * | 
 | 18 |  * You should have received a copy of the GNU General Public License along | 
 | 19 |  * with this program; if not, write to the Free Software Foundation, Inc., | 
 | 20 |  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | 
 | 21 |  */ | 
 | 22 |  | 
 | 23 | #undef TRACE_SYSTEM | 
 | 24 | #define TRACE_SYSTEM host1x | 
 | 25 |  | 
 | 26 | #if !defined(_TRACE_HOST1X_H) || defined(TRACE_HEADER_MULTI_READ) | 
 | 27 | #define _TRACE_HOST1X_H | 
 | 28 |  | 
 | 29 | #include <linux/ktime.h> | 
 | 30 | #include <linux/tracepoint.h> | 
 | 31 |  | 
 | 32 | struct host1x_bo; | 
 | 33 |  | 
 | 34 | DECLARE_EVENT_CLASS(host1x, | 
 | 35 | 	TP_PROTO(const char *name), | 
 | 36 | 	TP_ARGS(name), | 
 | 37 | 	TP_STRUCT__entry(__field(const char *, name)), | 
 | 38 | 	TP_fast_assign(__entry->name = name;), | 
 | 39 | 	TP_printk("name=%s", __entry->name) | 
 | 40 | ); | 
 | 41 |  | 
 | 42 | DEFINE_EVENT(host1x, host1x_channel_open, | 
 | 43 | 	TP_PROTO(const char *name), | 
 | 44 | 	TP_ARGS(name) | 
 | 45 | ); | 
 | 46 |  | 
 | 47 | DEFINE_EVENT(host1x, host1x_channel_release, | 
 | 48 | 	TP_PROTO(const char *name), | 
 | 49 | 	TP_ARGS(name) | 
 | 50 | ); | 
 | 51 |  | 
 | 52 | DEFINE_EVENT(host1x, host1x_cdma_begin, | 
 | 53 | 	TP_PROTO(const char *name), | 
 | 54 | 	TP_ARGS(name) | 
 | 55 | ); | 
 | 56 |  | 
 | 57 | DEFINE_EVENT(host1x, host1x_cdma_end, | 
 | 58 | 	TP_PROTO(const char *name), | 
 | 59 | 	TP_ARGS(name) | 
 | 60 | ); | 
 | 61 |  | 
 | 62 | TRACE_EVENT(host1x_cdma_push, | 
 | 63 | 	TP_PROTO(const char *name, u32 op1, u32 op2), | 
 | 64 |  | 
 | 65 | 	TP_ARGS(name, op1, op2), | 
 | 66 |  | 
 | 67 | 	TP_STRUCT__entry( | 
 | 68 | 		__field(const char *, name) | 
 | 69 | 		__field(u32, op1) | 
 | 70 | 		__field(u32, op2) | 
 | 71 | 	), | 
 | 72 |  | 
 | 73 | 	TP_fast_assign( | 
 | 74 | 		__entry->name = name; | 
 | 75 | 		__entry->op1 = op1; | 
 | 76 | 		__entry->op2 = op2; | 
 | 77 | 	), | 
 | 78 |  | 
 | 79 | 	TP_printk("name=%s, op1=%08x, op2=%08x", | 
 | 80 | 		__entry->name, __entry->op1, __entry->op2) | 
 | 81 | ); | 
 | 82 |  | 
 | 83 | TRACE_EVENT(host1x_cdma_push_gather, | 
 | 84 | 	TP_PROTO(const char *name, struct host1x_bo *bo, | 
 | 85 | 			u32 words, u32 offset, void *cmdbuf), | 
 | 86 |  | 
 | 87 | 	TP_ARGS(name, bo, words, offset, cmdbuf), | 
 | 88 |  | 
 | 89 | 	TP_STRUCT__entry( | 
 | 90 | 		__field(const char *, name) | 
 | 91 | 		__field(struct host1x_bo *, bo) | 
 | 92 | 		__field(u32, words) | 
 | 93 | 		__field(u32, offset) | 
 | 94 | 		__field(bool, cmdbuf) | 
 | 95 | 		__dynamic_array(u32, cmdbuf, words) | 
 | 96 | 	), | 
 | 97 |  | 
 | 98 | 	TP_fast_assign( | 
 | 99 | 		if (cmdbuf) { | 
 | 100 | 			memcpy(__get_dynamic_array(cmdbuf), cmdbuf+offset, | 
 | 101 | 					words * sizeof(u32)); | 
 | 102 | 		} | 
 | 103 | 		__entry->cmdbuf = cmdbuf; | 
 | 104 | 		__entry->name = name; | 
 | 105 | 		__entry->bo = bo; | 
 | 106 | 		__entry->words = words; | 
 | 107 | 		__entry->offset = offset; | 
 | 108 | 	), | 
 | 109 |  | 
 | 110 | 	TP_printk("name=%s, bo=%p, words=%u, offset=%d, contents=[%s]", | 
 | 111 | 	  __entry->name, __entry->bo, | 
 | 112 | 	  __entry->words, __entry->offset, | 
 | 113 | 	  __print_hex(__get_dynamic_array(cmdbuf), | 
 | 114 | 		  __entry->cmdbuf ? __entry->words * 4 : 0)) | 
 | 115 | ); | 
 | 116 |  | 
 | 117 | TRACE_EVENT(host1x_channel_submit, | 
 | 118 | 	TP_PROTO(const char *name, u32 cmdbufs, u32 relocs, u32 syncpt_id, | 
 | 119 | 		 u32 syncpt_incrs), | 
 | 120 |  | 
 | 121 | 	TP_ARGS(name, cmdbufs, relocs, syncpt_id, syncpt_incrs), | 
 | 122 |  | 
 | 123 | 	TP_STRUCT__entry( | 
 | 124 | 		__field(const char *, name) | 
 | 125 | 		__field(u32, cmdbufs) | 
 | 126 | 		__field(u32, relocs) | 
 | 127 | 		__field(u32, syncpt_id) | 
 | 128 | 		__field(u32, syncpt_incrs) | 
 | 129 | 	), | 
 | 130 |  | 
 | 131 | 	TP_fast_assign( | 
 | 132 | 		__entry->name = name; | 
 | 133 | 		__entry->cmdbufs = cmdbufs; | 
 | 134 | 		__entry->relocs = relocs; | 
 | 135 | 		__entry->syncpt_id = syncpt_id; | 
 | 136 | 		__entry->syncpt_incrs = syncpt_incrs; | 
 | 137 | 	), | 
 | 138 |  | 
 | 139 | 	TP_printk("name=%s, cmdbufs=%u, relocs=%u, syncpt_id=%u, " | 
 | 140 | 		  "syncpt_incrs=%u", | 
 | 141 | 		  __entry->name, __entry->cmdbufs, __entry->relocs, | 
 | 142 | 		  __entry->syncpt_id, __entry->syncpt_incrs) | 
 | 143 | ); | 
 | 144 |  | 
 | 145 | TRACE_EVENT(host1x_channel_submitted, | 
 | 146 | 	TP_PROTO(const char *name, u32 syncpt_base, u32 syncpt_max), | 
 | 147 |  | 
 | 148 | 	TP_ARGS(name, syncpt_base, syncpt_max), | 
 | 149 |  | 
 | 150 | 	TP_STRUCT__entry( | 
 | 151 | 		__field(const char *, name) | 
 | 152 | 		__field(u32, syncpt_base) | 
 | 153 | 		__field(u32, syncpt_max) | 
 | 154 | 	), | 
 | 155 |  | 
 | 156 | 	TP_fast_assign( | 
 | 157 | 		__entry->name = name; | 
 | 158 | 		__entry->syncpt_base = syncpt_base; | 
 | 159 | 		__entry->syncpt_max = syncpt_max; | 
 | 160 | 	), | 
 | 161 |  | 
 | 162 | 	TP_printk("name=%s, syncpt_base=%d, syncpt_max=%d", | 
 | 163 | 		__entry->name, __entry->syncpt_base, __entry->syncpt_max) | 
 | 164 | ); | 
 | 165 |  | 
 | 166 | TRACE_EVENT(host1x_channel_submit_complete, | 
 | 167 | 	TP_PROTO(const char *name, int count, u32 thresh), | 
 | 168 |  | 
 | 169 | 	TP_ARGS(name, count, thresh), | 
 | 170 |  | 
 | 171 | 	TP_STRUCT__entry( | 
 | 172 | 		__field(const char *, name) | 
 | 173 | 		__field(int, count) | 
 | 174 | 		__field(u32, thresh) | 
 | 175 | 	), | 
 | 176 |  | 
 | 177 | 	TP_fast_assign( | 
 | 178 | 		__entry->name = name; | 
 | 179 | 		__entry->count = count; | 
 | 180 | 		__entry->thresh = thresh; | 
 | 181 | 	), | 
 | 182 |  | 
 | 183 | 	TP_printk("name=%s, count=%d, thresh=%d", | 
 | 184 | 		__entry->name, __entry->count, __entry->thresh) | 
 | 185 | ); | 
 | 186 |  | 
 | 187 | TRACE_EVENT(host1x_wait_cdma, | 
 | 188 | 	TP_PROTO(const char *name, u32 eventid), | 
 | 189 |  | 
 | 190 | 	TP_ARGS(name, eventid), | 
 | 191 |  | 
 | 192 | 	TP_STRUCT__entry( | 
 | 193 | 		__field(const char *, name) | 
 | 194 | 		__field(u32, eventid) | 
 | 195 | 	), | 
 | 196 |  | 
 | 197 | 	TP_fast_assign( | 
 | 198 | 		__entry->name = name; | 
 | 199 | 		__entry->eventid = eventid; | 
 | 200 | 	), | 
 | 201 |  | 
 | 202 | 	TP_printk("name=%s, event=%d", __entry->name, __entry->eventid) | 
 | 203 | ); | 
 | 204 |  | 
 | 205 | TRACE_EVENT(host1x_syncpt_load_min, | 
 | 206 | 	TP_PROTO(u32 id, u32 val), | 
 | 207 |  | 
 | 208 | 	TP_ARGS(id, val), | 
 | 209 |  | 
 | 210 | 	TP_STRUCT__entry( | 
 | 211 | 		__field(u32, id) | 
 | 212 | 		__field(u32, val) | 
 | 213 | 	), | 
 | 214 |  | 
 | 215 | 	TP_fast_assign( | 
 | 216 | 		__entry->id = id; | 
 | 217 | 		__entry->val = val; | 
 | 218 | 	), | 
 | 219 |  | 
 | 220 | 	TP_printk("id=%d, val=%d", __entry->id, __entry->val) | 
 | 221 | ); | 
 | 222 |  | 
 | 223 | TRACE_EVENT(host1x_syncpt_wait_check, | 
 | 224 | 	TP_PROTO(struct host1x_bo *bo, u32 offset, u32 syncpt_id, u32 thresh, | 
 | 225 | 		 u32 min), | 
 | 226 |  | 
 | 227 | 	TP_ARGS(bo, offset, syncpt_id, thresh, min), | 
 | 228 |  | 
 | 229 | 	TP_STRUCT__entry( | 
 | 230 | 		__field(struct host1x_bo *, bo) | 
 | 231 | 		__field(u32, offset) | 
 | 232 | 		__field(u32, syncpt_id) | 
 | 233 | 		__field(u32, thresh) | 
 | 234 | 		__field(u32, min) | 
 | 235 | 	), | 
 | 236 |  | 
 | 237 | 	TP_fast_assign( | 
 | 238 | 		__entry->bo = bo; | 
 | 239 | 		__entry->offset = offset; | 
 | 240 | 		__entry->syncpt_id = syncpt_id; | 
 | 241 | 		__entry->thresh = thresh; | 
 | 242 | 		__entry->min = min; | 
 | 243 | 	), | 
 | 244 |  | 
 | 245 | 	TP_printk("bo=%p, offset=%05x, id=%d, thresh=%d, current=%d", | 
 | 246 | 		__entry->bo, __entry->offset, | 
 | 247 | 		__entry->syncpt_id, __entry->thresh, | 
 | 248 | 		__entry->min) | 
 | 249 | ); | 
 | 250 |  | 
 | 251 | #endif /*  _TRACE_HOST1X_H */ | 
 | 252 |  | 
 | 253 | /* This part must be outside protection */ | 
 | 254 | #include <trace/define_trace.h> |