xref: /openbmc/linux/drivers/hv/hv_trace.h (revision 4bb1e4e7)
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 			   memcpy(__entry->if_type,
48 				  &offer->offer.if_type.b, 16);
49 			   memcpy(__entry->if_instance,
50 				  &offer->offer.if_instance.b, 16);
51 			   __entry->chn_flags = offer->offer.chn_flags;
52 			   __entry->mmio_mb = offer->offer.mmio_megabytes;
53 			   __entry->sub_idx = offer->offer.sub_channel_index;
54 		    ),
55 	    TP_printk("child_relid 0x%x, monitorid 0x%x, is_dedicated %d, "
56 		      "connection_id 0x%x, if_type %pUl, if_instance %pUl, "
57 		      "chn_flags 0x%x, mmio_megabytes %d, sub_channel_index %d",
58 		      __entry->child_relid, __entry->monitorid,
59 		      __entry->is_ddc_int, __entry->connection_id,
60 		      __entry->if_type, __entry->if_instance,
61 		      __entry->chn_flags, __entry->mmio_mb,
62 		      __entry->sub_idx
63 		    )
64 	);
65 
66 TRACE_EVENT(vmbus_onoffer_rescind,
67 	    TP_PROTO(const struct vmbus_channel_rescind_offer *offer),
68 	    TP_ARGS(offer),
69 	    TP_STRUCT__entry(__field(u32, child_relid)),
70 	    TP_fast_assign(__entry->child_relid = offer->child_relid),
71 	    TP_printk("child_relid 0x%x", __entry->child_relid)
72 	);
73 
74 TRACE_EVENT(vmbus_onopen_result,
75 	    TP_PROTO(const struct vmbus_channel_open_result *result),
76 	    TP_ARGS(result),
77 	    TP_STRUCT__entry(
78 		    __field(u32, child_relid)
79 		    __field(u32, openid)
80 		    __field(u32, status)
81 		    ),
82 	    TP_fast_assign(__entry->child_relid = result->child_relid;
83 			   __entry->openid = result->openid;
84 			   __entry->status = result->status;
85 		    ),
86 	    TP_printk("child_relid 0x%x, openid %d, status %d",
87 		      __entry->child_relid,  __entry->openid,  __entry->status
88 		    )
89 	);
90 
91 TRACE_EVENT(vmbus_ongpadl_created,
92 	    TP_PROTO(const struct vmbus_channel_gpadl_created *gpadlcreated),
93 	    TP_ARGS(gpadlcreated),
94 	    TP_STRUCT__entry(
95 		    __field(u32, child_relid)
96 		    __field(u32, gpadl)
97 		    __field(u32, status)
98 		    ),
99 	    TP_fast_assign(__entry->child_relid = gpadlcreated->child_relid;
100 			   __entry->gpadl = gpadlcreated->gpadl;
101 			   __entry->status = gpadlcreated->creation_status;
102 		    ),
103 	    TP_printk("child_relid 0x%x, gpadl 0x%x, creation_status %d",
104 		      __entry->child_relid,  __entry->gpadl,  __entry->status
105 		    )
106 	);
107 
108 TRACE_EVENT(vmbus_ongpadl_torndown,
109 	    TP_PROTO(const struct vmbus_channel_gpadl_torndown *gpadltorndown),
110 	    TP_ARGS(gpadltorndown),
111 	    TP_STRUCT__entry(__field(u32, gpadl)),
112 	    TP_fast_assign(__entry->gpadl = gpadltorndown->gpadl),
113 	    TP_printk("gpadl 0x%x", __entry->gpadl)
114 	);
115 
116 TRACE_EVENT(vmbus_onversion_response,
117 	    TP_PROTO(const struct vmbus_channel_version_response *response),
118 	    TP_ARGS(response),
119 	    TP_STRUCT__entry(
120 		    __field(u8, ver)
121 		    ),
122 	    TP_fast_assign(__entry->ver = response->version_supported;
123 		    ),
124 	    TP_printk("version_supported %d", __entry->ver)
125 	);
126 
127 TRACE_EVENT(vmbus_request_offers,
128 	    TP_PROTO(int ret),
129 	    TP_ARGS(ret),
130 	    TP_STRUCT__entry(__field(int, ret)),
131 	    TP_fast_assign(__entry->ret = ret),
132 	    TP_printk("sending ret %d", __entry->ret)
133 	);
134 
135 TRACE_EVENT(vmbus_open,
136 	    TP_PROTO(const struct vmbus_channel_open_channel *msg, int ret),
137 	    TP_ARGS(msg, ret),
138 	    TP_STRUCT__entry(
139 		    __field(u32, child_relid)
140 		    __field(u32, openid)
141 		    __field(u32, gpadlhandle)
142 		    __field(u32, target_vp)
143 		    __field(u32, offset)
144 		    __field(int, ret)
145 		    ),
146 	    TP_fast_assign(
147 		    __entry->child_relid = msg->child_relid;
148 		    __entry->openid = msg->openid;
149 		    __entry->gpadlhandle = msg->ringbuffer_gpadlhandle;
150 		    __entry->target_vp = msg->target_vp;
151 		    __entry->offset = msg->downstream_ringbuffer_pageoffset;
152 		    __entry->ret = ret;
153 		    ),
154 	    TP_printk("sending child_relid 0x%x, openid %d, "
155 		      "gpadlhandle 0x%x, target_vp 0x%x, offset 0x%x, ret %d",
156 		      __entry->child_relid,  __entry->openid,
157 		      __entry->gpadlhandle, __entry->target_vp,
158 		      __entry->offset, __entry->ret
159 		    )
160 	);
161 
162 TRACE_EVENT(vmbus_close_internal,
163 	    TP_PROTO(const struct vmbus_channel_close_channel *msg, int ret),
164 	    TP_ARGS(msg, ret),
165 	    TP_STRUCT__entry(
166 		    __field(u32, child_relid)
167 		    __field(int, ret)
168 		    ),
169 	    TP_fast_assign(
170 		    __entry->child_relid = msg->child_relid;
171 		    __entry->ret = ret;
172 		    ),
173 	    TP_printk("sending child_relid 0x%x, ret %d", __entry->child_relid,
174 		    __entry->ret)
175 	);
176 
177 TRACE_EVENT(vmbus_establish_gpadl_header,
178 	    TP_PROTO(const struct vmbus_channel_gpadl_header *msg, int ret),
179 	    TP_ARGS(msg, ret),
180 	    TP_STRUCT__entry(
181 		    __field(u32, child_relid)
182 		    __field(u32, gpadl)
183 		    __field(u16, range_buflen)
184 		    __field(u16, rangecount)
185 		    __field(int, ret)
186 		    ),
187 	    TP_fast_assign(
188 		    __entry->child_relid = msg->child_relid;
189 		    __entry->gpadl = msg->gpadl;
190 		    __entry->range_buflen = msg->range_buflen;
191 		    __entry->rangecount = msg->rangecount;
192 		    __entry->ret = ret;
193 		    ),
194 	    TP_printk("sending child_relid 0x%x, gpadl 0x%x, range_buflen %d "
195 		      "rangecount %d, ret %d",
196 		      __entry->child_relid, __entry->gpadl,
197 		      __entry->range_buflen, __entry->rangecount, __entry->ret
198 		    )
199 	);
200 
201 TRACE_EVENT(vmbus_establish_gpadl_body,
202 	    TP_PROTO(const struct vmbus_channel_gpadl_body *msg, int ret),
203 	    TP_ARGS(msg, ret),
204 	    TP_STRUCT__entry(
205 		    __field(u32, msgnumber)
206 		    __field(u32, gpadl)
207 		    __field(int, ret)
208 		    ),
209 	    TP_fast_assign(
210 		    __entry->msgnumber = msg->msgnumber;
211 		    __entry->gpadl = msg->gpadl;
212 		    __entry->ret = ret;
213 		    ),
214 	    TP_printk("sending msgnumber %d, gpadl 0x%x, ret %d",
215 		      __entry->msgnumber, __entry->gpadl, __entry->ret
216 		    )
217 	);
218 
219 TRACE_EVENT(vmbus_teardown_gpadl,
220 	    TP_PROTO(const struct vmbus_channel_gpadl_teardown *msg, int ret),
221 	    TP_ARGS(msg, ret),
222 	    TP_STRUCT__entry(
223 		    __field(u32, child_relid)
224 		    __field(u32, gpadl)
225 		    __field(int, ret)
226 		    ),
227 	    TP_fast_assign(
228 		    __entry->child_relid = msg->child_relid;
229 		    __entry->gpadl = msg->gpadl;
230 		    __entry->ret = ret;
231 		    ),
232 	    TP_printk("sending child_relid 0x%x, gpadl 0x%x, ret %d",
233 		      __entry->child_relid, __entry->gpadl, __entry->ret
234 		    )
235 	);
236 
237 TRACE_EVENT(vmbus_negotiate_version,
238 	    TP_PROTO(const struct vmbus_channel_initiate_contact *msg, int ret),
239 	    TP_ARGS(msg, ret),
240 	    TP_STRUCT__entry(
241 		    __field(u32, ver)
242 		    __field(u32, target_vcpu)
243 		    __field(int, ret)
244 		    __field(u64, int_page)
245 		    __field(u64, mon_page1)
246 		    __field(u64, mon_page2)
247 		    ),
248 	    TP_fast_assign(
249 		    __entry->ver = msg->vmbus_version_requested;
250 		    __entry->target_vcpu = msg->target_vcpu;
251 		    __entry->int_page = msg->interrupt_page;
252 		    __entry->mon_page1 = msg->monitor_page1;
253 		    __entry->mon_page2 = msg->monitor_page2;
254 		    __entry->ret = ret;
255 		    ),
256 	    TP_printk("sending vmbus_version_requested %d, target_vcpu 0x%x, "
257 		      "pages %llx:%llx:%llx, ret %d",
258 		      __entry->ver, __entry->target_vcpu, __entry->int_page,
259 		      __entry->mon_page1, __entry->mon_page2, __entry->ret
260 		    )
261 	);
262 
263 TRACE_EVENT(vmbus_release_relid,
264 	    TP_PROTO(const struct vmbus_channel_relid_released *msg, int ret),
265 	    TP_ARGS(msg, ret),
266 	    TP_STRUCT__entry(
267 		    __field(u32, child_relid)
268 		    __field(int, ret)
269 		    ),
270 	    TP_fast_assign(
271 		    __entry->child_relid = msg->child_relid;
272 		    __entry->ret = ret;
273 		    ),
274 	    TP_printk("sending child_relid 0x%x, ret %d",
275 		      __entry->child_relid, __entry->ret
276 		    )
277 	);
278 
279 TRACE_EVENT(vmbus_send_tl_connect_request,
280 	    TP_PROTO(const struct vmbus_channel_tl_connect_request *msg,
281 		     int ret),
282 	    TP_ARGS(msg, ret),
283 	    TP_STRUCT__entry(
284 		    __array(char, guest_id, 16)
285 		    __array(char, host_id, 16)
286 		    __field(int, ret)
287 		    ),
288 	    TP_fast_assign(
289 		    memcpy(__entry->guest_id, &msg->guest_endpoint_id.b, 16);
290 		    memcpy(__entry->host_id, &msg->host_service_id.b, 16);
291 		    __entry->ret = ret;
292 		    ),
293 	    TP_printk("sending guest_endpoint_id %pUl, host_service_id %pUl, "
294 		      "ret %d",
295 		      __entry->guest_id, __entry->host_id, __entry->ret
296 		    )
297 	);
298 
299 DECLARE_EVENT_CLASS(vmbus_channel,
300 	TP_PROTO(const struct vmbus_channel *channel),
301 	TP_ARGS(channel),
302 	TP_STRUCT__entry(__field(u32, relid)),
303 	TP_fast_assign(__entry->relid = channel->offermsg.child_relid),
304 	TP_printk("relid 0x%x", __entry->relid)
305 );
306 
307 DEFINE_EVENT(vmbus_channel, vmbus_chan_sched,
308 	    TP_PROTO(const struct vmbus_channel *channel),
309 	    TP_ARGS(channel)
310 );
311 
312 DEFINE_EVENT(vmbus_channel, vmbus_setevent,
313 	    TP_PROTO(const struct vmbus_channel *channel),
314 	    TP_ARGS(channel)
315 );
316 
317 DEFINE_EVENT(vmbus_channel, vmbus_on_event,
318 	    TP_PROTO(const struct vmbus_channel *channel),
319 	    TP_ARGS(channel)
320 );
321 
322 #undef TRACE_INCLUDE_PATH
323 #define TRACE_INCLUDE_PATH .
324 #undef TRACE_INCLUDE_FILE
325 #define TRACE_INCLUDE_FILE hv_trace
326 #endif /* _HV_TRACE_H */
327 
328 /* This part must be outside protection */
329 #include <trace/define_trace.h>
330