Linux 4.18.10
[linux/fpc-iii.git] / drivers / misc / cxl / trace.h
blobb8e300af0e55247bc323219f02cd1284324f7287
1 /*
2 * Copyright 2015 IBM Corp.
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 */
10 #undef TRACE_SYSTEM
11 #define TRACE_SYSTEM cxl
13 #if !defined(_CXL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
14 #define _CXL_TRACE_H
16 #include <linux/tracepoint.h>
18 #include "cxl.h"
20 #define dsisr_psl9_flags(flags) \
21 __print_flags(flags, "|", \
22 { CXL_PSL9_DSISR_An_CO_MASK, "FR" }, \
23 { CXL_PSL9_DSISR_An_TF, "TF" }, \
24 { CXL_PSL9_DSISR_An_PE, "PE" }, \
25 { CXL_PSL9_DSISR_An_AE, "AE" }, \
26 { CXL_PSL9_DSISR_An_OC, "OC" }, \
27 { CXL_PSL9_DSISR_An_S, "S" })
29 #define DSISR_FLAGS \
30 { CXL_PSL_DSISR_An_DS, "DS" }, \
31 { CXL_PSL_DSISR_An_DM, "DM" }, \
32 { CXL_PSL_DSISR_An_ST, "ST" }, \
33 { CXL_PSL_DSISR_An_UR, "UR" }, \
34 { CXL_PSL_DSISR_An_PE, "PE" }, \
35 { CXL_PSL_DSISR_An_AE, "AE" }, \
36 { CXL_PSL_DSISR_An_OC, "OC" }, \
37 { CXL_PSL_DSISR_An_M, "M" }, \
38 { CXL_PSL_DSISR_An_P, "P" }, \
39 { CXL_PSL_DSISR_An_A, "A" }, \
40 { CXL_PSL_DSISR_An_S, "S" }, \
41 { CXL_PSL_DSISR_An_K, "K" }
43 #define TFC_FLAGS \
44 { CXL_PSL_TFC_An_A, "A" }, \
45 { CXL_PSL_TFC_An_C, "C" }, \
46 { CXL_PSL_TFC_An_AE, "AE" }, \
47 { CXL_PSL_TFC_An_R, "R" }
49 #define LLCMD_NAMES \
50 { CXL_SPA_SW_CMD_TERMINATE, "TERMINATE" }, \
51 { CXL_SPA_SW_CMD_REMOVE, "REMOVE" }, \
52 { CXL_SPA_SW_CMD_SUSPEND, "SUSPEND" }, \
53 { CXL_SPA_SW_CMD_RESUME, "RESUME" }, \
54 { CXL_SPA_SW_CMD_ADD, "ADD" }, \
55 { CXL_SPA_SW_CMD_UPDATE, "UPDATE" }
57 #define AFU_COMMANDS \
58 { 0, "DISABLE" }, \
59 { CXL_AFU_Cntl_An_E, "ENABLE" }, \
60 { CXL_AFU_Cntl_An_RA, "RESET" }
62 #define PSL_COMMANDS \
63 { CXL_PSL_SCNTL_An_Pc, "PURGE" }, \
64 { CXL_PSL_SCNTL_An_Sc, "SUSPEND" }
67 DECLARE_EVENT_CLASS(cxl_pe_class,
68 TP_PROTO(struct cxl_context *ctx),
70 TP_ARGS(ctx),
72 TP_STRUCT__entry(
73 __field(u8, card)
74 __field(u8, afu)
75 __field(u16, pe)
78 TP_fast_assign(
79 __entry->card = ctx->afu->adapter->adapter_num;
80 __entry->afu = ctx->afu->slice;
81 __entry->pe = ctx->pe;
84 TP_printk("afu%i.%i pe=%i",
85 __entry->card,
86 __entry->afu,
87 __entry->pe
92 TRACE_EVENT(cxl_attach,
93 TP_PROTO(struct cxl_context *ctx, u64 wed, s16 num_interrupts, u64 amr),
95 TP_ARGS(ctx, wed, num_interrupts, amr),
97 TP_STRUCT__entry(
98 __field(u8, card)
99 __field(u8, afu)
100 __field(u16, pe)
101 __field(pid_t, pid)
102 __field(u64, wed)
103 __field(u64, amr)
104 __field(s16, num_interrupts)
107 TP_fast_assign(
108 __entry->card = ctx->afu->adapter->adapter_num;
109 __entry->afu = ctx->afu->slice;
110 __entry->pe = ctx->pe;
111 __entry->pid = pid_nr(ctx->pid);
112 __entry->wed = wed;
113 __entry->amr = amr;
114 __entry->num_interrupts = num_interrupts;
117 TP_printk("afu%i.%i pid=%i pe=%i wed=0x%016llx irqs=%i amr=0x%llx",
118 __entry->card,
119 __entry->afu,
120 __entry->pid,
121 __entry->pe,
122 __entry->wed,
123 __entry->num_interrupts,
124 __entry->amr
128 DEFINE_EVENT(cxl_pe_class, cxl_detach,
129 TP_PROTO(struct cxl_context *ctx),
130 TP_ARGS(ctx)
133 TRACE_EVENT(cxl_afu_irq,
134 TP_PROTO(struct cxl_context *ctx, int afu_irq, int virq, irq_hw_number_t hwirq),
136 TP_ARGS(ctx, afu_irq, virq, hwirq),
138 TP_STRUCT__entry(
139 __field(u8, card)
140 __field(u8, afu)
141 __field(u16, pe)
142 __field(u16, afu_irq)
143 __field(int, virq)
144 __field(irq_hw_number_t, hwirq)
147 TP_fast_assign(
148 __entry->card = ctx->afu->adapter->adapter_num;
149 __entry->afu = ctx->afu->slice;
150 __entry->pe = ctx->pe;
151 __entry->afu_irq = afu_irq;
152 __entry->virq = virq;
153 __entry->hwirq = hwirq;
156 TP_printk("afu%i.%i pe=%i afu_irq=%i virq=%i hwirq=0x%lx",
157 __entry->card,
158 __entry->afu,
159 __entry->pe,
160 __entry->afu_irq,
161 __entry->virq,
162 __entry->hwirq
166 TRACE_EVENT(cxl_psl9_irq,
167 TP_PROTO(struct cxl_context *ctx, int irq, u64 dsisr, u64 dar),
169 TP_ARGS(ctx, irq, dsisr, dar),
171 TP_STRUCT__entry(
172 __field(u8, card)
173 __field(u8, afu)
174 __field(u16, pe)
175 __field(int, irq)
176 __field(u64, dsisr)
177 __field(u64, dar)
180 TP_fast_assign(
181 __entry->card = ctx->afu->adapter->adapter_num;
182 __entry->afu = ctx->afu->slice;
183 __entry->pe = ctx->pe;
184 __entry->irq = irq;
185 __entry->dsisr = dsisr;
186 __entry->dar = dar;
189 TP_printk("afu%i.%i pe=%i irq=%i dsisr=0x%016llx dsisr=%s dar=0x%016llx",
190 __entry->card,
191 __entry->afu,
192 __entry->pe,
193 __entry->irq,
194 __entry->dsisr,
195 dsisr_psl9_flags(__entry->dsisr),
196 __entry->dar
200 TRACE_EVENT(cxl_psl_irq,
201 TP_PROTO(struct cxl_context *ctx, int irq, u64 dsisr, u64 dar),
203 TP_ARGS(ctx, irq, dsisr, dar),
205 TP_STRUCT__entry(
206 __field(u8, card)
207 __field(u8, afu)
208 __field(u16, pe)
209 __field(int, irq)
210 __field(u64, dsisr)
211 __field(u64, dar)
214 TP_fast_assign(
215 __entry->card = ctx->afu->adapter->adapter_num;
216 __entry->afu = ctx->afu->slice;
217 __entry->pe = ctx->pe;
218 __entry->irq = irq;
219 __entry->dsisr = dsisr;
220 __entry->dar = dar;
223 TP_printk("afu%i.%i pe=%i irq=%i dsisr=%s dar=0x%016llx",
224 __entry->card,
225 __entry->afu,
226 __entry->pe,
227 __entry->irq,
228 __print_flags(__entry->dsisr, "|", DSISR_FLAGS),
229 __entry->dar
233 TRACE_EVENT(cxl_psl_irq_ack,
234 TP_PROTO(struct cxl_context *ctx, u64 tfc),
236 TP_ARGS(ctx, tfc),
238 TP_STRUCT__entry(
239 __field(u8, card)
240 __field(u8, afu)
241 __field(u16, pe)
242 __field(u64, tfc)
245 TP_fast_assign(
246 __entry->card = ctx->afu->adapter->adapter_num;
247 __entry->afu = ctx->afu->slice;
248 __entry->pe = ctx->pe;
249 __entry->tfc = tfc;
252 TP_printk("afu%i.%i pe=%i tfc=%s",
253 __entry->card,
254 __entry->afu,
255 __entry->pe,
256 __print_flags(__entry->tfc, "|", TFC_FLAGS)
260 TRACE_EVENT(cxl_ste_miss,
261 TP_PROTO(struct cxl_context *ctx, u64 dar),
263 TP_ARGS(ctx, dar),
265 TP_STRUCT__entry(
266 __field(u8, card)
267 __field(u8, afu)
268 __field(u16, pe)
269 __field(u64, dar)
272 TP_fast_assign(
273 __entry->card = ctx->afu->adapter->adapter_num;
274 __entry->afu = ctx->afu->slice;
275 __entry->pe = ctx->pe;
276 __entry->dar = dar;
279 TP_printk("afu%i.%i pe=%i dar=0x%016llx",
280 __entry->card,
281 __entry->afu,
282 __entry->pe,
283 __entry->dar
287 TRACE_EVENT(cxl_ste_write,
288 TP_PROTO(struct cxl_context *ctx, unsigned int idx, u64 e, u64 v),
290 TP_ARGS(ctx, idx, e, v),
292 TP_STRUCT__entry(
293 __field(u8, card)
294 __field(u8, afu)
295 __field(u16, pe)
296 __field(unsigned int, idx)
297 __field(u64, e)
298 __field(u64, v)
301 TP_fast_assign(
302 __entry->card = ctx->afu->adapter->adapter_num;
303 __entry->afu = ctx->afu->slice;
304 __entry->pe = ctx->pe;
305 __entry->idx = idx;
306 __entry->e = e;
307 __entry->v = v;
310 TP_printk("afu%i.%i pe=%i SSTE[%i] E=0x%016llx V=0x%016llx",
311 __entry->card,
312 __entry->afu,
313 __entry->pe,
314 __entry->idx,
315 __entry->e,
316 __entry->v
320 TRACE_EVENT(cxl_pte_miss,
321 TP_PROTO(struct cxl_context *ctx, u64 dsisr, u64 dar),
323 TP_ARGS(ctx, dsisr, dar),
325 TP_STRUCT__entry(
326 __field(u8, card)
327 __field(u8, afu)
328 __field(u16, pe)
329 __field(u64, dsisr)
330 __field(u64, dar)
333 TP_fast_assign(
334 __entry->card = ctx->afu->adapter->adapter_num;
335 __entry->afu = ctx->afu->slice;
336 __entry->pe = ctx->pe;
337 __entry->dsisr = dsisr;
338 __entry->dar = dar;
341 TP_printk("afu%i.%i pe=%i dsisr=%s dar=0x%016llx",
342 __entry->card,
343 __entry->afu,
344 __entry->pe,
345 __print_flags(__entry->dsisr, "|", DSISR_FLAGS),
346 __entry->dar
350 TRACE_EVENT(cxl_llcmd,
351 TP_PROTO(struct cxl_context *ctx, u64 cmd),
353 TP_ARGS(ctx, cmd),
355 TP_STRUCT__entry(
356 __field(u8, card)
357 __field(u8, afu)
358 __field(u16, pe)
359 __field(u64, cmd)
362 TP_fast_assign(
363 __entry->card = ctx->afu->adapter->adapter_num;
364 __entry->afu = ctx->afu->slice;
365 __entry->pe = ctx->pe;
366 __entry->cmd = cmd;
369 TP_printk("afu%i.%i pe=%i cmd=%s",
370 __entry->card,
371 __entry->afu,
372 __entry->pe,
373 __print_symbolic_u64(__entry->cmd, LLCMD_NAMES)
377 TRACE_EVENT(cxl_llcmd_done,
378 TP_PROTO(struct cxl_context *ctx, u64 cmd, int rc),
380 TP_ARGS(ctx, cmd, rc),
382 TP_STRUCT__entry(
383 __field(u8, card)
384 __field(u8, afu)
385 __field(u16, pe)
386 __field(u64, cmd)
387 __field(int, rc)
390 TP_fast_assign(
391 __entry->card = ctx->afu->adapter->adapter_num;
392 __entry->afu = ctx->afu->slice;
393 __entry->pe = ctx->pe;
394 __entry->rc = rc;
395 __entry->cmd = cmd;
398 TP_printk("afu%i.%i pe=%i cmd=%s rc=%i",
399 __entry->card,
400 __entry->afu,
401 __entry->pe,
402 __print_symbolic_u64(__entry->cmd, LLCMD_NAMES),
403 __entry->rc
407 DECLARE_EVENT_CLASS(cxl_afu_psl_ctrl,
408 TP_PROTO(struct cxl_afu *afu, u64 cmd),
410 TP_ARGS(afu, cmd),
412 TP_STRUCT__entry(
413 __field(u8, card)
414 __field(u8, afu)
415 __field(u64, cmd)
418 TP_fast_assign(
419 __entry->card = afu->adapter->adapter_num;
420 __entry->afu = afu->slice;
421 __entry->cmd = cmd;
424 TP_printk("afu%i.%i cmd=%s",
425 __entry->card,
426 __entry->afu,
427 __print_symbolic_u64(__entry->cmd, AFU_COMMANDS)
431 DECLARE_EVENT_CLASS(cxl_afu_psl_ctrl_done,
432 TP_PROTO(struct cxl_afu *afu, u64 cmd, int rc),
434 TP_ARGS(afu, cmd, rc),
436 TP_STRUCT__entry(
437 __field(u8, card)
438 __field(u8, afu)
439 __field(u64, cmd)
440 __field(int, rc)
443 TP_fast_assign(
444 __entry->card = afu->adapter->adapter_num;
445 __entry->afu = afu->slice;
446 __entry->rc = rc;
447 __entry->cmd = cmd;
450 TP_printk("afu%i.%i cmd=%s rc=%i",
451 __entry->card,
452 __entry->afu,
453 __print_symbolic_u64(__entry->cmd, AFU_COMMANDS),
454 __entry->rc
458 DEFINE_EVENT(cxl_afu_psl_ctrl, cxl_afu_ctrl,
459 TP_PROTO(struct cxl_afu *afu, u64 cmd),
460 TP_ARGS(afu, cmd)
463 DEFINE_EVENT(cxl_afu_psl_ctrl_done, cxl_afu_ctrl_done,
464 TP_PROTO(struct cxl_afu *afu, u64 cmd, int rc),
465 TP_ARGS(afu, cmd, rc)
468 DEFINE_EVENT_PRINT(cxl_afu_psl_ctrl, cxl_psl_ctrl,
469 TP_PROTO(struct cxl_afu *afu, u64 cmd),
470 TP_ARGS(afu, cmd),
472 TP_printk("psl%i.%i cmd=%s",
473 __entry->card,
474 __entry->afu,
475 __print_symbolic_u64(__entry->cmd, PSL_COMMANDS)
479 DEFINE_EVENT_PRINT(cxl_afu_psl_ctrl_done, cxl_psl_ctrl_done,
480 TP_PROTO(struct cxl_afu *afu, u64 cmd, int rc),
481 TP_ARGS(afu, cmd, rc),
483 TP_printk("psl%i.%i cmd=%s rc=%i",
484 __entry->card,
485 __entry->afu,
486 __print_symbolic_u64(__entry->cmd, PSL_COMMANDS),
487 __entry->rc
491 DEFINE_EVENT(cxl_pe_class, cxl_slbia,
492 TP_PROTO(struct cxl_context *ctx),
493 TP_ARGS(ctx)
496 TRACE_EVENT(cxl_hcall,
497 TP_PROTO(u64 unit_address, u64 process_token, long rc),
499 TP_ARGS(unit_address, process_token, rc),
501 TP_STRUCT__entry(
502 __field(u64, unit_address)
503 __field(u64, process_token)
504 __field(long, rc)
507 TP_fast_assign(
508 __entry->unit_address = unit_address;
509 __entry->process_token = process_token;
510 __entry->rc = rc;
513 TP_printk("unit_address=0x%016llx process_token=0x%016llx rc=%li",
514 __entry->unit_address,
515 __entry->process_token,
516 __entry->rc
520 TRACE_EVENT(cxl_hcall_control,
521 TP_PROTO(u64 unit_address, char *fct, u64 p1, u64 p2, u64 p3,
522 u64 p4, unsigned long r4, long rc),
524 TP_ARGS(unit_address, fct, p1, p2, p3, p4, r4, rc),
526 TP_STRUCT__entry(
527 __field(u64, unit_address)
528 __field(char *, fct)
529 __field(u64, p1)
530 __field(u64, p2)
531 __field(u64, p3)
532 __field(u64, p4)
533 __field(unsigned long, r4)
534 __field(long, rc)
537 TP_fast_assign(
538 __entry->unit_address = unit_address;
539 __entry->fct = fct;
540 __entry->p1 = p1;
541 __entry->p2 = p2;
542 __entry->p3 = p3;
543 __entry->p4 = p4;
544 __entry->r4 = r4;
545 __entry->rc = rc;
548 TP_printk("unit_address=%#.16llx %s(%#llx, %#llx, %#llx, %#llx, R4: %#lx)): %li",
549 __entry->unit_address,
550 __entry->fct,
551 __entry->p1,
552 __entry->p2,
553 __entry->p3,
554 __entry->p4,
555 __entry->r4,
556 __entry->rc
560 TRACE_EVENT(cxl_hcall_attach,
561 TP_PROTO(u64 unit_address, u64 phys_addr, unsigned long process_token,
562 unsigned long mmio_addr, unsigned long mmio_size, long rc),
564 TP_ARGS(unit_address, phys_addr, process_token,
565 mmio_addr, mmio_size, rc),
567 TP_STRUCT__entry(
568 __field(u64, unit_address)
569 __field(u64, phys_addr)
570 __field(unsigned long, process_token)
571 __field(unsigned long, mmio_addr)
572 __field(unsigned long, mmio_size)
573 __field(long, rc)
576 TP_fast_assign(
577 __entry->unit_address = unit_address;
578 __entry->phys_addr = phys_addr;
579 __entry->process_token = process_token;
580 __entry->mmio_addr = mmio_addr;
581 __entry->mmio_size = mmio_size;
582 __entry->rc = rc;
585 TP_printk("unit_address=0x%016llx phys_addr=0x%016llx "
586 "token=0x%.8lx mmio_addr=0x%lx mmio_size=0x%lx rc=%li",
587 __entry->unit_address,
588 __entry->phys_addr,
589 __entry->process_token,
590 __entry->mmio_addr,
591 __entry->mmio_size,
592 __entry->rc
596 DEFINE_EVENT(cxl_hcall, cxl_hcall_detach,
597 TP_PROTO(u64 unit_address, u64 process_token, long rc),
598 TP_ARGS(unit_address, process_token, rc)
601 DEFINE_EVENT(cxl_hcall_control, cxl_hcall_control_function,
602 TP_PROTO(u64 unit_address, char *fct, u64 p1, u64 p2, u64 p3,
603 u64 p4, unsigned long r4, long rc),
604 TP_ARGS(unit_address, fct, p1, p2, p3, p4, r4, rc)
607 DEFINE_EVENT(cxl_hcall, cxl_hcall_collect_int_info,
608 TP_PROTO(u64 unit_address, u64 process_token, long rc),
609 TP_ARGS(unit_address, process_token, rc)
612 TRACE_EVENT(cxl_hcall_control_faults,
613 TP_PROTO(u64 unit_address, u64 process_token,
614 u64 control_mask, u64 reset_mask, unsigned long r4,
615 long rc),
617 TP_ARGS(unit_address, process_token,
618 control_mask, reset_mask, r4, rc),
620 TP_STRUCT__entry(
621 __field(u64, unit_address)
622 __field(u64, process_token)
623 __field(u64, control_mask)
624 __field(u64, reset_mask)
625 __field(unsigned long, r4)
626 __field(long, rc)
629 TP_fast_assign(
630 __entry->unit_address = unit_address;
631 __entry->process_token = process_token;
632 __entry->control_mask = control_mask;
633 __entry->reset_mask = reset_mask;
634 __entry->r4 = r4;
635 __entry->rc = rc;
638 TP_printk("unit_address=0x%016llx process_token=0x%llx "
639 "control_mask=%#llx reset_mask=%#llx r4=%#lx rc=%li",
640 __entry->unit_address,
641 __entry->process_token,
642 __entry->control_mask,
643 __entry->reset_mask,
644 __entry->r4,
645 __entry->rc
649 DEFINE_EVENT(cxl_hcall_control, cxl_hcall_control_facility,
650 TP_PROTO(u64 unit_address, char *fct, u64 p1, u64 p2, u64 p3,
651 u64 p4, unsigned long r4, long rc),
652 TP_ARGS(unit_address, fct, p1, p2, p3, p4, r4, rc)
655 TRACE_EVENT(cxl_hcall_download_facility,
656 TP_PROTO(u64 unit_address, char *fct, u64 list_address, u64 num,
657 unsigned long r4, long rc),
659 TP_ARGS(unit_address, fct, list_address, num, r4, rc),
661 TP_STRUCT__entry(
662 __field(u64, unit_address)
663 __field(char *, fct)
664 __field(u64, list_address)
665 __field(u64, num)
666 __field(unsigned long, r4)
667 __field(long, rc)
670 TP_fast_assign(
671 __entry->unit_address = unit_address;
672 __entry->fct = fct;
673 __entry->list_address = list_address;
674 __entry->num = num;
675 __entry->r4 = r4;
676 __entry->rc = rc;
679 TP_printk("%#.16llx, %s(%#llx, %#llx), %#lx): %li",
680 __entry->unit_address,
681 __entry->fct,
682 __entry->list_address,
683 __entry->num,
684 __entry->r4,
685 __entry->rc
689 #endif /* _CXL_TRACE_H */
691 /* This part must be outside protection */
692 #undef TRACE_INCLUDE_PATH
693 #define TRACE_INCLUDE_PATH .
694 #define TRACE_INCLUDE_FILE trace
695 #include <trace/define_trace.h>