blob: 751d6119683e69e0fbd7cb88d0add912cbc2f22a [file] [log] [blame]
Ian Munsie9bcf28c2015-01-09 20:34:36 +11001/*
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
10#undef TRACE_SYSTEM
11#define TRACE_SYSTEM cxl
12
13#if !defined(_CXL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
14#define _CXL_TRACE_H
15
16#include <linux/tracepoint.h>
17
18#include "cxl.h"
19
20#define DSISR_FLAGS \
21 { CXL_PSL_DSISR_An_DS, "DS" }, \
22 { CXL_PSL_DSISR_An_DM, "DM" }, \
23 { CXL_PSL_DSISR_An_ST, "ST" }, \
24 { CXL_PSL_DSISR_An_UR, "UR" }, \
25 { CXL_PSL_DSISR_An_PE, "PE" }, \
26 { CXL_PSL_DSISR_An_AE, "AE" }, \
27 { CXL_PSL_DSISR_An_OC, "OC" }, \
28 { CXL_PSL_DSISR_An_M, "M" }, \
29 { CXL_PSL_DSISR_An_P, "P" }, \
30 { CXL_PSL_DSISR_An_A, "A" }, \
31 { CXL_PSL_DSISR_An_S, "S" }, \
32 { CXL_PSL_DSISR_An_K, "K" }
33
34#define TFC_FLAGS \
35 { CXL_PSL_TFC_An_A, "A" }, \
36 { CXL_PSL_TFC_An_C, "C" }, \
37 { CXL_PSL_TFC_An_AE, "AE" }, \
38 { CXL_PSL_TFC_An_R, "R" }
39
40#define LLCMD_NAMES \
41 { CXL_SPA_SW_CMD_TERMINATE, "TERMINATE" }, \
42 { CXL_SPA_SW_CMD_REMOVE, "REMOVE" }, \
43 { CXL_SPA_SW_CMD_SUSPEND, "SUSPEND" }, \
44 { CXL_SPA_SW_CMD_RESUME, "RESUME" }, \
45 { CXL_SPA_SW_CMD_ADD, "ADD" }, \
46 { CXL_SPA_SW_CMD_UPDATE, "UPDATE" }
47
48#define AFU_COMMANDS \
49 { 0, "DISABLE" }, \
50 { CXL_AFU_Cntl_An_E, "ENABLE" }, \
51 { CXL_AFU_Cntl_An_RA, "RESET" }
52
53#define PSL_COMMANDS \
54 { CXL_PSL_SCNTL_An_Pc, "PURGE" }, \
55 { CXL_PSL_SCNTL_An_Sc, "SUSPEND" }
56
57
58DECLARE_EVENT_CLASS(cxl_pe_class,
59 TP_PROTO(struct cxl_context *ctx),
60
61 TP_ARGS(ctx),
62
63 TP_STRUCT__entry(
64 __field(u8, card)
65 __field(u8, afu)
66 __field(u16, pe)
67 ),
68
69 TP_fast_assign(
70 __entry->card = ctx->afu->adapter->adapter_num;
71 __entry->afu = ctx->afu->slice;
72 __entry->pe = ctx->pe;
73 ),
74
75 TP_printk("afu%i.%i pe=%i",
76 __entry->card,
77 __entry->afu,
78 __entry->pe
79 )
80);
81
82
83TRACE_EVENT(cxl_attach,
84 TP_PROTO(struct cxl_context *ctx, u64 wed, s16 num_interrupts, u64 amr),
85
86 TP_ARGS(ctx, wed, num_interrupts, amr),
87
88 TP_STRUCT__entry(
89 __field(u8, card)
90 __field(u8, afu)
91 __field(u16, pe)
92 __field(pid_t, pid)
93 __field(u64, wed)
94 __field(u64, amr)
95 __field(s16, num_interrupts)
96 ),
97
98 TP_fast_assign(
99 __entry->card = ctx->afu->adapter->adapter_num;
100 __entry->afu = ctx->afu->slice;
101 __entry->pe = ctx->pe;
102 __entry->pid = pid_nr(ctx->pid);
103 __entry->wed = wed;
104 __entry->amr = amr;
105 __entry->num_interrupts = num_interrupts;
106 ),
107
Rasmus Villemoesde369532015-06-11 13:27:52 +0200108 TP_printk("afu%i.%i pid=%i pe=%i wed=0x%016llx irqs=%i amr=0x%llx",
Ian Munsie9bcf28c2015-01-09 20:34:36 +1100109 __entry->card,
110 __entry->afu,
111 __entry->pid,
112 __entry->pe,
113 __entry->wed,
114 __entry->num_interrupts,
115 __entry->amr
116 )
117);
118
119DEFINE_EVENT(cxl_pe_class, cxl_detach,
120 TP_PROTO(struct cxl_context *ctx),
121 TP_ARGS(ctx)
122);
123
124TRACE_EVENT(cxl_afu_irq,
125 TP_PROTO(struct cxl_context *ctx, int afu_irq, int virq, irq_hw_number_t hwirq),
126
127 TP_ARGS(ctx, afu_irq, virq, hwirq),
128
129 TP_STRUCT__entry(
130 __field(u8, card)
131 __field(u8, afu)
132 __field(u16, pe)
133 __field(u16, afu_irq)
134 __field(int, virq)
135 __field(irq_hw_number_t, hwirq)
136 ),
137
138 TP_fast_assign(
139 __entry->card = ctx->afu->adapter->adapter_num;
140 __entry->afu = ctx->afu->slice;
141 __entry->pe = ctx->pe;
142 __entry->afu_irq = afu_irq;
143 __entry->virq = virq;
144 __entry->hwirq = hwirq;
145 ),
146
147 TP_printk("afu%i.%i pe=%i afu_irq=%i virq=%i hwirq=0x%lx",
148 __entry->card,
149 __entry->afu,
150 __entry->pe,
151 __entry->afu_irq,
152 __entry->virq,
153 __entry->hwirq
154 )
155);
156
157TRACE_EVENT(cxl_psl_irq,
158 TP_PROTO(struct cxl_context *ctx, int irq, u64 dsisr, u64 dar),
159
160 TP_ARGS(ctx, irq, dsisr, dar),
161
162 TP_STRUCT__entry(
163 __field(u8, card)
164 __field(u8, afu)
165 __field(u16, pe)
166 __field(int, irq)
167 __field(u64, dsisr)
168 __field(u64, dar)
169 ),
170
171 TP_fast_assign(
172 __entry->card = ctx->afu->adapter->adapter_num;
173 __entry->afu = ctx->afu->slice;
174 __entry->pe = ctx->pe;
175 __entry->irq = irq;
176 __entry->dsisr = dsisr;
177 __entry->dar = dar;
178 ),
179
Rasmus Villemoesde369532015-06-11 13:27:52 +0200180 TP_printk("afu%i.%i pe=%i irq=%i dsisr=%s dar=0x%016llx",
Ian Munsie9bcf28c2015-01-09 20:34:36 +1100181 __entry->card,
182 __entry->afu,
183 __entry->pe,
184 __entry->irq,
185 __print_flags(__entry->dsisr, "|", DSISR_FLAGS),
186 __entry->dar
187 )
188);
189
190TRACE_EVENT(cxl_psl_irq_ack,
191 TP_PROTO(struct cxl_context *ctx, u64 tfc),
192
193 TP_ARGS(ctx, tfc),
194
195 TP_STRUCT__entry(
196 __field(u8, card)
197 __field(u8, afu)
198 __field(u16, pe)
199 __field(u64, tfc)
200 ),
201
202 TP_fast_assign(
203 __entry->card = ctx->afu->adapter->adapter_num;
204 __entry->afu = ctx->afu->slice;
205 __entry->pe = ctx->pe;
206 __entry->tfc = tfc;
207 ),
208
209 TP_printk("afu%i.%i pe=%i tfc=%s",
210 __entry->card,
211 __entry->afu,
212 __entry->pe,
213 __print_flags(__entry->tfc, "|", TFC_FLAGS)
214 )
215);
216
217TRACE_EVENT(cxl_ste_miss,
218 TP_PROTO(struct cxl_context *ctx, u64 dar),
219
220 TP_ARGS(ctx, dar),
221
222 TP_STRUCT__entry(
223 __field(u8, card)
224 __field(u8, afu)
225 __field(u16, pe)
226 __field(u64, dar)
227 ),
228
229 TP_fast_assign(
230 __entry->card = ctx->afu->adapter->adapter_num;
231 __entry->afu = ctx->afu->slice;
232 __entry->pe = ctx->pe;
233 __entry->dar = dar;
234 ),
235
Rasmus Villemoesde369532015-06-11 13:27:52 +0200236 TP_printk("afu%i.%i pe=%i dar=0x%016llx",
Ian Munsie9bcf28c2015-01-09 20:34:36 +1100237 __entry->card,
238 __entry->afu,
239 __entry->pe,
240 __entry->dar
241 )
242);
243
244TRACE_EVENT(cxl_ste_write,
245 TP_PROTO(struct cxl_context *ctx, unsigned int idx, u64 e, u64 v),
246
247 TP_ARGS(ctx, idx, e, v),
248
249 TP_STRUCT__entry(
250 __field(u8, card)
251 __field(u8, afu)
252 __field(u16, pe)
253 __field(unsigned int, idx)
254 __field(u64, e)
255 __field(u64, v)
256 ),
257
258 TP_fast_assign(
259 __entry->card = ctx->afu->adapter->adapter_num;
260 __entry->afu = ctx->afu->slice;
261 __entry->pe = ctx->pe;
262 __entry->idx = idx;
263 __entry->e = e;
264 __entry->v = v;
265 ),
266
Rasmus Villemoesde369532015-06-11 13:27:52 +0200267 TP_printk("afu%i.%i pe=%i SSTE[%i] E=0x%016llx V=0x%016llx",
Ian Munsie9bcf28c2015-01-09 20:34:36 +1100268 __entry->card,
269 __entry->afu,
270 __entry->pe,
271 __entry->idx,
272 __entry->e,
273 __entry->v
274 )
275);
276
277TRACE_EVENT(cxl_pte_miss,
278 TP_PROTO(struct cxl_context *ctx, u64 dsisr, u64 dar),
279
280 TP_ARGS(ctx, dsisr, dar),
281
282 TP_STRUCT__entry(
283 __field(u8, card)
284 __field(u8, afu)
285 __field(u16, pe)
286 __field(u64, dsisr)
287 __field(u64, dar)
288 ),
289
290 TP_fast_assign(
291 __entry->card = ctx->afu->adapter->adapter_num;
292 __entry->afu = ctx->afu->slice;
293 __entry->pe = ctx->pe;
294 __entry->dsisr = dsisr;
295 __entry->dar = dar;
296 ),
297
Rasmus Villemoesde369532015-06-11 13:27:52 +0200298 TP_printk("afu%i.%i pe=%i dsisr=%s dar=0x%016llx",
Ian Munsie9bcf28c2015-01-09 20:34:36 +1100299 __entry->card,
300 __entry->afu,
301 __entry->pe,
302 __print_flags(__entry->dsisr, "|", DSISR_FLAGS),
303 __entry->dar
304 )
305);
306
307TRACE_EVENT(cxl_llcmd,
308 TP_PROTO(struct cxl_context *ctx, u64 cmd),
309
310 TP_ARGS(ctx, cmd),
311
312 TP_STRUCT__entry(
313 __field(u8, card)
314 __field(u8, afu)
315 __field(u16, pe)
316 __field(u64, cmd)
317 ),
318
319 TP_fast_assign(
320 __entry->card = ctx->afu->adapter->adapter_num;
321 __entry->afu = ctx->afu->slice;
322 __entry->pe = ctx->pe;
323 __entry->cmd = cmd;
324 ),
325
326 TP_printk("afu%i.%i pe=%i cmd=%s",
327 __entry->card,
328 __entry->afu,
329 __entry->pe,
330 __print_symbolic_u64(__entry->cmd, LLCMD_NAMES)
331 )
332);
333
334TRACE_EVENT(cxl_llcmd_done,
335 TP_PROTO(struct cxl_context *ctx, u64 cmd, int rc),
336
337 TP_ARGS(ctx, cmd, rc),
338
339 TP_STRUCT__entry(
340 __field(u8, card)
341 __field(u8, afu)
342 __field(u16, pe)
343 __field(u64, cmd)
344 __field(int, rc)
345 ),
346
347 TP_fast_assign(
348 __entry->card = ctx->afu->adapter->adapter_num;
349 __entry->afu = ctx->afu->slice;
350 __entry->pe = ctx->pe;
351 __entry->rc = rc;
352 __entry->cmd = cmd;
353 ),
354
355 TP_printk("afu%i.%i pe=%i cmd=%s rc=%i",
356 __entry->card,
357 __entry->afu,
358 __entry->pe,
359 __print_symbolic_u64(__entry->cmd, LLCMD_NAMES),
360 __entry->rc
361 )
362);
363
364DECLARE_EVENT_CLASS(cxl_afu_psl_ctrl,
365 TP_PROTO(struct cxl_afu *afu, u64 cmd),
366
367 TP_ARGS(afu, cmd),
368
369 TP_STRUCT__entry(
370 __field(u8, card)
371 __field(u8, afu)
372 __field(u64, cmd)
373 ),
374
375 TP_fast_assign(
376 __entry->card = afu->adapter->adapter_num;
377 __entry->afu = afu->slice;
378 __entry->cmd = cmd;
379 ),
380
381 TP_printk("afu%i.%i cmd=%s",
382 __entry->card,
383 __entry->afu,
384 __print_symbolic_u64(__entry->cmd, AFU_COMMANDS)
385 )
386);
387
388DECLARE_EVENT_CLASS(cxl_afu_psl_ctrl_done,
389 TP_PROTO(struct cxl_afu *afu, u64 cmd, int rc),
390
391 TP_ARGS(afu, cmd, rc),
392
393 TP_STRUCT__entry(
394 __field(u8, card)
395 __field(u8, afu)
396 __field(u64, cmd)
397 __field(int, rc)
398 ),
399
400 TP_fast_assign(
401 __entry->card = afu->adapter->adapter_num;
402 __entry->afu = afu->slice;
403 __entry->rc = rc;
404 __entry->cmd = cmd;
405 ),
406
407 TP_printk("afu%i.%i cmd=%s rc=%i",
408 __entry->card,
409 __entry->afu,
410 __print_symbolic_u64(__entry->cmd, AFU_COMMANDS),
411 __entry->rc
412 )
413);
414
415DEFINE_EVENT(cxl_afu_psl_ctrl, cxl_afu_ctrl,
416 TP_PROTO(struct cxl_afu *afu, u64 cmd),
417 TP_ARGS(afu, cmd)
418);
419
420DEFINE_EVENT(cxl_afu_psl_ctrl_done, cxl_afu_ctrl_done,
421 TP_PROTO(struct cxl_afu *afu, u64 cmd, int rc),
422 TP_ARGS(afu, cmd, rc)
423);
424
425DEFINE_EVENT_PRINT(cxl_afu_psl_ctrl, cxl_psl_ctrl,
426 TP_PROTO(struct cxl_afu *afu, u64 cmd),
427 TP_ARGS(afu, cmd),
428
429 TP_printk("psl%i.%i cmd=%s",
430 __entry->card,
431 __entry->afu,
432 __print_symbolic_u64(__entry->cmd, PSL_COMMANDS)
433 )
434);
435
436DEFINE_EVENT_PRINT(cxl_afu_psl_ctrl_done, cxl_psl_ctrl_done,
437 TP_PROTO(struct cxl_afu *afu, u64 cmd, int rc),
438 TP_ARGS(afu, cmd, rc),
439
440 TP_printk("psl%i.%i cmd=%s rc=%i",
441 __entry->card,
442 __entry->afu,
443 __print_symbolic_u64(__entry->cmd, PSL_COMMANDS),
444 __entry->rc
445 )
446);
447
448DEFINE_EVENT(cxl_pe_class, cxl_slbia,
449 TP_PROTO(struct cxl_context *ctx),
450 TP_ARGS(ctx)
451);
452
Christophe Lombarde7a801a2016-03-04 12:26:42 +0100453TRACE_EVENT(cxl_hcall,
454 TP_PROTO(u64 unit_address, u64 process_token, long rc),
455
456 TP_ARGS(unit_address, process_token, rc),
457
458 TP_STRUCT__entry(
459 __field(u64, unit_address)
460 __field(u64, process_token)
461 __field(long, rc)
462 ),
463
464 TP_fast_assign(
465 __entry->unit_address = unit_address;
466 __entry->process_token = process_token;
467 __entry->rc = rc;
468 ),
469
470 TP_printk("unit_address=0x%016llx process_token=0x%016llx rc=%li",
471 __entry->unit_address,
472 __entry->process_token,
473 __entry->rc
474 )
475);
476
477TRACE_EVENT(cxl_hcall_control,
478 TP_PROTO(u64 unit_address, char *fct, u64 p1, u64 p2, u64 p3,
479 u64 p4, unsigned long r4, long rc),
480
481 TP_ARGS(unit_address, fct, p1, p2, p3, p4, r4, rc),
482
483 TP_STRUCT__entry(
484 __field(u64, unit_address)
485 __field(char *, fct)
486 __field(u64, p1)
487 __field(u64, p2)
488 __field(u64, p3)
489 __field(u64, p4)
490 __field(unsigned long, r4)
491 __field(long, rc)
492 ),
493
494 TP_fast_assign(
495 __entry->unit_address = unit_address;
496 __entry->fct = fct;
497 __entry->p1 = p1;
498 __entry->p2 = p2;
499 __entry->p3 = p3;
500 __entry->p4 = p4;
501 __entry->r4 = r4;
502 __entry->rc = rc;
503 ),
504
505 TP_printk("unit_address=%#.16llx %s(%#llx, %#llx, %#llx, %#llx, R4: %#lx)): %li",
506 __entry->unit_address,
507 __entry->fct,
508 __entry->p1,
509 __entry->p2,
510 __entry->p3,
511 __entry->p4,
512 __entry->r4,
513 __entry->rc
514 )
515);
516
517TRACE_EVENT(cxl_hcall_attach,
518 TP_PROTO(u64 unit_address, u64 phys_addr, unsigned long process_token,
519 unsigned long mmio_addr, unsigned long mmio_size, long rc),
520
521 TP_ARGS(unit_address, phys_addr, process_token,
522 mmio_addr, mmio_size, rc),
523
524 TP_STRUCT__entry(
525 __field(u64, unit_address)
526 __field(u64, phys_addr)
527 __field(unsigned long, process_token)
528 __field(unsigned long, mmio_addr)
529 __field(unsigned long, mmio_size)
530 __field(long, rc)
531 ),
532
533 TP_fast_assign(
534 __entry->unit_address = unit_address;
535 __entry->phys_addr = phys_addr;
536 __entry->process_token = process_token;
537 __entry->mmio_addr = mmio_addr;
538 __entry->mmio_size = mmio_size;
539 __entry->rc = rc;
540 ),
541
542 TP_printk("unit_address=0x%016llx phys_addr=0x%016llx "
543 "token=0x%.8lx mmio_addr=0x%lx mmio_size=0x%lx rc=%li",
544 __entry->unit_address,
545 __entry->phys_addr,
546 __entry->process_token,
547 __entry->mmio_addr,
548 __entry->mmio_size,
549 __entry->rc
550 )
551);
552
553DEFINE_EVENT(cxl_hcall, cxl_hcall_detach,
554 TP_PROTO(u64 unit_address, u64 process_token, long rc),
555 TP_ARGS(unit_address, process_token, rc)
556);
557
558DEFINE_EVENT(cxl_hcall_control, cxl_hcall_control_function,
559 TP_PROTO(u64 unit_address, char *fct, u64 p1, u64 p2, u64 p3,
560 u64 p4, unsigned long r4, long rc),
561 TP_ARGS(unit_address, fct, p1, p2, p3, p4, r4, rc)
562);
563
564DEFINE_EVENT(cxl_hcall, cxl_hcall_collect_int_info,
565 TP_PROTO(u64 unit_address, u64 process_token, long rc),
566 TP_ARGS(unit_address, process_token, rc)
567);
568
569TRACE_EVENT(cxl_hcall_control_faults,
570 TP_PROTO(u64 unit_address, u64 process_token,
571 u64 control_mask, u64 reset_mask, unsigned long r4,
572 long rc),
573
574 TP_ARGS(unit_address, process_token,
575 control_mask, reset_mask, r4, rc),
576
577 TP_STRUCT__entry(
578 __field(u64, unit_address)
579 __field(u64, process_token)
580 __field(u64, control_mask)
581 __field(u64, reset_mask)
582 __field(unsigned long, r4)
583 __field(long, rc)
584 ),
585
586 TP_fast_assign(
587 __entry->unit_address = unit_address;
588 __entry->process_token = process_token;
589 __entry->control_mask = control_mask;
590 __entry->reset_mask = reset_mask;
591 __entry->r4 = r4;
592 __entry->rc = rc;
593 ),
594
595 TP_printk("unit_address=0x%016llx process_token=0x%llx "
596 "control_mask=%#llx reset_mask=%#llx r4=%#lx rc=%li",
597 __entry->unit_address,
598 __entry->process_token,
599 __entry->control_mask,
600 __entry->reset_mask,
601 __entry->r4,
602 __entry->rc
603 )
604);
605
606DEFINE_EVENT(cxl_hcall_control, cxl_hcall_control_facility,
607 TP_PROTO(u64 unit_address, char *fct, u64 p1, u64 p2, u64 p3,
608 u64 p4, unsigned long r4, long rc),
609 TP_ARGS(unit_address, fct, p1, p2, p3, p4, r4, rc)
610);
611
612TRACE_EVENT(cxl_hcall_download_facility,
613 TP_PROTO(u64 unit_address, char *fct, u64 list_address, u64 num,
614 unsigned long r4, long rc),
615
616 TP_ARGS(unit_address, fct, list_address, num, r4, rc),
617
618 TP_STRUCT__entry(
619 __field(u64, unit_address)
620 __field(char *, fct)
621 __field(u64, list_address)
622 __field(u64, num)
623 __field(unsigned long, r4)
624 __field(long, rc)
625 ),
626
627 TP_fast_assign(
628 __entry->unit_address = unit_address;
629 __entry->fct = fct;
630 __entry->list_address = list_address;
631 __entry->num = num;
632 __entry->r4 = r4;
633 __entry->rc = rc;
634 ),
635
636 TP_printk("%#.16llx, %s(%#llx, %#llx), %#lx): %li",
637 __entry->unit_address,
638 __entry->fct,
639 __entry->list_address,
640 __entry->num,
641 __entry->r4,
642 __entry->rc
643 )
644);
645
Ian Munsie9bcf28c2015-01-09 20:34:36 +1100646#endif /* _CXL_TRACE_H */
647
648/* This part must be outside protection */
649#undef TRACE_INCLUDE_PATH
650#define TRACE_INCLUDE_PATH .
651#define TRACE_INCLUDE_FILE trace
652#include <trace/define_trace.h>