]> git.ipfire.org Git - thirdparty/kernel/stable.git/blob - arch/s390/kvm/trace-s390.h
KVM: x86/pmu: Add documentation for fixed ctr on PMU filter
[thirdparty/kernel/stable.git] / arch / s390 / kvm / trace-s390.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #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 /*
14 * 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 /*
21 * Trace point for the creation of the kvm instance.
22 */
23 TRACE_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 */
42 TRACE_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
59 TP_printk("create cpu %d at 0x%pK, sie block at 0x%pK",
60 __entry->id, __entry->vcpu, __entry->sie_block)
61 );
62
63 TRACE_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 /*
79 * Trace point for start and stop of vpcus.
80 */
81 TRACE_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 /*
100 * 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"}, \
109 {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"}, \
114 {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
119 #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
125 TRACE_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)" : "",
146 __entry->inttype, get_irq_name(__entry->inttype),
147 __entry->parm, __entry->parm64)
148 );
149
150 TRACE_EVENT(kvm_s390_inject_vcpu,
151 TP_PROTO(unsigned int id, __u64 type, __u32 parm, __u64 parm64),
152 TP_ARGS(id, type, parm, parm64),
153
154 TP_STRUCT__entry(
155 __field(int, id)
156 __field(__u32, inttype)
157 __field(__u32, parm)
158 __field(__u64, parm64)
159 ),
160
161 TP_fast_assign(
162 __entry->id = id;
163 __entry->inttype = type & 0x00000000ffffffff;
164 __entry->parm = parm;
165 __entry->parm64 = parm64;
166 ),
167
168 TP_printk("inject (vcpu %d): type:%x (%s) parm:%x parm64:%llx",
169 __entry->id, __entry->inttype,
170 get_irq_name(__entry->inttype), __entry->parm,
171 __entry->parm64)
172 );
173
174 /*
175 * Trace point for the actual delivery of interrupts.
176 */
177 TRACE_EVENT(kvm_s390_deliver_interrupt,
178 TP_PROTO(unsigned int id, __u64 type, __u64 data0, __u64 data1),
179 TP_ARGS(id, type, data0, data1),
180
181 TP_STRUCT__entry(
182 __field(int, id)
183 __field(__u32, inttype)
184 __field(__u64, data0)
185 __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) " \
196 "data:%08llx %016llx",
197 __entry->id, __entry->inttype,
198 get_irq_name(__entry->inttype), __entry->data0,
199 __entry->data1)
200 );
201
202 /*
203 * Trace point for resets that may be requested from userspace.
204 */
205 TRACE_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 */
224 TRACE_EVENT(kvm_s390_stop_request,
225 TP_PROTO(unsigned char stop_irq, unsigned char flags),
226 TP_ARGS(stop_irq, flags),
227
228 TP_STRUCT__entry(
229 __field(unsigned char, stop_irq)
230 __field(unsigned char, flags)
231 ),
232
233 TP_fast_assign(
234 __entry->stop_irq = stop_irq;
235 __entry->flags = flags;
236 ),
237
238 TP_printk("stop request, stop irq = %u, flags = %08x",
239 __entry->stop_irq, __entry->flags)
240 );
241
242
243 /*
244 * Trace point for enabling channel I/O instruction support.
245 */
246 TRACE_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
258 TP_printk("enabling channel I/O support (kvm @ %pK)\n",
259 __entry->kvm)
260 );
261
262 /*
263 * Trace point for enabling and disabling interlocking-and-broadcasting
264 * suppression.
265 */
266 TRACE_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
284 /*
285 * Trace point for modifying ais mode for a given isc.
286 */
287 TRACE_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
315 /*
316 * Trace point for suppressed adapter I/O interrupt.
317 */
318 TRACE_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
336
337 #endif /* _TRACE_KVMS390_H */
338
339 /* This part must be outside protection */
340 #include <trace/define_trace.h>