1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright 2015 IBM Corp.
7 #define TRACE_SYSTEM cxl
9 #if !defined(_CXL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
12 #include <linux/tracepoint.h>
16 #define dsisr_psl9_flags(flags) \
17 __print_flags(flags, "|", \
18 { CXL_PSL9_DSISR_An_CO_MASK, "FR" }, \
19 { CXL_PSL9_DSISR_An_TF, "TF" }, \
20 { CXL_PSL9_DSISR_An_PE, "PE" }, \
21 { CXL_PSL9_DSISR_An_AE, "AE" }, \
22 { CXL_PSL9_DSISR_An_OC, "OC" }, \
23 { CXL_PSL9_DSISR_An_S, "S" })
26 { CXL_PSL_DSISR_An_DS, "DS" }, \
27 { CXL_PSL_DSISR_An_DM, "DM" }, \
28 { CXL_PSL_DSISR_An_ST, "ST" }, \
29 { CXL_PSL_DSISR_An_UR, "UR" }, \
30 { CXL_PSL_DSISR_An_PE, "PE" }, \
31 { CXL_PSL_DSISR_An_AE, "AE" }, \
32 { CXL_PSL_DSISR_An_OC, "OC" }, \
33 { CXL_PSL_DSISR_An_M, "M" }, \
34 { CXL_PSL_DSISR_An_P, "P" }, \
35 { CXL_PSL_DSISR_An_A, "A" }, \
36 { CXL_PSL_DSISR_An_S, "S" }, \
37 { CXL_PSL_DSISR_An_K, "K" }
40 { CXL_PSL_TFC_An_A, "A" }, \
41 { CXL_PSL_TFC_An_C, "C" }, \
42 { CXL_PSL_TFC_An_AE, "AE" }, \
43 { CXL_PSL_TFC_An_R, "R" }
46 { CXL_SPA_SW_CMD_TERMINATE, "TERMINATE" }, \
47 { CXL_SPA_SW_CMD_REMOVE, "REMOVE" }, \
48 { CXL_SPA_SW_CMD_SUSPEND, "SUSPEND" }, \
49 { CXL_SPA_SW_CMD_RESUME, "RESUME" }, \
50 { CXL_SPA_SW_CMD_ADD, "ADD" }, \
51 { CXL_SPA_SW_CMD_UPDATE, "UPDATE" }
53 #define AFU_COMMANDS \
55 { CXL_AFU_Cntl_An_E, "ENABLE" }, \
56 { CXL_AFU_Cntl_An_RA, "RESET" }
58 #define PSL_COMMANDS \
59 { CXL_PSL_SCNTL_An_Pc, "PURGE" }, \
60 { CXL_PSL_SCNTL_An_Sc, "SUSPEND" }
63 DECLARE_EVENT_CLASS(cxl_pe_class
,
64 TP_PROTO(struct cxl_context
*ctx
),
75 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
76 __entry
->afu
= ctx
->afu
->slice
;
77 __entry
->pe
= ctx
->pe
;
80 TP_printk("afu%i.%i pe=%i",
88 TRACE_EVENT(cxl_attach
,
89 TP_PROTO(struct cxl_context
*ctx
, u64 wed
, s16 num_interrupts
, u64 amr
),
91 TP_ARGS(ctx
, wed
, num_interrupts
, amr
),
100 __field(s16
, num_interrupts
)
104 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
105 __entry
->afu
= ctx
->afu
->slice
;
106 __entry
->pe
= ctx
->pe
;
107 __entry
->pid
= pid_nr(ctx
->pid
);
110 __entry
->num_interrupts
= num_interrupts
;
113 TP_printk("afu%i.%i pid=%i pe=%i wed=0x%016llx irqs=%i amr=0x%llx",
119 __entry
->num_interrupts
,
124 DEFINE_EVENT(cxl_pe_class
, cxl_detach
,
125 TP_PROTO(struct cxl_context
*ctx
),
129 TRACE_EVENT(cxl_afu_irq
,
130 TP_PROTO(struct cxl_context
*ctx
, int afu_irq
, int virq
, irq_hw_number_t hwirq
),
132 TP_ARGS(ctx
, afu_irq
, virq
, hwirq
),
138 __field(u16
, afu_irq
)
140 __field(irq_hw_number_t
, hwirq
)
144 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
145 __entry
->afu
= ctx
->afu
->slice
;
146 __entry
->pe
= ctx
->pe
;
147 __entry
->afu_irq
= afu_irq
;
148 __entry
->virq
= virq
;
149 __entry
->hwirq
= hwirq
;
152 TP_printk("afu%i.%i pe=%i afu_irq=%i virq=%i hwirq=0x%lx",
162 TRACE_EVENT(cxl_psl9_irq
,
163 TP_PROTO(struct cxl_context
*ctx
, int irq
, u64 dsisr
, u64 dar
),
165 TP_ARGS(ctx
, irq
, dsisr
, dar
),
177 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
178 __entry
->afu
= ctx
->afu
->slice
;
179 __entry
->pe
= ctx
->pe
;
181 __entry
->dsisr
= dsisr
;
185 TP_printk("afu%i.%i pe=%i irq=%i dsisr=0x%016llx dsisr=%s dar=0x%016llx",
191 dsisr_psl9_flags(__entry
->dsisr
),
196 TRACE_EVENT(cxl_psl_irq
,
197 TP_PROTO(struct cxl_context
*ctx
, int irq
, u64 dsisr
, u64 dar
),
199 TP_ARGS(ctx
, irq
, dsisr
, dar
),
211 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
212 __entry
->afu
= ctx
->afu
->slice
;
213 __entry
->pe
= ctx
->pe
;
215 __entry
->dsisr
= dsisr
;
219 TP_printk("afu%i.%i pe=%i irq=%i dsisr=%s dar=0x%016llx",
224 __print_flags(__entry
->dsisr
, "|", DSISR_FLAGS
),
229 TRACE_EVENT(cxl_psl_irq_ack
,
230 TP_PROTO(struct cxl_context
*ctx
, u64 tfc
),
242 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
243 __entry
->afu
= ctx
->afu
->slice
;
244 __entry
->pe
= ctx
->pe
;
248 TP_printk("afu%i.%i pe=%i tfc=%s",
252 __print_flags(__entry
->tfc
, "|", TFC_FLAGS
)
256 TRACE_EVENT(cxl_ste_miss
,
257 TP_PROTO(struct cxl_context
*ctx
, u64 dar
),
269 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
270 __entry
->afu
= ctx
->afu
->slice
;
271 __entry
->pe
= ctx
->pe
;
275 TP_printk("afu%i.%i pe=%i dar=0x%016llx",
283 TRACE_EVENT(cxl_ste_write
,
284 TP_PROTO(struct cxl_context
*ctx
, unsigned int idx
, u64 e
, u64 v
),
286 TP_ARGS(ctx
, idx
, e
, v
),
292 __field(unsigned int, idx
)
298 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
299 __entry
->afu
= ctx
->afu
->slice
;
300 __entry
->pe
= ctx
->pe
;
306 TP_printk("afu%i.%i pe=%i SSTE[%i] E=0x%016llx V=0x%016llx",
316 TRACE_EVENT(cxl_pte_miss
,
317 TP_PROTO(struct cxl_context
*ctx
, u64 dsisr
, u64 dar
),
319 TP_ARGS(ctx
, dsisr
, dar
),
330 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
331 __entry
->afu
= ctx
->afu
->slice
;
332 __entry
->pe
= ctx
->pe
;
333 __entry
->dsisr
= dsisr
;
337 TP_printk("afu%i.%i pe=%i dsisr=%s dar=0x%016llx",
341 __print_flags(__entry
->dsisr
, "|", DSISR_FLAGS
),
346 TRACE_EVENT(cxl_llcmd
,
347 TP_PROTO(struct cxl_context
*ctx
, u64 cmd
),
359 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
360 __entry
->afu
= ctx
->afu
->slice
;
361 __entry
->pe
= ctx
->pe
;
365 TP_printk("afu%i.%i pe=%i cmd=%s",
369 __print_symbolic_u64(__entry
->cmd
, LLCMD_NAMES
)
373 TRACE_EVENT(cxl_llcmd_done
,
374 TP_PROTO(struct cxl_context
*ctx
, u64 cmd
, int rc
),
376 TP_ARGS(ctx
, cmd
, rc
),
387 __entry
->card
= ctx
->afu
->adapter
->adapter_num
;
388 __entry
->afu
= ctx
->afu
->slice
;
389 __entry
->pe
= ctx
->pe
;
394 TP_printk("afu%i.%i pe=%i cmd=%s rc=%i",
398 __print_symbolic_u64(__entry
->cmd
, LLCMD_NAMES
),
403 DECLARE_EVENT_CLASS(cxl_afu_psl_ctrl
,
404 TP_PROTO(struct cxl_afu
*afu
, u64 cmd
),
415 __entry
->card
= afu
->adapter
->adapter_num
;
416 __entry
->afu
= afu
->slice
;
420 TP_printk("afu%i.%i cmd=%s",
423 __print_symbolic_u64(__entry
->cmd
, AFU_COMMANDS
)
427 DECLARE_EVENT_CLASS(cxl_afu_psl_ctrl_done
,
428 TP_PROTO(struct cxl_afu
*afu
, u64 cmd
, int rc
),
430 TP_ARGS(afu
, cmd
, rc
),
440 __entry
->card
= afu
->adapter
->adapter_num
;
441 __entry
->afu
= afu
->slice
;
446 TP_printk("afu%i.%i cmd=%s rc=%i",
449 __print_symbolic_u64(__entry
->cmd
, AFU_COMMANDS
),
454 DEFINE_EVENT(cxl_afu_psl_ctrl
, cxl_afu_ctrl
,
455 TP_PROTO(struct cxl_afu
*afu
, u64 cmd
),
459 DEFINE_EVENT(cxl_afu_psl_ctrl_done
, cxl_afu_ctrl_done
,
460 TP_PROTO(struct cxl_afu
*afu
, u64 cmd
, int rc
),
461 TP_ARGS(afu
, cmd
, rc
)
464 DEFINE_EVENT_PRINT(cxl_afu_psl_ctrl
, cxl_psl_ctrl
,
465 TP_PROTO(struct cxl_afu
*afu
, u64 cmd
),
468 TP_printk("psl%i.%i cmd=%s",
471 __print_symbolic_u64(__entry
->cmd
, PSL_COMMANDS
)
475 DEFINE_EVENT_PRINT(cxl_afu_psl_ctrl_done
, cxl_psl_ctrl_done
,
476 TP_PROTO(struct cxl_afu
*afu
, u64 cmd
, int rc
),
477 TP_ARGS(afu
, cmd
, rc
),
479 TP_printk("psl%i.%i cmd=%s rc=%i",
482 __print_symbolic_u64(__entry
->cmd
, PSL_COMMANDS
),
487 DEFINE_EVENT(cxl_pe_class
, cxl_slbia
,
488 TP_PROTO(struct cxl_context
*ctx
),
492 TRACE_EVENT(cxl_hcall
,
493 TP_PROTO(u64 unit_address
, u64 process_token
, long rc
),
495 TP_ARGS(unit_address
, process_token
, rc
),
498 __field(u64
, unit_address
)
499 __field(u64
, process_token
)
504 __entry
->unit_address
= unit_address
;
505 __entry
->process_token
= process_token
;
509 TP_printk("unit_address=0x%016llx process_token=0x%016llx rc=%li",
510 __entry
->unit_address
,
511 __entry
->process_token
,
516 TRACE_EVENT(cxl_hcall_control
,
517 TP_PROTO(u64 unit_address
, char *fct
, u64 p1
, u64 p2
, u64 p3
,
518 u64 p4
, unsigned long r4
, long rc
),
520 TP_ARGS(unit_address
, fct
, p1
, p2
, p3
, p4
, r4
, rc
),
523 __field(u64
, unit_address
)
529 __field(unsigned long, r4
)
534 __entry
->unit_address
= unit_address
;
544 TP_printk("unit_address=%#.16llx %s(%#llx, %#llx, %#llx, %#llx, R4: %#lx)): %li",
545 __entry
->unit_address
,
556 TRACE_EVENT(cxl_hcall_attach
,
557 TP_PROTO(u64 unit_address
, u64 phys_addr
, unsigned long process_token
,
558 unsigned long mmio_addr
, unsigned long mmio_size
, long rc
),
560 TP_ARGS(unit_address
, phys_addr
, process_token
,
561 mmio_addr
, mmio_size
, rc
),
564 __field(u64
, unit_address
)
565 __field(u64
, phys_addr
)
566 __field(unsigned long, process_token
)
567 __field(unsigned long, mmio_addr
)
568 __field(unsigned long, mmio_size
)
573 __entry
->unit_address
= unit_address
;
574 __entry
->phys_addr
= phys_addr
;
575 __entry
->process_token
= process_token
;
576 __entry
->mmio_addr
= mmio_addr
;
577 __entry
->mmio_size
= mmio_size
;
581 TP_printk("unit_address=0x%016llx phys_addr=0x%016llx "
582 "token=0x%.8lx mmio_addr=0x%lx mmio_size=0x%lx rc=%li",
583 __entry
->unit_address
,
585 __entry
->process_token
,
592 DEFINE_EVENT(cxl_hcall
, cxl_hcall_detach
,
593 TP_PROTO(u64 unit_address
, u64 process_token
, long rc
),
594 TP_ARGS(unit_address
, process_token
, rc
)
597 DEFINE_EVENT(cxl_hcall_control
, cxl_hcall_control_function
,
598 TP_PROTO(u64 unit_address
, char *fct
, u64 p1
, u64 p2
, u64 p3
,
599 u64 p4
, unsigned long r4
, long rc
),
600 TP_ARGS(unit_address
, fct
, p1
, p2
, p3
, p4
, r4
, rc
)
603 DEFINE_EVENT(cxl_hcall
, cxl_hcall_collect_int_info
,
604 TP_PROTO(u64 unit_address
, u64 process_token
, long rc
),
605 TP_ARGS(unit_address
, process_token
, rc
)
608 TRACE_EVENT(cxl_hcall_control_faults
,
609 TP_PROTO(u64 unit_address
, u64 process_token
,
610 u64 control_mask
, u64 reset_mask
, unsigned long r4
,
613 TP_ARGS(unit_address
, process_token
,
614 control_mask
, reset_mask
, r4
, rc
),
617 __field(u64
, unit_address
)
618 __field(u64
, process_token
)
619 __field(u64
, control_mask
)
620 __field(u64
, reset_mask
)
621 __field(unsigned long, r4
)
626 __entry
->unit_address
= unit_address
;
627 __entry
->process_token
= process_token
;
628 __entry
->control_mask
= control_mask
;
629 __entry
->reset_mask
= reset_mask
;
634 TP_printk("unit_address=0x%016llx process_token=0x%llx "
635 "control_mask=%#llx reset_mask=%#llx r4=%#lx rc=%li",
636 __entry
->unit_address
,
637 __entry
->process_token
,
638 __entry
->control_mask
,
645 DEFINE_EVENT(cxl_hcall_control
, cxl_hcall_control_facility
,
646 TP_PROTO(u64 unit_address
, char *fct
, u64 p1
, u64 p2
, u64 p3
,
647 u64 p4
, unsigned long r4
, long rc
),
648 TP_ARGS(unit_address
, fct
, p1
, p2
, p3
, p4
, r4
, rc
)
651 TRACE_EVENT(cxl_hcall_download_facility
,
652 TP_PROTO(u64 unit_address
, char *fct
, u64 list_address
, u64 num
,
653 unsigned long r4
, long rc
),
655 TP_ARGS(unit_address
, fct
, list_address
, num
, r4
, rc
),
658 __field(u64
, unit_address
)
660 __field(u64
, list_address
)
662 __field(unsigned long, r4
)
667 __entry
->unit_address
= unit_address
;
669 __entry
->list_address
= list_address
;
675 TP_printk("%#.16llx, %s(%#llx, %#llx), %#lx): %li",
676 __entry
->unit_address
,
678 __entry
->list_address
,
685 #endif /* _CXL_TRACE_H */
687 /* This part must be outside protection */
688 #undef TRACE_INCLUDE_PATH
689 #define TRACE_INCLUDE_PATH .
690 #define TRACE_INCLUDE_FILE trace
691 #include <trace/define_trace.h>