fastrpc_trace.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #if !defined(TRACE_FASTRPC_H) || defined(TRACE_HEADER_MULTI_READ)
  7. #define TRACE_FASTRPC_H
  8. #undef TRACE_SYSTEM
  9. #define TRACE_SYSTEM fastrpc
  10. /* Path must be relative to location of 'define_trace.h' header in kernel */
  11. #undef TRACE_INCLUDE_PATH
  12. #define TRACE_INCLUDE_PATH ../../../../vendor/qcom/opensource/dsp-kernel/dsp
  13. /* Name of trace header file */
  14. #undef TRACE_INCLUDE_FILE
  15. #define TRACE_INCLUDE_FILE fastrpc_trace
  16. #include <linux/tracepoint.h>
  17. TRACE_EVENT(fastrpc_transport_send,
  18. TP_PROTO(int cid, uint64_t smq_ctx,
  19. uint64_t ctx, uint32_t handle,
  20. uint32_t sc, uint64_t addr, uint64_t size),
  21. TP_ARGS(cid, smq_ctx, ctx, handle, sc, addr, size),
  22. TP_STRUCT__entry(
  23. __field(int, cid)
  24. __field(u64, smq_ctx)
  25. __field(u64, ctx)
  26. __field(u32, handle)
  27. __field(u32, sc)
  28. __field(u64, addr)
  29. __field(u64, size)
  30. ),
  31. TP_fast_assign(
  32. __entry->cid = cid;
  33. __entry->smq_ctx = smq_ctx;
  34. __entry->ctx = ctx;
  35. __entry->handle = handle;
  36. __entry->sc = sc;
  37. __entry->addr = addr;
  38. __entry->size = size;
  39. ),
  40. TP_printk("to cid %d: smq_ctx 0x%llx, ctx 0x%llx, handle 0x%x, sc 0x%x, addr 0x%llx, size %llu",
  41. __entry->cid, __entry->smq_ctx, __entry->ctx, __entry->handle,
  42. __entry->sc, __entry->addr, __entry->size)
  43. );
  44. TRACE_EVENT(fastrpc_transport_response,
  45. TP_PROTO(int cid, uint64_t ctx, int retval,
  46. uint32_t rsp_flags, uint32_t early_wake_time),
  47. TP_ARGS(cid, ctx, retval, rsp_flags, early_wake_time),
  48. TP_STRUCT__entry(
  49. __field(int, cid)
  50. __field(u64, ctx)
  51. __field(int, retval)
  52. __field(u32, rsp_flags)
  53. __field(u32, early_wake_time)
  54. ),
  55. TP_fast_assign(
  56. __entry->cid = cid;
  57. __entry->ctx = ctx;
  58. __entry->retval = retval;
  59. __entry->rsp_flags = rsp_flags;
  60. __entry->early_wake_time = early_wake_time;
  61. ),
  62. TP_printk("from cid %d: ctx 0x%llx, retval 0x%x, rsp_flags %u, early_wake_time %u",
  63. __entry->cid, __entry->ctx, __entry->retval,
  64. __entry->rsp_flags, __entry->early_wake_time)
  65. );
  66. TRACE_EVENT(fastrpc_context_interrupt,
  67. TP_PROTO(int cid, uint64_t smq_ctx, uint64_t ctx,
  68. uint32_t handle, uint32_t sc),
  69. TP_ARGS(cid, smq_ctx, ctx, handle, sc),
  70. TP_STRUCT__entry(
  71. __field(int, cid)
  72. __field(u64, smq_ctx)
  73. __field(u64, ctx)
  74. __field(u32, handle)
  75. __field(u32, sc)
  76. ),
  77. TP_fast_assign(
  78. __entry->cid = cid;
  79. __entry->smq_ctx = smq_ctx;
  80. __entry->ctx = ctx;
  81. __entry->handle = handle;
  82. __entry->sc = sc;
  83. ),
  84. TP_printk("to cid %d: smq_ctx 0x%llx, ctx 0x%llx, handle 0x%x, sc 0x%x",
  85. __entry->cid, __entry->smq_ctx,
  86. __entry->ctx, __entry->handle, __entry->sc)
  87. );
  88. TRACE_EVENT(fastrpc_context_restore,
  89. TP_PROTO(int cid, uint64_t smq_ctx, uint64_t ctx,
  90. uint32_t handle, uint32_t sc),
  91. TP_ARGS(cid, smq_ctx, ctx, handle, sc),
  92. TP_STRUCT__entry(
  93. __field(int, cid)
  94. __field(u64, smq_ctx)
  95. __field(u64, ctx)
  96. __field(u32, handle)
  97. __field(u32, sc)
  98. ),
  99. TP_fast_assign(
  100. __entry->cid = cid;
  101. __entry->smq_ctx = smq_ctx;
  102. __entry->ctx = ctx;
  103. __entry->handle = handle;
  104. __entry->sc = sc;
  105. ),
  106. TP_printk("for cid %d: smq_ctx 0x%llx, ctx 0x%llx, handle 0x%x, sc 0x%x",
  107. __entry->cid, __entry->smq_ctx,
  108. __entry->ctx, __entry->handle, __entry->sc)
  109. );
  110. TRACE_EVENT(fastrpc_dma_map,
  111. TP_PROTO(int cid, int fd, uint64_t phys, size_t size,
  112. size_t len, unsigned int attr, int mflags),
  113. TP_ARGS(cid, fd, phys, size, len, attr, mflags),
  114. TP_STRUCT__entry(
  115. __field(int, cid)
  116. __field(int, fd)
  117. __field(u64, phys)
  118. __field(size_t, size)
  119. __field(size_t, len)
  120. __field(unsigned int, attr)
  121. __field(int, mflags)
  122. ),
  123. TP_fast_assign(
  124. __entry->cid = cid;
  125. __entry->fd = fd;
  126. __entry->phys = phys;
  127. __entry->size = size;
  128. __entry->len = len;
  129. __entry->attr = attr;
  130. __entry->mflags = mflags;
  131. ),
  132. TP_printk("cid %d, fd %d, phys 0x%llx, size %zu (len %zu), attr 0x%x, flags 0x%x",
  133. __entry->cid, __entry->fd, __entry->phys, __entry->size,
  134. __entry->len, __entry->attr, __entry->mflags)
  135. );
  136. TRACE_EVENT(fastrpc_dma_unmap,
  137. TP_PROTO(int cid, uint64_t phys, size_t size),
  138. TP_ARGS(cid, phys, size),
  139. TP_STRUCT__entry(
  140. __field(int, cid)
  141. __field(u64, phys)
  142. __field(size_t, size)
  143. ),
  144. TP_fast_assign(
  145. __entry->cid = cid;
  146. __entry->phys = phys;
  147. __entry->size = size;
  148. ),
  149. TP_printk("cid %d, phys 0x%llx, size %zu",
  150. __entry->cid, __entry->phys, __entry->size)
  151. );
  152. TRACE_EVENT(fastrpc_dma_alloc,
  153. TP_PROTO(int cid, uint64_t phys, size_t size,
  154. unsigned long attr, int mflags),
  155. TP_ARGS(cid, phys, size, attr, mflags),
  156. TP_STRUCT__entry(
  157. __field(int, cid)
  158. __field(u64, phys)
  159. __field(size_t, size)
  160. __field(unsigned long, attr)
  161. __field(int, mflags)
  162. ),
  163. TP_fast_assign(
  164. __entry->cid = cid;
  165. __entry->phys = phys;
  166. __entry->size = size;
  167. __entry->attr = attr;
  168. __entry->mflags = mflags;
  169. ),
  170. TP_printk("cid %d, phys 0x%llx, size %zu, attr 0x%lx, flags 0x%x",
  171. __entry->cid, __entry->phys, __entry->size,
  172. __entry->attr, __entry->mflags)
  173. );
  174. TRACE_EVENT(fastrpc_dma_free,
  175. TP_PROTO(int cid, uint64_t phys, size_t size),
  176. TP_ARGS(cid, phys, size),
  177. TP_STRUCT__entry(
  178. __field(int, cid)
  179. __field(u64, phys)
  180. __field(size_t, size)
  181. ),
  182. TP_fast_assign(
  183. __entry->cid = cid;
  184. __entry->phys = phys;
  185. __entry->size = size;
  186. ),
  187. TP_printk("cid %d, phys 0x%llx, size %zu",
  188. __entry->cid, __entry->phys, __entry->size)
  189. );
  190. TRACE_EVENT(fastrpc_context_complete,
  191. TP_PROTO(int cid, uint64_t smq_ctx, int retval,
  192. uint64_t ctx, uint32_t handle, uint32_t sc),
  193. TP_ARGS(cid, smq_ctx, retval, ctx, handle, sc),
  194. TP_STRUCT__entry(
  195. __field(int, cid)
  196. __field(u64, smq_ctx)
  197. __field(int, retval)
  198. __field(u64, ctx)
  199. __field(u32, handle)
  200. __field(u32, sc)
  201. ),
  202. TP_fast_assign(
  203. __entry->cid = cid;
  204. __entry->smq_ctx = smq_ctx;
  205. __entry->retval = retval;
  206. __entry->ctx = ctx;
  207. __entry->handle = handle;
  208. __entry->sc = sc;
  209. ),
  210. TP_printk("from cid %d: smq_ctx 0x%llx, retval 0x%x, ctx 0x%llx, handle 0x%x, sc 0x%x",
  211. __entry->cid, __entry->smq_ctx, __entry->retval,
  212. __entry->ctx, __entry->handle, __entry->sc)
  213. );
  214. TRACE_EVENT(fastrpc_context_alloc,
  215. TP_PROTO(uint64_t smq_ctx, uint64_t ctx,
  216. uint32_t handle, uint32_t sc),
  217. TP_ARGS(smq_ctx, ctx, handle, sc),
  218. TP_STRUCT__entry(
  219. __field(u64, smq_ctx)
  220. __field(u64, ctx)
  221. __field(u32, handle)
  222. __field(u32, sc)
  223. ),
  224. TP_fast_assign(
  225. __entry->smq_ctx = smq_ctx;
  226. __entry->ctx = ctx;
  227. __entry->handle = handle;
  228. __entry->sc = sc;
  229. ),
  230. TP_printk("for: smq_ctx 0x%llx, ctx 0x%llx, handle 0x%x, sc 0x%x",
  231. __entry->smq_ctx, __entry->ctx, __entry->handle, __entry->sc)
  232. );
  233. TRACE_EVENT(fastrpc_context_free,
  234. TP_PROTO(uint64_t smq_ctx, uint64_t ctx,
  235. uint32_t handle, uint32_t sc),
  236. TP_ARGS(smq_ctx, ctx, handle, sc),
  237. TP_STRUCT__entry(
  238. __field(u64, smq_ctx)
  239. __field(u64, ctx)
  240. __field(u32, handle)
  241. __field(u32, sc)
  242. ),
  243. TP_fast_assign(
  244. __entry->smq_ctx = smq_ctx;
  245. __entry->ctx = ctx;
  246. __entry->handle = handle;
  247. __entry->sc = sc;
  248. ),
  249. TP_printk("for: smq_ctx 0x%llx, ctx 0x%llx, handle 0x%x, sc 0x%x",
  250. __entry->smq_ctx, __entry->ctx, __entry->handle, __entry->sc)
  251. );
  252. TRACE_EVENT(fastrpc_perf_counters,
  253. TP_PROTO(uint32_t handle, uint32_t sc,
  254. uint64_t count, uint64_t flush, uint64_t map,
  255. uint64_t copy, uint64_t link, uint64_t getargs,
  256. uint64_t putargs, uint64_t invargs, uint64_t invoke,
  257. uint64_t tid),
  258. TP_ARGS(handle, sc, count, flush, map, copy, link, getargs,
  259. putargs, invargs, invoke, tid),
  260. TP_STRUCT__entry(
  261. __field(u32, handle)
  262. __field(u32, sc)
  263. __field(u64, count)
  264. __field(u64, flush)
  265. __field(u64, map)
  266. __field(u64, copy)
  267. __field(u64, link)
  268. __field(u64, getargs)
  269. __field(u64, putargs)
  270. __field(u64, invargs)
  271. __field(u64, invoke)
  272. __field(u64, tid)
  273. ),
  274. TP_fast_assign(
  275. __entry->handle = handle;
  276. __entry->sc = sc;
  277. __entry->count = count;
  278. __entry->flush = flush;
  279. __entry->map = map;
  280. __entry->copy = copy;
  281. __entry->link = link;
  282. __entry->getargs = getargs;
  283. __entry->putargs = putargs;
  284. __entry->invargs = invargs;
  285. __entry->invoke = invoke;
  286. __entry->tid = tid;
  287. ),
  288. TP_printk("for: handle 0x%x, sc 0x%x, count %lld, flush %lld ns, map %lld ns, copy %lld ns, link %lld ns, getargs %lld ns, putargs %lld ns, invargs %lld ns, invoke %lld ns, tid %lld",
  289. __entry->handle, __entry->sc, __entry->count,
  290. __entry->flush, __entry->map, __entry->copy, __entry->link,
  291. __entry->getargs, __entry->putargs, __entry->invargs,
  292. __entry->invoke, __entry->tid)
  293. );
  294. TRACE_EVENT(fastrpc_msg,
  295. TP_PROTO(const char *message),
  296. TP_ARGS(message),
  297. TP_STRUCT__entry(__string(buf, message)),
  298. TP_fast_assign(
  299. __assign_str(buf, message);
  300. ),
  301. TP_printk(" %s", __get_str(buf))
  302. );
  303. #endif
  304. /* This part must be outside protection */
  305. #include <trace/define_trace.h>