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.
11 #define TRACE_SYSTEM cxl
13 #if !defined(_CXL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
16 #include <linux/tracepoint.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" })
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" }
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" }
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 \
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
),
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",
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
),
104 __field(s16
, num_interrupts
)
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
);
114 __entry
->num_interrupts
= num_interrupts
;
117 TP_printk("afu%i.%i pid=%i pe=%i wed=0x%016llx irqs=%i amr=0x%llx",
123 __entry
->num_interrupts
,
128 DEFINE_EVENT(cxl_pe_class
, cxl_detach
,
129 TP_PROTO(struct cxl_context
*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
),
142 __field(u16
, afu_irq
)
144 __field(irq_hw_number_t
, hwirq
)
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",
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
),
181 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
182 __entry
->afu
= ctx
->afu
->slice
;
183 __entry
->pe
= ctx
->pe
;
185 __entry
->dsisr
= dsisr
;
189 TP_printk("afu%i.%i pe=%i irq=%i dsisr=0x%016llx dsisr=%s dar=0x%016llx",
195 dsisr_psl9_flags(__entry
->dsisr
),
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
),
215 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
216 __entry
->afu
= ctx
->afu
->slice
;
217 __entry
->pe
= ctx
->pe
;
219 __entry
->dsisr
= dsisr
;
223 TP_printk("afu%i.%i pe=%i irq=%i dsisr=%s dar=0x%016llx",
228 __print_flags(__entry
->dsisr
, "|", DSISR_FLAGS
),
233 TRACE_EVENT(cxl_psl_irq_ack
,
234 TP_PROTO(struct cxl_context
*ctx
, u64 tfc
),
246 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
247 __entry
->afu
= ctx
->afu
->slice
;
248 __entry
->pe
= ctx
->pe
;
252 TP_printk("afu%i.%i pe=%i tfc=%s",
256 __print_flags(__entry
->tfc
, "|", TFC_FLAGS
)
260 TRACE_EVENT(cxl_ste_miss
,
261 TP_PROTO(struct cxl_context
*ctx
, u64 dar
),
273 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
274 __entry
->afu
= ctx
->afu
->slice
;
275 __entry
->pe
= ctx
->pe
;
279 TP_printk("afu%i.%i pe=%i dar=0x%016llx",
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
),
296 __field(unsigned int, idx
)
302 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
303 __entry
->afu
= ctx
->afu
->slice
;
304 __entry
->pe
= ctx
->pe
;
310 TP_printk("afu%i.%i pe=%i SSTE[%i] E=0x%016llx V=0x%016llx",
320 TRACE_EVENT(cxl_pte_miss
,
321 TP_PROTO(struct cxl_context
*ctx
, u64 dsisr
, u64 dar
),
323 TP_ARGS(ctx
, dsisr
, dar
),
334 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
335 __entry
->afu
= ctx
->afu
->slice
;
336 __entry
->pe
= ctx
->pe
;
337 __entry
->dsisr
= dsisr
;
341 TP_printk("afu%i.%i pe=%i dsisr=%s dar=0x%016llx",
345 __print_flags(__entry
->dsisr
, "|", DSISR_FLAGS
),
350 TRACE_EVENT(cxl_llcmd
,
351 TP_PROTO(struct cxl_context
*ctx
, u64 cmd
),
363 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
364 __entry
->afu
= ctx
->afu
->slice
;
365 __entry
->pe
= ctx
->pe
;
369 TP_printk("afu%i.%i pe=%i cmd=%s",
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
),
391 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
392 __entry
->afu
= ctx
->afu
->slice
;
393 __entry
->pe
= ctx
->pe
;
398 TP_printk("afu%i.%i pe=%i cmd=%s rc=%i",
402 __print_symbolic_u64(__entry
->cmd
, LLCMD_NAMES
),
407 DECLARE_EVENT_CLASS(cxl_afu_psl_ctrl
,
408 TP_PROTO(struct cxl_afu
*afu
, u64 cmd
),
419 __entry
->card
= afu
->adapter
->adapter_num
;
420 __entry
->afu
= afu
->slice
;
424 TP_printk("afu%i.%i cmd=%s",
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
),
444 __entry
->card
= afu
->adapter
->adapter_num
;
445 __entry
->afu
= afu
->slice
;
450 TP_printk("afu%i.%i cmd=%s rc=%i",
453 __print_symbolic_u64(__entry
->cmd
, AFU_COMMANDS
),
458 DEFINE_EVENT(cxl_afu_psl_ctrl
, cxl_afu_ctrl
,
459 TP_PROTO(struct cxl_afu
*afu
, u64 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
),
472 TP_printk("psl%i.%i cmd=%s",
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",
486 __print_symbolic_u64(__entry
->cmd
, PSL_COMMANDS
),
491 DEFINE_EVENT(cxl_pe_class
, cxl_slbia
,
492 TP_PROTO(struct cxl_context
*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
),
502 __field(u64
, unit_address
)
503 __field(u64
, process_token
)
508 __entry
->unit_address
= unit_address
;
509 __entry
->process_token
= process_token
;
513 TP_printk("unit_address=0x%016llx process_token=0x%016llx rc=%li",
514 __entry
->unit_address
,
515 __entry
->process_token
,
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
),
527 __field(u64
, unit_address
)
533 __field(unsigned long, r4
)
538 __entry
->unit_address
= unit_address
;
548 TP_printk("unit_address=%#.16llx %s(%#llx, %#llx, %#llx, %#llx, R4: %#lx)): %li",
549 __entry
->unit_address
,
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
),
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
)
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
;
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
,
589 __entry
->process_token
,
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
,
617 TP_ARGS(unit_address
, process_token
,
618 control_mask
, reset_mask
, r4
, rc
),
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
)
630 __entry
->unit_address
= unit_address
;
631 __entry
->process_token
= process_token
;
632 __entry
->control_mask
= control_mask
;
633 __entry
->reset_mask
= reset_mask
;
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
,
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
),
662 __field(u64
, unit_address
)
664 __field(u64
, list_address
)
666 __field(unsigned long, r4
)
671 __entry
->unit_address
= unit_address
;
673 __entry
->list_address
= list_address
;
679 TP_printk("%#.16llx, %s(%#llx, %#llx), %#lx): %li",
680 __entry
->unit_address
,
682 __entry
->list_address
,
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>