aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Lombard <clombard@linux.vnet.ibm.com>2016-03-04 06:26:42 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2016-03-09 07:40:01 -0500
commite7a801ad154593e9fed2e0de6820eb266db6766b (patch)
tree8f9a077dd3bf9a63b1af9ab8f0e5662f05c087fe
parent0d400f77c19e8d2606f8194846bcf18ebdc9df2a (diff)
cxl: Add tracepoints around the cxl hcall
To ease debugging, add a few tracepoints around the cxl hcalls. Co-authored-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com> Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com> Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com> Reviewed-by: Manoj Kumar <manoj@linux.vnet.ibm.com> Acked-by: Ian Munsie <imunsie@au1.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--drivers/misc/cxl/hcalls.c9
-rw-r--r--drivers/misc/cxl/trace.h193
2 files changed, 202 insertions, 0 deletions
diff --git a/drivers/misc/cxl/hcalls.c b/drivers/misc/cxl/hcalls.c
index 24131e2537c5..d6d11f4056d7 100644
--- a/drivers/misc/cxl/hcalls.c
+++ b/drivers/misc/cxl/hcalls.c
@@ -13,6 +13,7 @@
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <asm/byteorder.h> 14#include <asm/byteorder.h>
15#include "hcalls.h" 15#include "hcalls.h"
16#include "trace.h"
16 17
17#define CXL_HCALL_TIMEOUT 60000 18#define CXL_HCALL_TIMEOUT 60000
18#define CXL_HCALL_TIMEOUT_DOWNLOAD 120000 19#define CXL_HCALL_TIMEOUT_DOWNLOAD 120000
@@ -141,6 +142,7 @@ long cxl_h_attach_process(u64 unit_address,
141 CXL_H_WAIT_UNTIL_DONE(rc, retbuf, H_ATTACH_CA_PROCESS, unit_address, virt_to_phys(element)); 142 CXL_H_WAIT_UNTIL_DONE(rc, retbuf, H_ATTACH_CA_PROCESS, unit_address, virt_to_phys(element));
142 _PRINT_MSG(rc, "cxl_h_attach_process(%#.16llx, %#.16lx): %li\n", 143 _PRINT_MSG(rc, "cxl_h_attach_process(%#.16llx, %#.16lx): %li\n",
143 unit_address, virt_to_phys(element), rc); 144 unit_address, virt_to_phys(element), rc);
145 trace_cxl_hcall_attach(unit_address, virt_to_phys(element), retbuf[0], retbuf[1], retbuf[2], rc);
144 146
145 pr_devel("token: 0x%.8lx mmio_addr: 0x%lx mmio_size: 0x%lx\nProcess Element Structure:\n", 147 pr_devel("token: 0x%.8lx mmio_addr: 0x%lx mmio_size: 0x%lx\nProcess Element Structure:\n",
146 retbuf[0], retbuf[1], retbuf[2]); 148 retbuf[0], retbuf[1], retbuf[2]);
@@ -180,6 +182,7 @@ long cxl_h_detach_process(u64 unit_address, u64 process_token)
180 182
181 CXL_H_WAIT_UNTIL_DONE(rc, retbuf, H_DETACH_CA_PROCESS, unit_address, process_token); 183 CXL_H_WAIT_UNTIL_DONE(rc, retbuf, H_DETACH_CA_PROCESS, unit_address, process_token);
182 _PRINT_MSG(rc, "cxl_h_detach_process(%#.16llx, 0x%.8llx): %li\n", unit_address, process_token, rc); 184 _PRINT_MSG(rc, "cxl_h_detach_process(%#.16llx, 0x%.8llx): %li\n", unit_address, process_token, rc);
185 trace_cxl_hcall_detach(unit_address, process_token, rc);
183 186
184 switch (rc) { 187 switch (rc) {
185 case H_SUCCESS: /* The process was detached from the coherent platform function */ 188 case H_SUCCESS: /* The process was detached from the coherent platform function */
@@ -212,6 +215,7 @@ static long cxl_h_control_function(u64 unit_address, u64 op,
212 CXL_H9_WAIT_UNTIL_DONE(rc, retbuf, H_CONTROL_CA_FUNCTION, unit_address, op, p1, p2, p3, p4); 215 CXL_H9_WAIT_UNTIL_DONE(rc, retbuf, H_CONTROL_CA_FUNCTION, unit_address, op, p1, p2, p3, p4);
213 _PRINT_MSG(rc, "cxl_h_control_function(%#.16llx, %s(%#llx, %#llx, %#llx, %#llx, R4: %#lx)): %li\n", 216 _PRINT_MSG(rc, "cxl_h_control_function(%#.16llx, %s(%#llx, %#llx, %#llx, %#llx, R4: %#lx)): %li\n",
214 unit_address, OP_STR_AFU(op), p1, p2, p3, p4, retbuf[0], rc); 217 unit_address, OP_STR_AFU(op), p1, p2, p3, p4, retbuf[0], rc);
218 trace_cxl_hcall_control_function(unit_address, OP_STR_AFU(op), p1, p2, p3, p4, retbuf[0], rc);
215 219
216 switch (rc) { 220 switch (rc) {
217 case H_SUCCESS: /* The operation is completed for the coherent platform function */ 221 case H_SUCCESS: /* The operation is completed for the coherent platform function */
@@ -405,6 +409,7 @@ long cxl_h_collect_int_info(u64 unit_address, u64 process_token,
405 unit_address, process_token); 409 unit_address, process_token);
406 _PRINT_MSG(rc, "cxl_h_collect_int_info(%#.16llx, 0x%llx): %li\n", 410 _PRINT_MSG(rc, "cxl_h_collect_int_info(%#.16llx, 0x%llx): %li\n",
407 unit_address, process_token, rc); 411 unit_address, process_token, rc);
412 trace_cxl_hcall_collect_int_info(unit_address, process_token, rc);
408 413
409 switch (rc) { 414 switch (rc) {
410 case H_SUCCESS: /* The interrupt info is returned in return registers. */ 415 case H_SUCCESS: /* The interrupt info is returned in return registers. */
@@ -448,6 +453,8 @@ long cxl_h_control_faults(u64 unit_address, u64 process_token,
448 _PRINT_MSG(rc, "cxl_h_control_faults(%#.16llx, 0x%llx, %#llx, %#llx): %li (%#lx)\n", 453 _PRINT_MSG(rc, "cxl_h_control_faults(%#.16llx, 0x%llx, %#llx, %#llx): %li (%#lx)\n",
449 unit_address, process_token, control_mask, reset_mask, 454 unit_address, process_token, control_mask, reset_mask,
450 rc, retbuf[0]); 455 rc, retbuf[0]);
456 trace_cxl_hcall_control_faults(unit_address, process_token,
457 control_mask, reset_mask, retbuf[0], rc);
451 458
452 switch (rc) { 459 switch (rc) {
453 case H_SUCCESS: /* Faults were successfully controlled for the function. */ 460 case H_SUCCESS: /* Faults were successfully controlled for the function. */
@@ -481,6 +488,7 @@ static long cxl_h_control_facility(u64 unit_address, u64 op,
481 CXL_H9_WAIT_UNTIL_DONE(rc, retbuf, H_CONTROL_CA_FACILITY, unit_address, op, p1, p2, p3, p4); 488 CXL_H9_WAIT_UNTIL_DONE(rc, retbuf, H_CONTROL_CA_FACILITY, unit_address, op, p1, p2, p3, p4);
482 _PRINT_MSG(rc, "cxl_h_control_facility(%#.16llx, %s(%#llx, %#llx, %#llx, %#llx, R4: %#lx)): %li\n", 489 _PRINT_MSG(rc, "cxl_h_control_facility(%#.16llx, %s(%#llx, %#llx, %#llx, %#llx, R4: %#lx)): %li\n",
483 unit_address, OP_STR_CONTROL_ADAPTER(op), p1, p2, p3, p4, retbuf[0], rc); 490 unit_address, OP_STR_CONTROL_ADAPTER(op), p1, p2, p3, p4, retbuf[0], rc);
491 trace_cxl_hcall_control_facility(unit_address, OP_STR_CONTROL_ADAPTER(op), p1, p2, p3, p4, retbuf[0], rc);
484 492
485 switch (rc) { 493 switch (rc) {
486 case H_SUCCESS: /* The operation is completed for the coherent platform facility */ 494 case H_SUCCESS: /* The operation is completed for the coherent platform facility */
@@ -587,6 +595,7 @@ static long cxl_h_download_facility(u64 unit_address, u64 op,
587 } 595 }
588 _PRINT_MSG(rc, "cxl_h_download_facility(%#.16llx, %s(%#llx, %#llx), %#lx): %li\n", 596 _PRINT_MSG(rc, "cxl_h_download_facility(%#.16llx, %s(%#llx, %#llx), %#lx): %li\n",
589 unit_address, OP_STR_DOWNLOAD_ADAPTER(op), list_address, num, retbuf[0], rc); 597 unit_address, OP_STR_DOWNLOAD_ADAPTER(op), list_address, num, retbuf[0], rc);
598 trace_cxl_hcall_download_facility(unit_address, OP_STR_DOWNLOAD_ADAPTER(op), list_address, num, retbuf[0], rc);
590 599
591 switch (rc) { 600 switch (rc) {
592 case H_SUCCESS: /* The operation is completed for the coherent platform facility */ 601 case H_SUCCESS: /* The operation is completed for the coherent platform facility */
diff --git a/drivers/misc/cxl/trace.h b/drivers/misc/cxl/trace.h
index 6e1e2adfba8e..751d6119683e 100644
--- a/drivers/misc/cxl/trace.h
+++ b/drivers/misc/cxl/trace.h
@@ -450,6 +450,199 @@ DEFINE_EVENT(cxl_pe_class, cxl_slbia,
450 TP_ARGS(ctx) 450 TP_ARGS(ctx)
451); 451);
452 452
453TRACE_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
453#endif /* _CXL_TRACE_H */ 646#endif /* _CXL_TRACE_H */
454 647
455/* This part must be outside protection */ 648/* This part must be outside protection */