WIP FPC-III support
[linux/fpc-iii.git] / drivers / misc / cxl / trace.h
blobc474157c6857560a7928c082f1a8ff1ee4828352
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * Copyright 2015 IBM Corp.
4 */
6 #undef TRACE_SYSTEM
7 #define TRACE_SYSTEM cxl
9 #if !defined(_CXL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
10 #define _CXL_TRACE_H
12 #include <linux/tracepoint.h>
14 #include "cxl.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" })
25 #define DSISR_FLAGS \
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" }
39 #define TFC_FLAGS \
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" }
45 #define LLCMD_NAMES \
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 \
54 { 0, "DISABLE" }, \
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),
66 TP_ARGS(ctx),
68 TP_STRUCT__entry(
69 __field(u8, card)
70 __field(u8, afu)
71 __field(u16, pe)
74 TP_fast_assign(
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",
81 __entry->card,
82 __entry->afu,
83 __entry->pe
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),
93 TP_STRUCT__entry(
94 __field(u8, card)
95 __field(u8, afu)
96 __field(u16, pe)
97 __field(pid_t, pid)
98 __field(u64, wed)
99 __field(u64, amr)
100 __field(s16, num_interrupts)
103 TP_fast_assign(
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);
108 __entry->wed = wed;
109 __entry->amr = amr;
110 __entry->num_interrupts = num_interrupts;
113 TP_printk("afu%i.%i pid=%i pe=%i wed=0x%016llx irqs=%i amr=0x%llx",
114 __entry->card,
115 __entry->afu,
116 __entry->pid,
117 __entry->pe,
118 __entry->wed,
119 __entry->num_interrupts,
120 __entry->amr
124 DEFINE_EVENT(cxl_pe_class, cxl_detach,
125 TP_PROTO(struct cxl_context *ctx),
126 TP_ARGS(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),
134 TP_STRUCT__entry(
135 __field(u8, card)
136 __field(u8, afu)
137 __field(u16, pe)
138 __field(u16, afu_irq)
139 __field(int, virq)
140 __field(irq_hw_number_t, hwirq)
143 TP_fast_assign(
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",
153 __entry->card,
154 __entry->afu,
155 __entry->pe,
156 __entry->afu_irq,
157 __entry->virq,
158 __entry->hwirq
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),
167 TP_STRUCT__entry(
168 __field(u8, card)
169 __field(u8, afu)
170 __field(u16, pe)
171 __field(int, irq)
172 __field(u64, dsisr)
173 __field(u64, dar)
176 TP_fast_assign(
177 __entry->card = ctx->afu->adapter->adapter_num;
178 __entry->afu = ctx->afu->slice;
179 __entry->pe = ctx->pe;
180 __entry->irq = irq;
181 __entry->dsisr = dsisr;
182 __entry->dar = dar;
185 TP_printk("afu%i.%i pe=%i irq=%i dsisr=0x%016llx dsisr=%s dar=0x%016llx",
186 __entry->card,
187 __entry->afu,
188 __entry->pe,
189 __entry->irq,
190 __entry->dsisr,
191 dsisr_psl9_flags(__entry->dsisr),
192 __entry->dar
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),
201 TP_STRUCT__entry(
202 __field(u8, card)
203 __field(u8, afu)
204 __field(u16, pe)
205 __field(int, irq)
206 __field(u64, dsisr)
207 __field(u64, dar)
210 TP_fast_assign(
211 __entry->card = ctx->afu->adapter->adapter_num;
212 __entry->afu = ctx->afu->slice;
213 __entry->pe = ctx->pe;
214 __entry->irq = irq;
215 __entry->dsisr = dsisr;
216 __entry->dar = dar;
219 TP_printk("afu%i.%i pe=%i irq=%i dsisr=%s dar=0x%016llx",
220 __entry->card,
221 __entry->afu,
222 __entry->pe,
223 __entry->irq,
224 __print_flags(__entry->dsisr, "|", DSISR_FLAGS),
225 __entry->dar
229 TRACE_EVENT(cxl_psl_irq_ack,
230 TP_PROTO(struct cxl_context *ctx, u64 tfc),
232 TP_ARGS(ctx, tfc),
234 TP_STRUCT__entry(
235 __field(u8, card)
236 __field(u8, afu)
237 __field(u16, pe)
238 __field(u64, tfc)
241 TP_fast_assign(
242 __entry->card = ctx->afu->adapter->adapter_num;
243 __entry->afu = ctx->afu->slice;
244 __entry->pe = ctx->pe;
245 __entry->tfc = tfc;
248 TP_printk("afu%i.%i pe=%i tfc=%s",
249 __entry->card,
250 __entry->afu,
251 __entry->pe,
252 __print_flags(__entry->tfc, "|", TFC_FLAGS)
256 TRACE_EVENT(cxl_ste_miss,
257 TP_PROTO(struct cxl_context *ctx, u64 dar),
259 TP_ARGS(ctx, dar),
261 TP_STRUCT__entry(
262 __field(u8, card)
263 __field(u8, afu)
264 __field(u16, pe)
265 __field(u64, dar)
268 TP_fast_assign(
269 __entry->card = ctx->afu->adapter->adapter_num;
270 __entry->afu = ctx->afu->slice;
271 __entry->pe = ctx->pe;
272 __entry->dar = dar;
275 TP_printk("afu%i.%i pe=%i dar=0x%016llx",
276 __entry->card,
277 __entry->afu,
278 __entry->pe,
279 __entry->dar
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),
288 TP_STRUCT__entry(
289 __field(u8, card)
290 __field(u8, afu)
291 __field(u16, pe)
292 __field(unsigned int, idx)
293 __field(u64, e)
294 __field(u64, v)
297 TP_fast_assign(
298 __entry->card = ctx->afu->adapter->adapter_num;
299 __entry->afu = ctx->afu->slice;
300 __entry->pe = ctx->pe;
301 __entry->idx = idx;
302 __entry->e = e;
303 __entry->v = v;
306 TP_printk("afu%i.%i pe=%i SSTE[%i] E=0x%016llx V=0x%016llx",
307 __entry->card,
308 __entry->afu,
309 __entry->pe,
310 __entry->idx,
311 __entry->e,
312 __entry->v
316 TRACE_EVENT(cxl_pte_miss,
317 TP_PROTO(struct cxl_context *ctx, u64 dsisr, u64 dar),
319 TP_ARGS(ctx, dsisr, dar),
321 TP_STRUCT__entry(
322 __field(u8, card)
323 __field(u8, afu)
324 __field(u16, pe)
325 __field(u64, dsisr)
326 __field(u64, dar)
329 TP_fast_assign(
330 __entry->card = ctx->afu->adapter->adapter_num;
331 __entry->afu = ctx->afu->slice;
332 __entry->pe = ctx->pe;
333 __entry->dsisr = dsisr;
334 __entry->dar = dar;
337 TP_printk("afu%i.%i pe=%i dsisr=%s dar=0x%016llx",
338 __entry->card,
339 __entry->afu,
340 __entry->pe,
341 __print_flags(__entry->dsisr, "|", DSISR_FLAGS),
342 __entry->dar
346 TRACE_EVENT(cxl_llcmd,
347 TP_PROTO(struct cxl_context *ctx, u64 cmd),
349 TP_ARGS(ctx, cmd),
351 TP_STRUCT__entry(
352 __field(u8, card)
353 __field(u8, afu)
354 __field(u16, pe)
355 __field(u64, cmd)
358 TP_fast_assign(
359 __entry->card = ctx->afu->adapter->adapter_num;
360 __entry->afu = ctx->afu->slice;
361 __entry->pe = ctx->pe;
362 __entry->cmd = cmd;
365 TP_printk("afu%i.%i pe=%i cmd=%s",
366 __entry->card,
367 __entry->afu,
368 __entry->pe,
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),
378 TP_STRUCT__entry(
379 __field(u8, card)
380 __field(u8, afu)
381 __field(u16, pe)
382 __field(u64, cmd)
383 __field(int, rc)
386 TP_fast_assign(
387 __entry->card = ctx->afu->adapter->adapter_num;
388 __entry->afu = ctx->afu->slice;
389 __entry->pe = ctx->pe;
390 __entry->rc = rc;
391 __entry->cmd = cmd;
394 TP_printk("afu%i.%i pe=%i cmd=%s rc=%i",
395 __entry->card,
396 __entry->afu,
397 __entry->pe,
398 __print_symbolic_u64(__entry->cmd, LLCMD_NAMES),
399 __entry->rc
403 DECLARE_EVENT_CLASS(cxl_afu_psl_ctrl,
404 TP_PROTO(struct cxl_afu *afu, u64 cmd),
406 TP_ARGS(afu, cmd),
408 TP_STRUCT__entry(
409 __field(u8, card)
410 __field(u8, afu)
411 __field(u64, cmd)
414 TP_fast_assign(
415 __entry->card = afu->adapter->adapter_num;
416 __entry->afu = afu->slice;
417 __entry->cmd = cmd;
420 TP_printk("afu%i.%i cmd=%s",
421 __entry->card,
422 __entry->afu,
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),
432 TP_STRUCT__entry(
433 __field(u8, card)
434 __field(u8, afu)
435 __field(u64, cmd)
436 __field(int, rc)
439 TP_fast_assign(
440 __entry->card = afu->adapter->adapter_num;
441 __entry->afu = afu->slice;
442 __entry->rc = rc;
443 __entry->cmd = cmd;
446 TP_printk("afu%i.%i cmd=%s rc=%i",
447 __entry->card,
448 __entry->afu,
449 __print_symbolic_u64(__entry->cmd, AFU_COMMANDS),
450 __entry->rc
454 DEFINE_EVENT(cxl_afu_psl_ctrl, cxl_afu_ctrl,
455 TP_PROTO(struct cxl_afu *afu, u64 cmd),
456 TP_ARGS(afu, 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),
466 TP_ARGS(afu, cmd),
468 TP_printk("psl%i.%i cmd=%s",
469 __entry->card,
470 __entry->afu,
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",
480 __entry->card,
481 __entry->afu,
482 __print_symbolic_u64(__entry->cmd, PSL_COMMANDS),
483 __entry->rc
487 DEFINE_EVENT(cxl_pe_class, cxl_slbia,
488 TP_PROTO(struct cxl_context *ctx),
489 TP_ARGS(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),
497 TP_STRUCT__entry(
498 __field(u64, unit_address)
499 __field(u64, process_token)
500 __field(long, rc)
503 TP_fast_assign(
504 __entry->unit_address = unit_address;
505 __entry->process_token = process_token;
506 __entry->rc = rc;
509 TP_printk("unit_address=0x%016llx process_token=0x%016llx rc=%li",
510 __entry->unit_address,
511 __entry->process_token,
512 __entry->rc
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),
522 TP_STRUCT__entry(
523 __field(u64, unit_address)
524 __field(char *, fct)
525 __field(u64, p1)
526 __field(u64, p2)
527 __field(u64, p3)
528 __field(u64, p4)
529 __field(unsigned long, r4)
530 __field(long, rc)
533 TP_fast_assign(
534 __entry->unit_address = unit_address;
535 __entry->fct = fct;
536 __entry->p1 = p1;
537 __entry->p2 = p2;
538 __entry->p3 = p3;
539 __entry->p4 = p4;
540 __entry->r4 = r4;
541 __entry->rc = rc;
544 TP_printk("unit_address=%#.16llx %s(%#llx, %#llx, %#llx, %#llx, R4: %#lx)): %li",
545 __entry->unit_address,
546 __entry->fct,
547 __entry->p1,
548 __entry->p2,
549 __entry->p3,
550 __entry->p4,
551 __entry->r4,
552 __entry->rc
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),
563 TP_STRUCT__entry(
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)
569 __field(long, rc)
572 TP_fast_assign(
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;
578 __entry->rc = rc;
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,
584 __entry->phys_addr,
585 __entry->process_token,
586 __entry->mmio_addr,
587 __entry->mmio_size,
588 __entry->rc
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,
611 long rc),
613 TP_ARGS(unit_address, process_token,
614 control_mask, reset_mask, r4, rc),
616 TP_STRUCT__entry(
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)
622 __field(long, rc)
625 TP_fast_assign(
626 __entry->unit_address = unit_address;
627 __entry->process_token = process_token;
628 __entry->control_mask = control_mask;
629 __entry->reset_mask = reset_mask;
630 __entry->r4 = r4;
631 __entry->rc = rc;
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,
639 __entry->reset_mask,
640 __entry->r4,
641 __entry->rc
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),
657 TP_STRUCT__entry(
658 __field(u64, unit_address)
659 __field(char *, fct)
660 __field(u64, list_address)
661 __field(u64, num)
662 __field(unsigned long, r4)
663 __field(long, rc)
666 TP_fast_assign(
667 __entry->unit_address = unit_address;
668 __entry->fct = fct;
669 __entry->list_address = list_address;
670 __entry->num = num;
671 __entry->r4 = r4;
672 __entry->rc = rc;
675 TP_printk("%#.16llx, %s(%#llx, %#llx), %#lx): %li",
676 __entry->unit_address,
677 __entry->fct,
678 __entry->list_address,
679 __entry->num,
680 __entry->r4,
681 __entry->rc
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>