trace.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. /*
  2. * Copyright 2015 IBM Corp.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #undef TRACE_SYSTEM
  10. #define TRACE_SYSTEM cxl
  11. #if !defined(_CXL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  12. #define _CXL_TRACE_H
  13. #include <linux/tracepoint.h>
  14. #include "cxl.h"
  15. #define DSISR_FLAGS \
  16. { CXL_PSL_DSISR_An_DS, "DS" }, \
  17. { CXL_PSL_DSISR_An_DM, "DM" }, \
  18. { CXL_PSL_DSISR_An_ST, "ST" }, \
  19. { CXL_PSL_DSISR_An_UR, "UR" }, \
  20. { CXL_PSL_DSISR_An_PE, "PE" }, \
  21. { CXL_PSL_DSISR_An_AE, "AE" }, \
  22. { CXL_PSL_DSISR_An_OC, "OC" }, \
  23. { CXL_PSL_DSISR_An_M, "M" }, \
  24. { CXL_PSL_DSISR_An_P, "P" }, \
  25. { CXL_PSL_DSISR_An_A, "A" }, \
  26. { CXL_PSL_DSISR_An_S, "S" }, \
  27. { CXL_PSL_DSISR_An_K, "K" }
  28. #define TFC_FLAGS \
  29. { CXL_PSL_TFC_An_A, "A" }, \
  30. { CXL_PSL_TFC_An_C, "C" }, \
  31. { CXL_PSL_TFC_An_AE, "AE" }, \
  32. { CXL_PSL_TFC_An_R, "R" }
  33. #define LLCMD_NAMES \
  34. { CXL_SPA_SW_CMD_TERMINATE, "TERMINATE" }, \
  35. { CXL_SPA_SW_CMD_REMOVE, "REMOVE" }, \
  36. { CXL_SPA_SW_CMD_SUSPEND, "SUSPEND" }, \
  37. { CXL_SPA_SW_CMD_RESUME, "RESUME" }, \
  38. { CXL_SPA_SW_CMD_ADD, "ADD" }, \
  39. { CXL_SPA_SW_CMD_UPDATE, "UPDATE" }
  40. #define AFU_COMMANDS \
  41. { 0, "DISABLE" }, \
  42. { CXL_AFU_Cntl_An_E, "ENABLE" }, \
  43. { CXL_AFU_Cntl_An_RA, "RESET" }
  44. #define PSL_COMMANDS \
  45. { CXL_PSL_SCNTL_An_Pc, "PURGE" }, \
  46. { CXL_PSL_SCNTL_An_Sc, "SUSPEND" }
  47. DECLARE_EVENT_CLASS(cxl_pe_class,
  48. TP_PROTO(struct cxl_context *ctx),
  49. TP_ARGS(ctx),
  50. TP_STRUCT__entry(
  51. __field(u8, card)
  52. __field(u8, afu)
  53. __field(u16, pe)
  54. ),
  55. TP_fast_assign(
  56. __entry->card = ctx->afu->adapter->adapter_num;
  57. __entry->afu = ctx->afu->slice;
  58. __entry->pe = ctx->pe;
  59. ),
  60. TP_printk("afu%i.%i pe=%i",
  61. __entry->card,
  62. __entry->afu,
  63. __entry->pe
  64. )
  65. );
  66. TRACE_EVENT(cxl_attach,
  67. TP_PROTO(struct cxl_context *ctx, u64 wed, s16 num_interrupts, u64 amr),
  68. TP_ARGS(ctx, wed, num_interrupts, amr),
  69. TP_STRUCT__entry(
  70. __field(u8, card)
  71. __field(u8, afu)
  72. __field(u16, pe)
  73. __field(pid_t, pid)
  74. __field(u64, wed)
  75. __field(u64, amr)
  76. __field(s16, num_interrupts)
  77. ),
  78. TP_fast_assign(
  79. __entry->card = ctx->afu->adapter->adapter_num;
  80. __entry->afu = ctx->afu->slice;
  81. __entry->pe = ctx->pe;
  82. __entry->pid = pid_nr(ctx->pid);
  83. __entry->wed = wed;
  84. __entry->amr = amr;
  85. __entry->num_interrupts = num_interrupts;
  86. ),
  87. TP_printk("afu%i.%i pid=%i pe=%i wed=0x%016llx irqs=%i amr=0x%llx",
  88. __entry->card,
  89. __entry->afu,
  90. __entry->pid,
  91. __entry->pe,
  92. __entry->wed,
  93. __entry->num_interrupts,
  94. __entry->amr
  95. )
  96. );
  97. DEFINE_EVENT(cxl_pe_class, cxl_detach,
  98. TP_PROTO(struct cxl_context *ctx),
  99. TP_ARGS(ctx)
  100. );
  101. TRACE_EVENT(cxl_afu_irq,
  102. TP_PROTO(struct cxl_context *ctx, int afu_irq, int virq, irq_hw_number_t hwirq),
  103. TP_ARGS(ctx, afu_irq, virq, hwirq),
  104. TP_STRUCT__entry(
  105. __field(u8, card)
  106. __field(u8, afu)
  107. __field(u16, pe)
  108. __field(u16, afu_irq)
  109. __field(int, virq)
  110. __field(irq_hw_number_t, hwirq)
  111. ),
  112. TP_fast_assign(
  113. __entry->card = ctx->afu->adapter->adapter_num;
  114. __entry->afu = ctx->afu->slice;
  115. __entry->pe = ctx->pe;
  116. __entry->afu_irq = afu_irq;
  117. __entry->virq = virq;
  118. __entry->hwirq = hwirq;
  119. ),
  120. TP_printk("afu%i.%i pe=%i afu_irq=%i virq=%i hwirq=0x%lx",
  121. __entry->card,
  122. __entry->afu,
  123. __entry->pe,
  124. __entry->afu_irq,
  125. __entry->virq,
  126. __entry->hwirq
  127. )
  128. );
  129. TRACE_EVENT(cxl_psl_irq,
  130. TP_PROTO(struct cxl_context *ctx, int irq, u64 dsisr, u64 dar),
  131. TP_ARGS(ctx, irq, dsisr, dar),
  132. TP_STRUCT__entry(
  133. __field(u8, card)
  134. __field(u8, afu)
  135. __field(u16, pe)
  136. __field(int, irq)
  137. __field(u64, dsisr)
  138. __field(u64, dar)
  139. ),
  140. TP_fast_assign(
  141. __entry->card = ctx->afu->adapter->adapter_num;
  142. __entry->afu = ctx->afu->slice;
  143. __entry->pe = ctx->pe;
  144. __entry->irq = irq;
  145. __entry->dsisr = dsisr;
  146. __entry->dar = dar;
  147. ),
  148. TP_printk("afu%i.%i pe=%i irq=%i dsisr=%s dar=0x%016llx",
  149. __entry->card,
  150. __entry->afu,
  151. __entry->pe,
  152. __entry->irq,
  153. __print_flags(__entry->dsisr, "|", DSISR_FLAGS),
  154. __entry->dar
  155. )
  156. );
  157. TRACE_EVENT(cxl_psl_irq_ack,
  158. TP_PROTO(struct cxl_context *ctx, u64 tfc),
  159. TP_ARGS(ctx, tfc),
  160. TP_STRUCT__entry(
  161. __field(u8, card)
  162. __field(u8, afu)
  163. __field(u16, pe)
  164. __field(u64, tfc)
  165. ),
  166. TP_fast_assign(
  167. __entry->card = ctx->afu->adapter->adapter_num;
  168. __entry->afu = ctx->afu->slice;
  169. __entry->pe = ctx->pe;
  170. __entry->tfc = tfc;
  171. ),
  172. TP_printk("afu%i.%i pe=%i tfc=%s",
  173. __entry->card,
  174. __entry->afu,
  175. __entry->pe,
  176. __print_flags(__entry->tfc, "|", TFC_FLAGS)
  177. )
  178. );
  179. TRACE_EVENT(cxl_ste_miss,
  180. TP_PROTO(struct cxl_context *ctx, u64 dar),
  181. TP_ARGS(ctx, dar),
  182. TP_STRUCT__entry(
  183. __field(u8, card)
  184. __field(u8, afu)
  185. __field(u16, pe)
  186. __field(u64, dar)
  187. ),
  188. TP_fast_assign(
  189. __entry->card = ctx->afu->adapter->adapter_num;
  190. __entry->afu = ctx->afu->slice;
  191. __entry->pe = ctx->pe;
  192. __entry->dar = dar;
  193. ),
  194. TP_printk("afu%i.%i pe=%i dar=0x%016llx",
  195. __entry->card,
  196. __entry->afu,
  197. __entry->pe,
  198. __entry->dar
  199. )
  200. );
  201. TRACE_EVENT(cxl_ste_write,
  202. TP_PROTO(struct cxl_context *ctx, unsigned int idx, u64 e, u64 v),
  203. TP_ARGS(ctx, idx, e, v),
  204. TP_STRUCT__entry(
  205. __field(u8, card)
  206. __field(u8, afu)
  207. __field(u16, pe)
  208. __field(unsigned int, idx)
  209. __field(u64, e)
  210. __field(u64, v)
  211. ),
  212. TP_fast_assign(
  213. __entry->card = ctx->afu->adapter->adapter_num;
  214. __entry->afu = ctx->afu->slice;
  215. __entry->pe = ctx->pe;
  216. __entry->idx = idx;
  217. __entry->e = e;
  218. __entry->v = v;
  219. ),
  220. TP_printk("afu%i.%i pe=%i SSTE[%i] E=0x%016llx V=0x%016llx",
  221. __entry->card,
  222. __entry->afu,
  223. __entry->pe,
  224. __entry->idx,
  225. __entry->e,
  226. __entry->v
  227. )
  228. );
  229. TRACE_EVENT(cxl_pte_miss,
  230. TP_PROTO(struct cxl_context *ctx, u64 dsisr, u64 dar),
  231. TP_ARGS(ctx, dsisr, dar),
  232. TP_STRUCT__entry(
  233. __field(u8, card)
  234. __field(u8, afu)
  235. __field(u16, pe)
  236. __field(u64, dsisr)
  237. __field(u64, dar)
  238. ),
  239. TP_fast_assign(
  240. __entry->card = ctx->afu->adapter->adapter_num;
  241. __entry->afu = ctx->afu->slice;
  242. __entry->pe = ctx->pe;
  243. __entry->dsisr = dsisr;
  244. __entry->dar = dar;
  245. ),
  246. TP_printk("afu%i.%i pe=%i dsisr=%s dar=0x%016llx",
  247. __entry->card,
  248. __entry->afu,
  249. __entry->pe,
  250. __print_flags(__entry->dsisr, "|", DSISR_FLAGS),
  251. __entry->dar
  252. )
  253. );
  254. TRACE_EVENT(cxl_llcmd,
  255. TP_PROTO(struct cxl_context *ctx, u64 cmd),
  256. TP_ARGS(ctx, cmd),
  257. TP_STRUCT__entry(
  258. __field(u8, card)
  259. __field(u8, afu)
  260. __field(u16, pe)
  261. __field(u64, cmd)
  262. ),
  263. TP_fast_assign(
  264. __entry->card = ctx->afu->adapter->adapter_num;
  265. __entry->afu = ctx->afu->slice;
  266. __entry->pe = ctx->pe;
  267. __entry->cmd = cmd;
  268. ),
  269. TP_printk("afu%i.%i pe=%i cmd=%s",
  270. __entry->card,
  271. __entry->afu,
  272. __entry->pe,
  273. __print_symbolic_u64(__entry->cmd, LLCMD_NAMES)
  274. )
  275. );
  276. TRACE_EVENT(cxl_llcmd_done,
  277. TP_PROTO(struct cxl_context *ctx, u64 cmd, int rc),
  278. TP_ARGS(ctx, cmd, rc),
  279. TP_STRUCT__entry(
  280. __field(u8, card)
  281. __field(u8, afu)
  282. __field(u16, pe)
  283. __field(u64, cmd)
  284. __field(int, rc)
  285. ),
  286. TP_fast_assign(
  287. __entry->card = ctx->afu->adapter->adapter_num;
  288. __entry->afu = ctx->afu->slice;
  289. __entry->pe = ctx->pe;
  290. __entry->rc = rc;
  291. __entry->cmd = cmd;
  292. ),
  293. TP_printk("afu%i.%i pe=%i cmd=%s rc=%i",
  294. __entry->card,
  295. __entry->afu,
  296. __entry->pe,
  297. __print_symbolic_u64(__entry->cmd, LLCMD_NAMES),
  298. __entry->rc
  299. )
  300. );
  301. DECLARE_EVENT_CLASS(cxl_afu_psl_ctrl,
  302. TP_PROTO(struct cxl_afu *afu, u64 cmd),
  303. TP_ARGS(afu, cmd),
  304. TP_STRUCT__entry(
  305. __field(u8, card)
  306. __field(u8, afu)
  307. __field(u64, cmd)
  308. ),
  309. TP_fast_assign(
  310. __entry->card = afu->adapter->adapter_num;
  311. __entry->afu = afu->slice;
  312. __entry->cmd = cmd;
  313. ),
  314. TP_printk("afu%i.%i cmd=%s",
  315. __entry->card,
  316. __entry->afu,
  317. __print_symbolic_u64(__entry->cmd, AFU_COMMANDS)
  318. )
  319. );
  320. DECLARE_EVENT_CLASS(cxl_afu_psl_ctrl_done,
  321. TP_PROTO(struct cxl_afu *afu, u64 cmd, int rc),
  322. TP_ARGS(afu, cmd, rc),
  323. TP_STRUCT__entry(
  324. __field(u8, card)
  325. __field(u8, afu)
  326. __field(u64, cmd)
  327. __field(int, rc)
  328. ),
  329. TP_fast_assign(
  330. __entry->card = afu->adapter->adapter_num;
  331. __entry->afu = afu->slice;
  332. __entry->rc = rc;
  333. __entry->cmd = cmd;
  334. ),
  335. TP_printk("afu%i.%i cmd=%s rc=%i",
  336. __entry->card,
  337. __entry->afu,
  338. __print_symbolic_u64(__entry->cmd, AFU_COMMANDS),
  339. __entry->rc
  340. )
  341. );
  342. DEFINE_EVENT(cxl_afu_psl_ctrl, cxl_afu_ctrl,
  343. TP_PROTO(struct cxl_afu *afu, u64 cmd),
  344. TP_ARGS(afu, cmd)
  345. );
  346. DEFINE_EVENT(cxl_afu_psl_ctrl_done, cxl_afu_ctrl_done,
  347. TP_PROTO(struct cxl_afu *afu, u64 cmd, int rc),
  348. TP_ARGS(afu, cmd, rc)
  349. );
  350. DEFINE_EVENT_PRINT(cxl_afu_psl_ctrl, cxl_psl_ctrl,
  351. TP_PROTO(struct cxl_afu *afu, u64 cmd),
  352. TP_ARGS(afu, cmd),
  353. TP_printk("psl%i.%i cmd=%s",
  354. __entry->card,
  355. __entry->afu,
  356. __print_symbolic_u64(__entry->cmd, PSL_COMMANDS)
  357. )
  358. );
  359. DEFINE_EVENT_PRINT(cxl_afu_psl_ctrl_done, cxl_psl_ctrl_done,
  360. TP_PROTO(struct cxl_afu *afu, u64 cmd, int rc),
  361. TP_ARGS(afu, cmd, rc),
  362. TP_printk("psl%i.%i cmd=%s rc=%i",
  363. __entry->card,
  364. __entry->afu,
  365. __print_symbolic_u64(__entry->cmd, PSL_COMMANDS),
  366. __entry->rc
  367. )
  368. );
  369. DEFINE_EVENT(cxl_pe_class, cxl_slbia,
  370. TP_PROTO(struct cxl_context *ctx),
  371. TP_ARGS(ctx)
  372. );
  373. TRACE_EVENT(cxl_hcall,
  374. TP_PROTO(u64 unit_address, u64 process_token, long rc),
  375. TP_ARGS(unit_address, process_token, rc),
  376. TP_STRUCT__entry(
  377. __field(u64, unit_address)
  378. __field(u64, process_token)
  379. __field(long, rc)
  380. ),
  381. TP_fast_assign(
  382. __entry->unit_address = unit_address;
  383. __entry->process_token = process_token;
  384. __entry->rc = rc;
  385. ),
  386. TP_printk("unit_address=0x%016llx process_token=0x%016llx rc=%li",
  387. __entry->unit_address,
  388. __entry->process_token,
  389. __entry->rc
  390. )
  391. );
  392. TRACE_EVENT(cxl_hcall_control,
  393. TP_PROTO(u64 unit_address, char *fct, u64 p1, u64 p2, u64 p3,
  394. u64 p4, unsigned long r4, long rc),
  395. TP_ARGS(unit_address, fct, p1, p2, p3, p4, r4, rc),
  396. TP_STRUCT__entry(
  397. __field(u64, unit_address)
  398. __field(char *, fct)
  399. __field(u64, p1)
  400. __field(u64, p2)
  401. __field(u64, p3)
  402. __field(u64, p4)
  403. __field(unsigned long, r4)
  404. __field(long, rc)
  405. ),
  406. TP_fast_assign(
  407. __entry->unit_address = unit_address;
  408. __entry->fct = fct;
  409. __entry->p1 = p1;
  410. __entry->p2 = p2;
  411. __entry->p3 = p3;
  412. __entry->p4 = p4;
  413. __entry->r4 = r4;
  414. __entry->rc = rc;
  415. ),
  416. TP_printk("unit_address=%#.16llx %s(%#llx, %#llx, %#llx, %#llx, R4: %#lx)): %li",
  417. __entry->unit_address,
  418. __entry->fct,
  419. __entry->p1,
  420. __entry->p2,
  421. __entry->p3,
  422. __entry->p4,
  423. __entry->r4,
  424. __entry->rc
  425. )
  426. );
  427. TRACE_EVENT(cxl_hcall_attach,
  428. TP_PROTO(u64 unit_address, u64 phys_addr, unsigned long process_token,
  429. unsigned long mmio_addr, unsigned long mmio_size, long rc),
  430. TP_ARGS(unit_address, phys_addr, process_token,
  431. mmio_addr, mmio_size, rc),
  432. TP_STRUCT__entry(
  433. __field(u64, unit_address)
  434. __field(u64, phys_addr)
  435. __field(unsigned long, process_token)
  436. __field(unsigned long, mmio_addr)
  437. __field(unsigned long, mmio_size)
  438. __field(long, rc)
  439. ),
  440. TP_fast_assign(
  441. __entry->unit_address = unit_address;
  442. __entry->phys_addr = phys_addr;
  443. __entry->process_token = process_token;
  444. __entry->mmio_addr = mmio_addr;
  445. __entry->mmio_size = mmio_size;
  446. __entry->rc = rc;
  447. ),
  448. TP_printk("unit_address=0x%016llx phys_addr=0x%016llx "
  449. "token=0x%.8lx mmio_addr=0x%lx mmio_size=0x%lx rc=%li",
  450. __entry->unit_address,
  451. __entry->phys_addr,
  452. __entry->process_token,
  453. __entry->mmio_addr,
  454. __entry->mmio_size,
  455. __entry->rc
  456. )
  457. );
  458. DEFINE_EVENT(cxl_hcall, cxl_hcall_detach,
  459. TP_PROTO(u64 unit_address, u64 process_token, long rc),
  460. TP_ARGS(unit_address, process_token, rc)
  461. );
  462. DEFINE_EVENT(cxl_hcall_control, cxl_hcall_control_function,
  463. TP_PROTO(u64 unit_address, char *fct, u64 p1, u64 p2, u64 p3,
  464. u64 p4, unsigned long r4, long rc),
  465. TP_ARGS(unit_address, fct, p1, p2, p3, p4, r4, rc)
  466. );
  467. DEFINE_EVENT(cxl_hcall, cxl_hcall_collect_int_info,
  468. TP_PROTO(u64 unit_address, u64 process_token, long rc),
  469. TP_ARGS(unit_address, process_token, rc)
  470. );
  471. TRACE_EVENT(cxl_hcall_control_faults,
  472. TP_PROTO(u64 unit_address, u64 process_token,
  473. u64 control_mask, u64 reset_mask, unsigned long r4,
  474. long rc),
  475. TP_ARGS(unit_address, process_token,
  476. control_mask, reset_mask, r4, rc),
  477. TP_STRUCT__entry(
  478. __field(u64, unit_address)
  479. __field(u64, process_token)
  480. __field(u64, control_mask)
  481. __field(u64, reset_mask)
  482. __field(unsigned long, r4)
  483. __field(long, rc)
  484. ),
  485. TP_fast_assign(
  486. __entry->unit_address = unit_address;
  487. __entry->process_token = process_token;
  488. __entry->control_mask = control_mask;
  489. __entry->reset_mask = reset_mask;
  490. __entry->r4 = r4;
  491. __entry->rc = rc;
  492. ),
  493. TP_printk("unit_address=0x%016llx process_token=0x%llx "
  494. "control_mask=%#llx reset_mask=%#llx r4=%#lx rc=%li",
  495. __entry->unit_address,
  496. __entry->process_token,
  497. __entry->control_mask,
  498. __entry->reset_mask,
  499. __entry->r4,
  500. __entry->rc
  501. )
  502. );
  503. DEFINE_EVENT(cxl_hcall_control, cxl_hcall_control_facility,
  504. TP_PROTO(u64 unit_address, char *fct, u64 p1, u64 p2, u64 p3,
  505. u64 p4, unsigned long r4, long rc),
  506. TP_ARGS(unit_address, fct, p1, p2, p3, p4, r4, rc)
  507. );
  508. TRACE_EVENT(cxl_hcall_download_facility,
  509. TP_PROTO(u64 unit_address, char *fct, u64 list_address, u64 num,
  510. unsigned long r4, long rc),
  511. TP_ARGS(unit_address, fct, list_address, num, r4, rc),
  512. TP_STRUCT__entry(
  513. __field(u64, unit_address)
  514. __field(char *, fct)
  515. __field(u64, list_address)
  516. __field(u64, num)
  517. __field(unsigned long, r4)
  518. __field(long, rc)
  519. ),
  520. TP_fast_assign(
  521. __entry->unit_address = unit_address;
  522. __entry->fct = fct;
  523. __entry->list_address = list_address;
  524. __entry->num = num;
  525. __entry->r4 = r4;
  526. __entry->rc = rc;
  527. ),
  528. TP_printk("%#.16llx, %s(%#llx, %#llx), %#lx): %li",
  529. __entry->unit_address,
  530. __entry->fct,
  531. __entry->list_address,
  532. __entry->num,
  533. __entry->r4,
  534. __entry->rc
  535. )
  536. );
  537. #endif /* _CXL_TRACE_H */
  538. /* This part must be outside protection */
  539. #undef TRACE_INCLUDE_PATH
  540. #define TRACE_INCLUDE_PATH .
  541. #define TRACE_INCLUDE_FILE trace
  542. #include <trace/define_trace.h>