xref: /openbmc/linux/drivers/hv/hv_trace.h (revision 5b448065)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 #undef TRACE_SYSTEM
4 #define TRACE_SYSTEM hyperv
5 
6 #if !defined(_HV_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
7 #define _HV_TRACE_H
8 
9 #include <linux/tracepoint.h>
10 
11 DECLARE_EVENT_CLASS(vmbus_hdr_msg,
12 	TP_PROTO(const struct vmbus_channel_message_header *hdr),
13 	TP_ARGS(hdr),
14 	TP_STRUCT__entry(__field(unsigned int, msgtype)),
15 	TP_fast_assign(__entry->msgtype = hdr->msgtype;),
16 	TP_printk("msgtype=%u", __entry->msgtype)
17 );
18 
19 DEFINE_EVENT(vmbus_hdr_msg, vmbus_on_msg_dpc,
20 	TP_PROTO(const struct vmbus_channel_message_header *hdr),
21 	TP_ARGS(hdr)
22 );
23 
24 DEFINE_EVENT(vmbus_hdr_msg, vmbus_on_message,
25 	TP_PROTO(const struct vmbus_channel_message_header *hdr),
26 	TP_ARGS(hdr)
27 );
28 
29 TRACE_EVENT(vmbus_onoffer,
30 	    TP_PROTO(const struct vmbus_channel_offer_channel *offer),
31 	    TP_ARGS(offer),
32 	    TP_STRUCT__entry(
33 		    __field(u32, child_relid)
34 		    __field(u8, monitorid)
35 		    __field(u16, is_ddc_int)
36 		    __field(u32, connection_id)
37 		    __array(char, if_type, 16)
38 		    __array(char, if_instance, 16)
39 		    __field(u16, chn_flags)
40 		    __field(u16, mmio_mb)
41 		    __field(u16, sub_idx)
42 		    ),
43 	    TP_fast_assign(__entry->child_relid = offer->child_relid;
44 			   __entry->monitorid = offer->monitorid;
45 			   __entry->is_ddc_int = offer->is_dedicated_interrupt;
46 			   __entry->connection_id = offer->connection_id;
47 			   export_guid(__entry->if_type, &offer->offer.if_type);
48 			   export_guid(__entry->if_instance, &offer->offer.if_instance);
49 			   __entry->chn_flags = offer->offer.chn_flags;
50 			   __entry->mmio_mb = offer->offer.mmio_megabytes;
51 			   __entry->sub_idx = offer->offer.sub_channel_index;
52 		    ),
53 	    TP_printk("child_relid 0x%x, monitorid 0x%x, is_dedicated %d, "
54 		      "connection_id 0x%x, if_type %pUl, if_instance %pUl, "
55 		      "chn_flags 0x%x, mmio_megabytes %d, sub_channel_index %d",
56 		      __entry->child_relid, __entry->monitorid,
57 		      __entry->is_ddc_int, __entry->connection_id,
58 		      __entry->if_type, __entry->if_instance,
59 		      __entry->chn_flags, __entry->mmio_mb,
60 		      __entry->sub_idx
61 		    )
62 	);
63 
64 TRACE_EVENT(vmbus_onoffer_rescind,
65 	    TP_PROTO(const struct vmbus_channel_rescind_offer *offer),
66 	    TP_ARGS(offer),
67 	    TP_STRUCT__entry(__field(u32, child_relid)),
68 	    TP_fast_assign(__entry->child_relid = offer->child_relid),
69 	    TP_printk("child_relid 0x%x", __entry->child_relid)
70 	);
71 
72 TRACE_EVENT(vmbus_onopen_result,
73 	    TP_PROTO(const struct vmbus_channel_open_result *result),
74 	    TP_ARGS(result),
75 	    TP_STRUCT__entry(
76 		    __field(u32, child_relid)
77 		    __field(u32, openid)
78 		    __field(u32, status)
79 		    ),
80 	    TP_fast_assign(__entry->child_relid = result->child_relid;
81 			   __entry->openid = result->openid;
82 			   __entry->status = result->status;
83 		    ),
84 	    TP_printk("child_relid 0x%x, openid %d, status %d",
85 		      __entry->child_relid,  __entry->openid,  __entry->status
86 		    )
87 	);
88 
89 TRACE_EVENT(vmbus_ongpadl_created,
90 	    TP_PROTO(const struct vmbus_channel_gpadl_created *gpadlcreated),
91 	    TP_ARGS(gpadlcreated),
92 	    TP_STRUCT__entry(
93 		    __field(u32, child_relid)
94 		    __field(u32, gpadl)
95 		    __field(u32, status)
96 		    ),
97 	    TP_fast_assign(__entry->child_relid = gpadlcreated->child_relid;
98 			   __entry->gpadl = gpadlcreated->gpadl;
99 			   __entry->status = gpadlcreated->creation_status;
100 		    ),
101 	    TP_printk("child_relid 0x%x, gpadl 0x%x, creation_status %d",
102 		      __entry->child_relid,  __entry->gpadl,  __entry->status
103 		    )
104 	);
105 
106 TRACE_EVENT(vmbus_onmodifychannel_response,
107 	    TP_PROTO(const struct vmbus_channel_modifychannel_response *response),
108 	    TP_ARGS(response),
109 	    TP_STRUCT__entry(
110 		    __field(u32, child_relid)
111 		    __field(u32, status)
112 		    ),
113 	    TP_fast_assign(__entry->child_relid = response->child_relid;
114 			   __entry->status = response->status;
115 		    ),
116 	    TP_printk("child_relid 0x%x, status %d",
117 		      __entry->child_relid,  __entry->status
118 		    )
119 	);
120 
121 TRACE_EVENT(vmbus_ongpadl_torndown,
122 	    TP_PROTO(const struct vmbus_channel_gpadl_torndown *gpadltorndown),
123 	    TP_ARGS(gpadltorndown),
124 	    TP_STRUCT__entry(__field(u32, gpadl)),
125 	    TP_fast_assign(__entry->gpadl = gpadltorndown->gpadl),
126 	    TP_printk("gpadl 0x%x", __entry->gpadl)
127 	);
128 
129 TRACE_EVENT(vmbus_onversion_response,
130 	    TP_PROTO(const struct vmbus_channel_version_response *response),
131 	    TP_ARGS(response),
132 	    TP_STRUCT__entry(
133 		    __field(u8, ver)
134 		    ),
135 	    TP_fast_assign(__entry->ver = response->version_supported;
136 		    ),
137 	    TP_printk("version_supported %d", __entry->ver)
138 	);
139 
140 TRACE_EVENT(vmbus_request_offers,
141 	    TP_PROTO(int ret),
142 	    TP_ARGS(ret),
143 	    TP_STRUCT__entry(__field(int, ret)),
144 	    TP_fast_assign(__entry->ret = ret),
145 	    TP_printk("sending ret %d", __entry->ret)
146 	);
147 
148 TRACE_EVENT(vmbus_open,
149 	    TP_PROTO(const struct vmbus_channel_open_channel *msg, int ret),
150 	    TP_ARGS(msg, ret),
151 	    TP_STRUCT__entry(
152 		    __field(u32, child_relid)
153 		    __field(u32, openid)
154 		    __field(u32, gpadlhandle)
155 		    __field(u32, target_vp)
156 		    __field(u32, offset)
157 		    __field(int, ret)
158 		    ),
159 	    TP_fast_assign(
160 		    __entry->child_relid = msg->child_relid;
161 		    __entry->openid = msg->openid;
162 		    __entry->gpadlhandle = msg->ringbuffer_gpadlhandle;
163 		    __entry->target_vp = msg->target_vp;
164 		    __entry->offset = msg->downstream_ringbuffer_pageoffset;
165 		    __entry->ret = ret;
166 		    ),
167 	    TP_printk("sending child_relid 0x%x, openid %d, "
168 		      "gpadlhandle 0x%x, target_vp 0x%x, offset 0x%x, ret %d",
169 		      __entry->child_relid,  __entry->openid,
170 		      __entry->gpadlhandle, __entry->target_vp,
171 		      __entry->offset, __entry->ret
172 		    )
173 	);
174 
175 TRACE_EVENT(vmbus_close_internal,
176 	    TP_PROTO(const struct vmbus_channel_close_channel *msg, int ret),
177 	    TP_ARGS(msg, ret),
178 	    TP_STRUCT__entry(
179 		    __field(u32, child_relid)
180 		    __field(int, ret)
181 		    ),
182 	    TP_fast_assign(
183 		    __entry->child_relid = msg->child_relid;
184 		    __entry->ret = ret;
185 		    ),
186 	    TP_printk("sending child_relid 0x%x, ret %d", __entry->child_relid,
187 		    __entry->ret)
188 	);
189 
190 TRACE_EVENT(vmbus_establish_gpadl_header,
191 	    TP_PROTO(const struct vmbus_channel_gpadl_header *msg, int ret),
192 	    TP_ARGS(msg, ret),
193 	    TP_STRUCT__entry(
194 		    __field(u32, child_relid)
195 		    __field(u32, gpadl)
196 		    __field(u16, range_buflen)
197 		    __field(u16, rangecount)
198 		    __field(int, ret)
199 		    ),
200 	    TP_fast_assign(
201 		    __entry->child_relid = msg->child_relid;
202 		    __entry->gpadl = msg->gpadl;
203 		    __entry->range_buflen = msg->range_buflen;
204 		    __entry->rangecount = msg->rangecount;
205 		    __entry->ret = ret;
206 		    ),
207 	    TP_printk("sending child_relid 0x%x, gpadl 0x%x, range_buflen %d "
208 		      "rangecount %d, ret %d",
209 		      __entry->child_relid, __entry->gpadl,
210 		      __entry->range_buflen, __entry->rangecount, __entry->ret
211 		    )
212 	);
213 
214 TRACE_EVENT(vmbus_establish_gpadl_body,
215 	    TP_PROTO(const struct vmbus_channel_gpadl_body *msg, int ret),
216 	    TP_ARGS(msg, ret),
217 	    TP_STRUCT__entry(
218 		    __field(u32, msgnumber)
219 		    __field(u32, gpadl)
220 		    __field(int, ret)
221 		    ),
222 	    TP_fast_assign(
223 		    __entry->msgnumber = msg->msgnumber;
224 		    __entry->gpadl = msg->gpadl;
225 		    __entry->ret = ret;
226 		    ),
227 	    TP_printk("sending msgnumber %d, gpadl 0x%x, ret %d",
228 		      __entry->msgnumber, __entry->gpadl, __entry->ret
229 		    )
230 	);
231 
232 TRACE_EVENT(vmbus_teardown_gpadl,
233 	    TP_PROTO(const struct vmbus_channel_gpadl_teardown *msg, int ret),
234 	    TP_ARGS(msg, ret),
235 	    TP_STRUCT__entry(
236 		    __field(u32, child_relid)
237 		    __field(u32, gpadl)
238 		    __field(int, ret)
239 		    ),
240 	    TP_fast_assign(
241 		    __entry->child_relid = msg->child_relid;
242 		    __entry->gpadl = msg->gpadl;
243 		    __entry->ret = ret;
244 		    ),
245 	    TP_printk("sending child_relid 0x%x, gpadl 0x%x, ret %d",
246 		      __entry->child_relid, __entry->gpadl, __entry->ret
247 		    )
248 	);
249 
250 TRACE_EVENT(vmbus_negotiate_version,
251 	    TP_PROTO(const struct vmbus_channel_initiate_contact *msg, int ret),
252 	    TP_ARGS(msg, ret),
253 	    TP_STRUCT__entry(
254 		    __field(u32, ver)
255 		    __field(u32, target_vcpu)
256 		    __field(int, ret)
257 		    __field(u64, int_page)
258 		    __field(u64, mon_page1)
259 		    __field(u64, mon_page2)
260 		    ),
261 	    TP_fast_assign(
262 		    __entry->ver = msg->vmbus_version_requested;
263 		    __entry->target_vcpu = msg->target_vcpu;
264 		    __entry->int_page = msg->interrupt_page;
265 		    __entry->mon_page1 = msg->monitor_page1;
266 		    __entry->mon_page2 = msg->monitor_page2;
267 		    __entry->ret = ret;
268 		    ),
269 	    TP_printk("sending vmbus_version_requested %d, target_vcpu 0x%x, "
270 		      "pages %llx:%llx:%llx, ret %d",
271 		      __entry->ver, __entry->target_vcpu, __entry->int_page,
272 		      __entry->mon_page1, __entry->mon_page2, __entry->ret
273 		    )
274 	);
275 
276 TRACE_EVENT(vmbus_release_relid,
277 	    TP_PROTO(const struct vmbus_channel_relid_released *msg, int ret),
278 	    TP_ARGS(msg, ret),
279 	    TP_STRUCT__entry(
280 		    __field(u32, child_relid)
281 		    __field(int, ret)
282 		    ),
283 	    TP_fast_assign(
284 		    __entry->child_relid = msg->child_relid;
285 		    __entry->ret = ret;
286 		    ),
287 	    TP_printk("sending child_relid 0x%x, ret %d",
288 		      __entry->child_relid, __entry->ret
289 		    )
290 	);
291 
292 TRACE_EVENT(vmbus_send_tl_connect_request,
293 	    TP_PROTO(const struct vmbus_channel_tl_connect_request *msg,
294 		     int ret),
295 	    TP_ARGS(msg, ret),
296 	    TP_STRUCT__entry(
297 		    __array(char, guest_id, 16)
298 		    __array(char, host_id, 16)
299 		    __field(int, ret)
300 		    ),
301 	    TP_fast_assign(
302 		    export_guid(__entry->guest_id, &msg->guest_endpoint_id);
303 		    export_guid(__entry->host_id, &msg->host_service_id);
304 		    __entry->ret = ret;
305 		    ),
306 	    TP_printk("sending guest_endpoint_id %pUl, host_service_id %pUl, "
307 		      "ret %d",
308 		      __entry->guest_id, __entry->host_id, __entry->ret
309 		    )
310 	);
311 
312 TRACE_EVENT(vmbus_send_modifychannel,
313 	    TP_PROTO(const struct vmbus_channel_modifychannel *msg,
314 		     int ret),
315 	    TP_ARGS(msg, ret),
316 	    TP_STRUCT__entry(
317 		    __field(u32, child_relid)
318 		    __field(u32, target_vp)
319 		    __field(int, ret)
320 		    ),
321 	    TP_fast_assign(
322 		    __entry->child_relid = msg->child_relid;
323 		    __entry->target_vp = msg->target_vp;
324 		    __entry->ret = ret;
325 		    ),
326 	    TP_printk("binding child_relid 0x%x to target_vp 0x%x, ret %d",
327 		      __entry->child_relid, __entry->target_vp, __entry->ret
328 		    )
329 	);
330 
331 DECLARE_EVENT_CLASS(vmbus_channel,
332 	TP_PROTO(const struct vmbus_channel *channel),
333 	TP_ARGS(channel),
334 	TP_STRUCT__entry(__field(u32, relid)),
335 	TP_fast_assign(__entry->relid = channel->offermsg.child_relid),
336 	TP_printk("relid 0x%x", __entry->relid)
337 );
338 
339 DEFINE_EVENT(vmbus_channel, vmbus_chan_sched,
340 	    TP_PROTO(const struct vmbus_channel *channel),
341 	    TP_ARGS(channel)
342 );
343 
344 DEFINE_EVENT(vmbus_channel, vmbus_setevent,
345 	    TP_PROTO(const struct vmbus_channel *channel),
346 	    TP_ARGS(channel)
347 );
348 
349 DEFINE_EVENT(vmbus_channel, vmbus_on_event,
350 	    TP_PROTO(const struct vmbus_channel *channel),
351 	    TP_ARGS(channel)
352 );
353 
354 #undef TRACE_INCLUDE_PATH
355 #define TRACE_INCLUDE_PATH .
356 #undef TRACE_INCLUDE_FILE
357 #define TRACE_INCLUDE_FILE hv_trace
358 #endif /* _HV_TRACE_H */
359 
360 /* This part must be outside protection */
361 #include <trace/define_trace.h>
362