1 /* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
2 /*
3 * Copyright(c) 2015, 2016 Intel Corporation.
4 */
5 
6 #if !defined(__HFI1_TRACE_MISC_H) || defined(TRACE_HEADER_MULTI_READ)
7 #define __HFI1_TRACE_MISC_H
8 
9 #include <linux/tracepoint.h>
10 #include <linux/trace_seq.h>
11 
12 #include "hfi.h"
13 
14 #undef TRACE_SYSTEM
15 #define TRACE_SYSTEM hfi1_misc
16 
17 TRACE_EVENT(hfi1_interrupt,
18 	    TP_PROTO(struct hfi1_devdata *dd, const struct is_table *is_entry,
19 		     int src),
20 	    TP_ARGS(dd, is_entry, src),
21 	    TP_STRUCT__entry(DD_DEV_ENTRY(dd)
22 			     __array(char, buf, 64)
23 			     __field(int, src)
24 			     ),
25 	    TP_fast_assign(DD_DEV_ASSIGN(dd);
26 			   is_entry->is_name(__entry->buf, 64,
27 					     src - is_entry->start);
28 			   __entry->src = src;
29 			   ),
30 	    TP_printk("[%s] source: %s [%d]", __get_str(dev), __entry->buf,
31 		      __entry->src)
32 );
33 
34 DECLARE_EVENT_CLASS(
35 	hfi1_csr_template,
36 	TP_PROTO(void __iomem *addr, u64 value),
37 	TP_ARGS(addr, value),
38 	TP_STRUCT__entry(
39 		__field(void __iomem *, addr)
40 		__field(u64, value)
41 	),
42 	TP_fast_assign(
43 		__entry->addr = addr;
44 		__entry->value = value;
45 	),
46 	TP_printk("addr %p value %llx", __entry->addr, __entry->value)
47 );
48 
49 DEFINE_EVENT(
50 	hfi1_csr_template, hfi1_write_rcvarray,
51 	TP_PROTO(void __iomem *addr, u64 value),
52 	TP_ARGS(addr, value));
53 
54 #ifdef CONFIG_FAULT_INJECTION
55 TRACE_EVENT(hfi1_fault_opcode,
56 	    TP_PROTO(struct rvt_qp *qp, u8 opcode),
57 	    TP_ARGS(qp, opcode),
58 	    TP_STRUCT__entry(DD_DEV_ENTRY(dd_from_ibdev(qp->ibqp.device))
59 			     __field(u32, qpn)
60 			     __field(u8, opcode)
61 			     ),
62 	    TP_fast_assign(DD_DEV_ASSIGN(dd_from_ibdev(qp->ibqp.device));
63 			   __entry->qpn = qp->ibqp.qp_num;
64 			   __entry->opcode = opcode;
65 			   ),
66 	    TP_printk("[%s] qpn 0x%x opcode 0x%x",
67 		      __get_str(dev), __entry->qpn, __entry->opcode)
68 );
69 
70 TRACE_EVENT(hfi1_fault_packet,
71 	    TP_PROTO(struct hfi1_packet *packet),
72 	    TP_ARGS(packet),
73 	    TP_STRUCT__entry(DD_DEV_ENTRY(packet->rcd->ppd->dd)
74 			     __field(u64, eflags)
75 			     __field(u32, ctxt)
76 			     __field(u32, hlen)
77 			     __field(u32, tlen)
78 			     __field(u32, updegr)
79 			     __field(u32, etail)
80 			     ),
81 	     TP_fast_assign(DD_DEV_ASSIGN(packet->rcd->ppd->dd);
82 			    __entry->eflags = rhf_err_flags(packet->rhf);
83 			    __entry->ctxt = packet->rcd->ctxt;
84 			    __entry->hlen = packet->hlen;
85 			    __entry->tlen = packet->tlen;
86 			    __entry->updegr = packet->updegr;
87 			    __entry->etail = rhf_egr_index(packet->rhf);
88 			    ),
89 	     TP_printk(
90 		"[%s] ctxt %d eflags 0x%llx hlen %d tlen %d updegr %d etail %d",
91 		__get_str(dev),
92 		__entry->ctxt,
93 		__entry->eflags,
94 		__entry->hlen,
95 		__entry->tlen,
96 		__entry->updegr,
97 		__entry->etail
98 		)
99 );
100 #endif
101 
102 #endif /* __HFI1_TRACE_MISC_H */
103 
104 #undef TRACE_INCLUDE_PATH
105 #undef TRACE_INCLUDE_FILE
106 #define TRACE_INCLUDE_PATH .
107 #define TRACE_INCLUDE_FILE trace_misc
108 #include <trace/define_trace.h>
109