blob: 6f0209d45164f0a6793288a883742f6b52f037d2 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Cornelia Huckade38c32012-07-23 17:20:30 +02002#if !defined(_TRACE_KVMS390_H) || defined(TRACE_HEADER_MULTI_READ)
3#define _TRACE_KVMS390_H
4
5#include <linux/tracepoint.h>
6
7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM kvm-s390
9#define TRACE_INCLUDE_PATH .
10#undef TRACE_INCLUDE_FILE
11#define TRACE_INCLUDE_FILE trace-s390
12
13/*
Steven Rostedt (Red Hat)bd412022015-04-01 14:19:06 -040014 * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a
15 * legitimate C variable. It is not exported to user space.
16 */
17#undef TRACE_SYSTEM_VAR
18#define TRACE_SYSTEM_VAR kvm_s390
19
20/*
Cornelia Huckade38c32012-07-23 17:20:30 +020021 * Trace point for the creation of the kvm instance.
22 */
23TRACE_EVENT(kvm_s390_create_vm,
24 TP_PROTO(unsigned long type),
25 TP_ARGS(type),
26
27 TP_STRUCT__entry(
28 __field(unsigned long, type)
29 ),
30
31 TP_fast_assign(
32 __entry->type = type;
33 ),
34
35 TP_printk("create vm%s",
36 __entry->type & KVM_VM_S390_UCONTROL ? " (UCONTROL)" : "")
37 );
38
39/*
40 * Trace points for creation and destruction of vpcus.
41 */
42TRACE_EVENT(kvm_s390_create_vcpu,
43 TP_PROTO(unsigned int id, struct kvm_vcpu *vcpu,
44 struct kvm_s390_sie_block *sie_block),
45 TP_ARGS(id, vcpu, sie_block),
46
47 TP_STRUCT__entry(
48 __field(unsigned int, id)
49 __field(struct kvm_vcpu *, vcpu)
50 __field(struct kvm_s390_sie_block *, sie_block)
51 ),
52
53 TP_fast_assign(
54 __entry->id = id;
55 __entry->vcpu = vcpu;
56 __entry->sie_block = sie_block;
57 ),
58
Christian Borntraeger8335713a2015-12-08 16:55:27 +010059 TP_printk("create cpu %d at 0x%pK, sie block at 0x%pK",
60 __entry->id, __entry->vcpu, __entry->sie_block)
Cornelia Huckade38c32012-07-23 17:20:30 +020061 );
62
63TRACE_EVENT(kvm_s390_destroy_vcpu,
64 TP_PROTO(unsigned int id),
65 TP_ARGS(id),
66
67 TP_STRUCT__entry(
68 __field(unsigned int, id)
69 ),
70
71 TP_fast_assign(
72 __entry->id = id;
73 ),
74
75 TP_printk("destroy cpu %d", __entry->id)
76 );
77
78/*
David Hildenbrand6852d7b2014-03-14 10:59:29 +010079 * Trace point for start and stop of vpcus.
80 */
81TRACE_EVENT(kvm_s390_vcpu_start_stop,
82 TP_PROTO(unsigned int id, int state),
83 TP_ARGS(id, state),
84
85 TP_STRUCT__entry(
86 __field(unsigned int, id)
87 __field(int, state)
88 ),
89
90 TP_fast_assign(
91 __entry->id = id;
92 __entry->state = state;
93 ),
94
95 TP_printk("%s cpu %d", __entry->state ? "starting" : "stopping",
96 __entry->id)
97 );
98
99/*
Cornelia Huckade38c32012-07-23 17:20:30 +0200100 * Trace points for injection of interrupts, either per machine or
101 * per vcpu.
102 */
103
104#define kvm_s390_int_type \
105 {KVM_S390_SIGP_STOP, "sigp stop"}, \
106 {KVM_S390_PROGRAM_INT, "program interrupt"}, \
107 {KVM_S390_SIGP_SET_PREFIX, "sigp set prefix"}, \
108 {KVM_S390_RESTART, "sigp restart"}, \
David Hildenbranda37281b2014-11-21 13:45:08 +0100109 {KVM_S390_INT_PFAULT_INIT, "pfault init"}, \
110 {KVM_S390_INT_PFAULT_DONE, "pfault done"}, \
111 {KVM_S390_MCHK, "machine check"}, \
112 {KVM_S390_INT_CLOCK_COMP, "clock comparator"}, \
113 {KVM_S390_INT_CPU_TIMER, "cpu timer"}, \
Cornelia Huckade38c32012-07-23 17:20:30 +0200114 {KVM_S390_INT_VIRTIO, "virtio interrupt"}, \
115 {KVM_S390_INT_SERVICE, "sclp interrupt"}, \
116 {KVM_S390_INT_EMERGENCY, "sigp emergency"}, \
117 {KVM_S390_INT_EXTERNAL_CALL, "sigp ext call"}
118
David Hildenbranda37281b2014-11-21 13:45:08 +0100119#define get_irq_name(__type) \
120 (__type > KVM_S390_INT_IO_MAX ? \
121 __print_symbolic(__type, kvm_s390_int_type) : \
122 (__type & KVM_S390_INT_IO_AI_MASK ? \
123 "adapter I/O interrupt" : "subchannel I/O interrupt"))
124
Cornelia Huckade38c32012-07-23 17:20:30 +0200125TRACE_EVENT(kvm_s390_inject_vm,
126 TP_PROTO(__u64 type, __u32 parm, __u64 parm64, int who),
127 TP_ARGS(type, parm, parm64, who),
128
129 TP_STRUCT__entry(
130 __field(__u32, inttype)
131 __field(__u32, parm)
132 __field(__u64, parm64)
133 __field(int, who)
134 ),
135
136 TP_fast_assign(
137 __entry->inttype = type & 0x00000000ffffffff;
138 __entry->parm = parm;
139 __entry->parm64 = parm64;
140 __entry->who = who;
141 ),
142
143 TP_printk("inject%s: type:%x (%s) parm:%x parm64:%llx",
144 (__entry->who == 1) ? " (from kernel)" :
145 (__entry->who == 2) ? " (from user)" : "",
David Hildenbranda37281b2014-11-21 13:45:08 +0100146 __entry->inttype, get_irq_name(__entry->inttype),
Cornelia Huckade38c32012-07-23 17:20:30 +0200147 __entry->parm, __entry->parm64)
148 );
149
150TRACE_EVENT(kvm_s390_inject_vcpu,
David Hildenbranded2afcf2015-07-20 10:33:03 +0200151 TP_PROTO(unsigned int id, __u64 type, __u32 parm, __u64 parm64),
152 TP_ARGS(id, type, parm, parm64),
Cornelia Huckade38c32012-07-23 17:20:30 +0200153
154 TP_STRUCT__entry(
155 __field(int, id)
156 __field(__u32, inttype)
157 __field(__u32, parm)
158 __field(__u64, parm64)
Cornelia Huckade38c32012-07-23 17:20:30 +0200159 ),
160
161 TP_fast_assign(
162 __entry->id = id;
163 __entry->inttype = type & 0x00000000ffffffff;
164 __entry->parm = parm;
165 __entry->parm64 = parm64;
Cornelia Huckade38c32012-07-23 17:20:30 +0200166 ),
167
David Hildenbranded2afcf2015-07-20 10:33:03 +0200168 TP_printk("inject (vcpu %d): type:%x (%s) parm:%x parm64:%llx",
Cornelia Huckade38c32012-07-23 17:20:30 +0200169 __entry->id, __entry->inttype,
David Hildenbranda37281b2014-11-21 13:45:08 +0100170 get_irq_name(__entry->inttype), __entry->parm,
171 __entry->parm64)
Cornelia Huckade38c32012-07-23 17:20:30 +0200172 );
173
174/*
175 * Trace point for the actual delivery of interrupts.
176 */
177TRACE_EVENT(kvm_s390_deliver_interrupt,
Cornelia Huck48a3e952012-12-20 15:32:09 +0100178 TP_PROTO(unsigned int id, __u64 type, __u64 data0, __u64 data1),
Cornelia Huckade38c32012-07-23 17:20:30 +0200179 TP_ARGS(id, type, data0, data1),
180
181 TP_STRUCT__entry(
182 __field(int, id)
183 __field(__u32, inttype)
Cornelia Huck48a3e952012-12-20 15:32:09 +0100184 __field(__u64, data0)
Cornelia Huckade38c32012-07-23 17:20:30 +0200185 __field(__u64, data1)
186 ),
187
188 TP_fast_assign(
189 __entry->id = id;
190 __entry->inttype = type & 0x00000000ffffffff;
191 __entry->data0 = data0;
192 __entry->data1 = data1;
193 ),
194
195 TP_printk("deliver interrupt (vcpu %d): type:%x (%s) " \
Cornelia Huck48a3e952012-12-20 15:32:09 +0100196 "data:%08llx %016llx",
Cornelia Huckade38c32012-07-23 17:20:30 +0200197 __entry->id, __entry->inttype,
David Hildenbranda37281b2014-11-21 13:45:08 +0100198 get_irq_name(__entry->inttype), __entry->data0,
199 __entry->data1)
Cornelia Huckade38c32012-07-23 17:20:30 +0200200 );
201
202/*
203 * Trace point for resets that may be requested from userspace.
204 */
205TRACE_EVENT(kvm_s390_request_resets,
206 TP_PROTO(__u64 resets),
207 TP_ARGS(resets),
208
209 TP_STRUCT__entry(
210 __field(__u64, resets)
211 ),
212
213 TP_fast_assign(
214 __entry->resets = resets;
215 ),
216
217 TP_printk("requesting userspace resets %llx",
218 __entry->resets)
219 );
220
221/*
222 * Trace point for a vcpu's stop requests.
223 */
224TRACE_EVENT(kvm_s390_stop_request,
David Hildenbrand6cddd432014-10-15 16:48:53 +0200225 TP_PROTO(unsigned char stop_irq, unsigned char flags),
226 TP_ARGS(stop_irq, flags),
Cornelia Huckade38c32012-07-23 17:20:30 +0200227
228 TP_STRUCT__entry(
David Hildenbrand6cddd432014-10-15 16:48:53 +0200229 __field(unsigned char, stop_irq)
230 __field(unsigned char, flags)
Cornelia Huckade38c32012-07-23 17:20:30 +0200231 ),
232
233 TP_fast_assign(
David Hildenbrand6cddd432014-10-15 16:48:53 +0200234 __entry->stop_irq = stop_irq;
235 __entry->flags = flags;
Cornelia Huckade38c32012-07-23 17:20:30 +0200236 ),
237
David Hildenbrand6cddd432014-10-15 16:48:53 +0200238 TP_printk("stop request, stop irq = %u, flags = %08x",
239 __entry->stop_irq, __entry->flags)
Cornelia Huckade38c32012-07-23 17:20:30 +0200240 );
241
242
Cornelia Huckfa6b7fe2012-12-20 15:32:12 +0100243/*
244 * Trace point for enabling channel I/O instruction support.
245 */
246TRACE_EVENT(kvm_s390_enable_css,
247 TP_PROTO(void *kvm),
248 TP_ARGS(kvm),
249
250 TP_STRUCT__entry(
251 __field(void *, kvm)
252 ),
253
254 TP_fast_assign(
255 __entry->kvm = kvm;
256 ),
257
Christian Borntraeger8335713a2015-12-08 16:55:27 +0100258 TP_printk("enabling channel I/O support (kvm @ %pK)\n",
Cornelia Huckfa6b7fe2012-12-20 15:32:12 +0100259 __entry->kvm)
260 );
261
David Hildenbrand8ad35752014-03-14 11:00:21 +0100262/*
263 * Trace point for enabling and disabling interlocking-and-broadcasting
264 * suppression.
265 */
266TRACE_EVENT(kvm_s390_enable_disable_ibs,
267 TP_PROTO(unsigned int id, int state),
268 TP_ARGS(id, state),
269
270 TP_STRUCT__entry(
271 __field(unsigned int, id)
272 __field(int, state)
273 ),
274
275 TP_fast_assign(
276 __entry->id = id;
277 __entry->state = state;
278 ),
279
280 TP_printk("%s ibs on cpu %d",
281 __entry->state ? "enabling" : "disabling", __entry->id)
282 );
283
Fei Li51978392017-02-17 17:06:26 +0800284/*
285 * Trace point for modifying ais mode for a given isc.
286 */
287TRACE_EVENT(kvm_s390_modify_ais_mode,
288 TP_PROTO(__u8 isc, __u16 from, __u16 to),
289 TP_ARGS(isc, from, to),
290
291 TP_STRUCT__entry(
292 __field(__u8, isc)
293 __field(__u16, from)
294 __field(__u16, to)
295 ),
296
297 TP_fast_assign(
298 __entry->isc = isc;
299 __entry->from = from;
300 __entry->to = to;
301 ),
302
303 TP_printk("for isc %x, modifying interruption mode from %s to %s",
304 __entry->isc,
305 (__entry->from == KVM_S390_AIS_MODE_ALL) ?
306 "ALL-Interruptions Mode" :
307 (__entry->from == KVM_S390_AIS_MODE_SINGLE) ?
308 "Single-Interruption Mode" : "No-Interruptions Mode",
309 (__entry->to == KVM_S390_AIS_MODE_ALL) ?
310 "ALL-Interruptions Mode" :
311 (__entry->to == KVM_S390_AIS_MODE_SINGLE) ?
312 "Single-Interruption Mode" : "No-Interruptions Mode")
313 );
314
Yi Min Zhaoa8920952017-02-20 10:15:01 +0800315/*
316 * Trace point for suppressed adapter I/O interrupt.
317 */
318TRACE_EVENT(kvm_s390_airq_suppressed,
319 TP_PROTO(__u32 id, __u8 isc),
320 TP_ARGS(id, isc),
321
322 TP_STRUCT__entry(
323 __field(__u32, id)
324 __field(__u8, isc)
325 ),
326
327 TP_fast_assign(
328 __entry->id = id;
329 __entry->isc = isc;
330 ),
331
332 TP_printk("adapter I/O interrupt suppressed (id:%x isc:%x)",
333 __entry->id, __entry->isc)
334 );
335
Cornelia Huckfa6b7fe2012-12-20 15:32:12 +0100336
Cornelia Huckade38c32012-07-23 17:20:30 +0200337#endif /* _TRACE_KVMS390_H */
338
339/* This part must be outside protection */
340#include <trace/define_trace.h>