xref: /openbmc/linux/drivers/misc/ocxl/trace.h (revision fbb6b31a)
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 
12 TRACE_EVENT(ocxl_mmu_notifier_range,
13 	TP_PROTO(unsigned long start, unsigned long end, unsigned long pidr),
14 	TP_ARGS(start, end, pidr),
15 
16 	TP_STRUCT__entry(
17 		__field(unsigned long, start)
18 		__field(unsigned long, end)
19 		__field(unsigned long, pidr)
20 	),
21 
22 	TP_fast_assign(
23 		__entry->start = start;
24 		__entry->end = end;
25 		__entry->pidr = pidr;
26 	),
27 
28 	TP_printk("start=0x%lx end=0x%lx pidr=0x%lx",
29 		__entry->start,
30 		__entry->end,
31 		__entry->pidr
32 	)
33 );
34 
35 TRACE_EVENT(ocxl_init_mmu_notifier,
36 	TP_PROTO(int pasid, unsigned long pidr),
37 	TP_ARGS(pasid, pidr),
38 
39 	TP_STRUCT__entry(
40 		__field(int, pasid)
41 		__field(unsigned long, pidr)
42 	),
43 
44 	TP_fast_assign(
45 		__entry->pasid = pasid;
46 		__entry->pidr = pidr;
47 	),
48 
49 	TP_printk("pasid=%d, pidr=0x%lx",
50 		__entry->pasid,
51 		__entry->pidr
52 	)
53 );
54 
55 TRACE_EVENT(ocxl_release_mmu_notifier,
56 	TP_PROTO(int pasid, unsigned long pidr),
57 	TP_ARGS(pasid, pidr),
58 
59 	TP_STRUCT__entry(
60 		__field(int, pasid)
61 		__field(unsigned long, pidr)
62 	),
63 
64 	TP_fast_assign(
65 		__entry->pasid = pasid;
66 		__entry->pidr = pidr;
67 	),
68 
69 	TP_printk("pasid=%d, pidr=0x%lx",
70 		__entry->pasid,
71 		__entry->pidr
72 	)
73 );
74 
75 DECLARE_EVENT_CLASS(ocxl_context,
76 	TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr),
77 	TP_ARGS(pid, spa, pasid, pidr, tidr),
78 
79 	TP_STRUCT__entry(
80 		__field(pid_t, pid)
81 		__field(void*, spa)
82 		__field(int, pasid)
83 		__field(u32, pidr)
84 		__field(u32, tidr)
85 	),
86 
87 	TP_fast_assign(
88 		__entry->pid = pid;
89 		__entry->spa = spa;
90 		__entry->pasid = pasid;
91 		__entry->pidr = pidr;
92 		__entry->tidr = tidr;
93 	),
94 
95 	TP_printk("linux pid=%d spa=0x%p pasid=0x%x pidr=0x%x tidr=0x%x",
96 		__entry->pid,
97 		__entry->spa,
98 		__entry->pasid,
99 		__entry->pidr,
100 		__entry->tidr
101 	)
102 );
103 
104 DEFINE_EVENT(ocxl_context, ocxl_context_add,
105 	TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr),
106 	TP_ARGS(pid, spa, pasid, pidr, tidr)
107 );
108 
109 DEFINE_EVENT(ocxl_context, ocxl_context_remove,
110 	TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr),
111 	TP_ARGS(pid, spa, pasid, pidr, tidr)
112 );
113 
114 TRACE_EVENT(ocxl_terminate_pasid,
115 	TP_PROTO(int pasid, int rc),
116 	TP_ARGS(pasid, rc),
117 
118 	TP_STRUCT__entry(
119 		__field(int, pasid)
120 		__field(int, rc)
121 	),
122 
123 	TP_fast_assign(
124 		__entry->pasid = pasid;
125 		__entry->rc = rc;
126 	),
127 
128 	TP_printk("pasid=0x%x rc=%d",
129 		__entry->pasid,
130 		__entry->rc
131 	)
132 );
133 
134 DECLARE_EVENT_CLASS(ocxl_fault_handler,
135 	TP_PROTO(void *spa, u64 pe, u64 dsisr, u64 dar, u64 tfc),
136 	TP_ARGS(spa, pe, dsisr, dar, tfc),
137 
138 	TP_STRUCT__entry(
139 		__field(void *, spa)
140 		__field(u64, pe)
141 		__field(u64, dsisr)
142 		__field(u64, dar)
143 		__field(u64, tfc)
144 	),
145 
146 	TP_fast_assign(
147 		__entry->spa = spa;
148 		__entry->pe = pe;
149 		__entry->dsisr = dsisr;
150 		__entry->dar = dar;
151 		__entry->tfc = tfc;
152 	),
153 
154 	TP_printk("spa=%p pe=0x%llx dsisr=0x%llx dar=0x%llx tfc=0x%llx",
155 		__entry->spa,
156 		__entry->pe,
157 		__entry->dsisr,
158 		__entry->dar,
159 		__entry->tfc
160 	)
161 );
162 
163 DEFINE_EVENT(ocxl_fault_handler, ocxl_fault,
164 	TP_PROTO(void *spa, u64 pe, u64 dsisr, u64 dar, u64 tfc),
165 	TP_ARGS(spa, pe, dsisr, dar, tfc)
166 );
167 
168 DEFINE_EVENT(ocxl_fault_handler, ocxl_fault_ack,
169 	TP_PROTO(void *spa, u64 pe, u64 dsisr, u64 dar, u64 tfc),
170 	TP_ARGS(spa, pe, dsisr, dar, tfc)
171 );
172 
173 TRACE_EVENT(ocxl_afu_irq_alloc,
174 	TP_PROTO(int pasid, int irq_id, unsigned int virq, int hw_irq),
175 	TP_ARGS(pasid, irq_id, virq, hw_irq),
176 
177 	TP_STRUCT__entry(
178 		__field(int, pasid)
179 		__field(int, irq_id)
180 		__field(unsigned int, virq)
181 		__field(int, hw_irq)
182 	),
183 
184 	TP_fast_assign(
185 		__entry->pasid = pasid;
186 		__entry->irq_id = irq_id;
187 		__entry->virq = virq;
188 		__entry->hw_irq = hw_irq;
189 	),
190 
191 	TP_printk("pasid=0x%x irq_id=%d virq=%u hw_irq=%d",
192 		__entry->pasid,
193 		__entry->irq_id,
194 		__entry->virq,
195 		__entry->hw_irq
196 	)
197 );
198 
199 TRACE_EVENT(ocxl_afu_irq_free,
200 	TP_PROTO(int pasid, int irq_id),
201 	TP_ARGS(pasid, irq_id),
202 
203 	TP_STRUCT__entry(
204 		__field(int, pasid)
205 		__field(int, irq_id)
206 	),
207 
208 	TP_fast_assign(
209 		__entry->pasid = pasid;
210 		__entry->irq_id = irq_id;
211 	),
212 
213 	TP_printk("pasid=0x%x irq_id=%d",
214 		__entry->pasid,
215 		__entry->irq_id
216 	)
217 );
218 
219 TRACE_EVENT(ocxl_afu_irq_receive,
220 	TP_PROTO(int virq),
221 	TP_ARGS(virq),
222 
223 	TP_STRUCT__entry(
224 		__field(int, virq)
225 	),
226 
227 	TP_fast_assign(
228 		__entry->virq = virq;
229 	),
230 
231 	TP_printk("virq=%d",
232 		__entry->virq
233 	)
234 );
235 
236 #endif /* _TRACE_OCXL_H */
237 
238 /* This part must be outside protection */
239 #undef TRACE_INCLUDE_PATH
240 #define TRACE_INCLUDE_PATH .
241 #define TRACE_INCLUDE_FILE trace
242 #include <trace/define_trace.h>
243