xref: /openbmc/linux/drivers/misc/ocxl/trace.h (revision 20e2fc42)
1 // SPDX-License-Identifier: GPL-2.0+
2 // Copyright 2017 IBM Corp.
3 #undef TRACE_SYSTEM
4 #define TRACE_SYSTEM ocxl
5 
6 #if !defined(_TRACE_OCXL_H) || defined(TRACE_HEADER_MULTI_READ)
7 #define _TRACE_OCXL_H
8 
9 #include <linux/tracepoint.h>
10 
11 DECLARE_EVENT_CLASS(ocxl_context,
12 	TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr),
13 	TP_ARGS(pid, spa, pasid, pidr, tidr),
14 
15 	TP_STRUCT__entry(
16 		__field(pid_t, pid)
17 		__field(void*, spa)
18 		__field(int, pasid)
19 		__field(u32, pidr)
20 		__field(u32, tidr)
21 	),
22 
23 	TP_fast_assign(
24 		__entry->pid = pid;
25 		__entry->spa = spa;
26 		__entry->pasid = pasid;
27 		__entry->pidr = pidr;
28 		__entry->tidr = tidr;
29 	),
30 
31 	TP_printk("linux pid=%d spa=0x%p pasid=0x%x pidr=0x%x tidr=0x%x",
32 		__entry->pid,
33 		__entry->spa,
34 		__entry->pasid,
35 		__entry->pidr,
36 		__entry->tidr
37 	)
38 );
39 
40 DEFINE_EVENT(ocxl_context, ocxl_context_add,
41 	TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr),
42 	TP_ARGS(pid, spa, pasid, pidr, tidr)
43 );
44 
45 DEFINE_EVENT(ocxl_context, ocxl_context_remove,
46 	TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr),
47 	TP_ARGS(pid, spa, pasid, pidr, tidr)
48 );
49 
50 TRACE_EVENT(ocxl_terminate_pasid,
51 	TP_PROTO(int pasid, int rc),
52 	TP_ARGS(pasid, rc),
53 
54 	TP_STRUCT__entry(
55 		__field(int, pasid)
56 		__field(int, rc)
57 	),
58 
59 	TP_fast_assign(
60 		__entry->pasid = pasid;
61 		__entry->rc = rc;
62 	),
63 
64 	TP_printk("pasid=0x%x rc=%d",
65 		__entry->pasid,
66 		__entry->rc
67 	)
68 );
69 
70 DECLARE_EVENT_CLASS(ocxl_fault_handler,
71 	TP_PROTO(void *spa, u64 pe, u64 dsisr, u64 dar, u64 tfc),
72 	TP_ARGS(spa, pe, dsisr, dar, tfc),
73 
74 	TP_STRUCT__entry(
75 		__field(void *, spa)
76 		__field(u64, pe)
77 		__field(u64, dsisr)
78 		__field(u64, dar)
79 		__field(u64, tfc)
80 	),
81 
82 	TP_fast_assign(
83 		__entry->spa = spa;
84 		__entry->pe = pe;
85 		__entry->dsisr = dsisr;
86 		__entry->dar = dar;
87 		__entry->tfc = tfc;
88 	),
89 
90 	TP_printk("spa=%p pe=0x%llx dsisr=0x%llx dar=0x%llx tfc=0x%llx",
91 		__entry->spa,
92 		__entry->pe,
93 		__entry->dsisr,
94 		__entry->dar,
95 		__entry->tfc
96 	)
97 );
98 
99 DEFINE_EVENT(ocxl_fault_handler, ocxl_fault,
100 	TP_PROTO(void *spa, u64 pe, u64 dsisr, u64 dar, u64 tfc),
101 	TP_ARGS(spa, pe, dsisr, dar, tfc)
102 );
103 
104 DEFINE_EVENT(ocxl_fault_handler, ocxl_fault_ack,
105 	TP_PROTO(void *spa, u64 pe, u64 dsisr, u64 dar, u64 tfc),
106 	TP_ARGS(spa, pe, dsisr, dar, tfc)
107 );
108 
109 TRACE_EVENT(ocxl_afu_irq_alloc,
110 	TP_PROTO(int pasid, int irq_id, unsigned int virq, int hw_irq),
111 	TP_ARGS(pasid, irq_id, virq, hw_irq),
112 
113 	TP_STRUCT__entry(
114 		__field(int, pasid)
115 		__field(int, irq_id)
116 		__field(unsigned int, virq)
117 		__field(int, hw_irq)
118 	),
119 
120 	TP_fast_assign(
121 		__entry->pasid = pasid;
122 		__entry->irq_id = irq_id;
123 		__entry->virq = virq;
124 		__entry->hw_irq = hw_irq;
125 	),
126 
127 	TP_printk("pasid=0x%x irq_id=%d virq=%u hw_irq=%d",
128 		__entry->pasid,
129 		__entry->irq_id,
130 		__entry->virq,
131 		__entry->hw_irq
132 	)
133 );
134 
135 TRACE_EVENT(ocxl_afu_irq_free,
136 	TP_PROTO(int pasid, int irq_id),
137 	TP_ARGS(pasid, irq_id),
138 
139 	TP_STRUCT__entry(
140 		__field(int, pasid)
141 		__field(int, irq_id)
142 	),
143 
144 	TP_fast_assign(
145 		__entry->pasid = pasid;
146 		__entry->irq_id = irq_id;
147 	),
148 
149 	TP_printk("pasid=0x%x irq_id=%d",
150 		__entry->pasid,
151 		__entry->irq_id
152 	)
153 );
154 
155 TRACE_EVENT(ocxl_afu_irq_receive,
156 	TP_PROTO(int virq),
157 	TP_ARGS(virq),
158 
159 	TP_STRUCT__entry(
160 		__field(int, virq)
161 	),
162 
163 	TP_fast_assign(
164 		__entry->virq = virq;
165 	),
166 
167 	TP_printk("virq=%d",
168 		__entry->virq
169 	)
170 );
171 
172 #endif /* _TRACE_OCXL_H */
173 
174 /* This part must be outside protection */
175 #undef TRACE_INCLUDE_PATH
176 #define TRACE_INCLUDE_PATH .
177 #define TRACE_INCLUDE_FILE trace
178 #include <trace/define_trace.h>
179