Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / s390 / kvm / trace.h
blobaa419eb6a0c808ac87b03d9a2dfdcb531b983870
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
3 #define _TRACE_KVM_H
5 #include <linux/tracepoint.h>
6 #include <asm/sie.h>
7 #include <asm/debug.h>
8 #include <asm/dis.h>
10 #undef TRACE_SYSTEM
11 #define TRACE_SYSTEM kvm
12 #define TRACE_INCLUDE_PATH .
13 #undef TRACE_INCLUDE_FILE
14 #define TRACE_INCLUDE_FILE trace
17 * Helpers for vcpu-specific tracepoints containing the same information
18 * as s390dbf VCPU_EVENTs.
20 #define VCPU_PROTO_COMMON struct kvm_vcpu *vcpu
21 #define VCPU_ARGS_COMMON vcpu
22 #define VCPU_FIELD_COMMON __field(int, id) \
23 __field(unsigned long, pswmask) \
24 __field(unsigned long, pswaddr)
25 #define VCPU_ASSIGN_COMMON do { \
26 __entry->id = vcpu->vcpu_id; \
27 __entry->pswmask = vcpu->arch.sie_block->gpsw.mask; \
28 __entry->pswaddr = vcpu->arch.sie_block->gpsw.addr; \
29 } while (0);
30 #define VCPU_TP_PRINTK(p_str, p_args...) \
31 TP_printk("%02d[%016lx-%016lx]: " p_str, __entry->id, \
32 __entry->pswmask, __entry->pswaddr, p_args)
34 TRACE_EVENT(kvm_s390_skey_related_inst,
35 TP_PROTO(VCPU_PROTO_COMMON),
36 TP_ARGS(VCPU_ARGS_COMMON),
38 TP_STRUCT__entry(
39 VCPU_FIELD_COMMON
42 TP_fast_assign(
43 VCPU_ASSIGN_COMMON
45 VCPU_TP_PRINTK("%s", "storage key related instruction")
48 TRACE_EVENT(kvm_s390_major_guest_pfault,
49 TP_PROTO(VCPU_PROTO_COMMON),
50 TP_ARGS(VCPU_ARGS_COMMON),
52 TP_STRUCT__entry(
53 VCPU_FIELD_COMMON
56 TP_fast_assign(
57 VCPU_ASSIGN_COMMON
59 VCPU_TP_PRINTK("%s", "major fault, maybe applicable for pfault")
62 TRACE_EVENT(kvm_s390_pfault_init,
63 TP_PROTO(VCPU_PROTO_COMMON, long pfault_token),
64 TP_ARGS(VCPU_ARGS_COMMON, pfault_token),
66 TP_STRUCT__entry(
67 VCPU_FIELD_COMMON
68 __field(long, pfault_token)
71 TP_fast_assign(
72 VCPU_ASSIGN_COMMON
73 __entry->pfault_token = pfault_token;
75 VCPU_TP_PRINTK("init pfault token %ld", __entry->pfault_token)
78 TRACE_EVENT(kvm_s390_pfault_done,
79 TP_PROTO(VCPU_PROTO_COMMON, long pfault_token),
80 TP_ARGS(VCPU_ARGS_COMMON, pfault_token),
82 TP_STRUCT__entry(
83 VCPU_FIELD_COMMON
84 __field(long, pfault_token)
87 TP_fast_assign(
88 VCPU_ASSIGN_COMMON
89 __entry->pfault_token = pfault_token;
91 VCPU_TP_PRINTK("done pfault token %ld", __entry->pfault_token)
95 * Tracepoints for SIE entry and exit.
97 TRACE_EVENT(kvm_s390_sie_enter,
98 TP_PROTO(VCPU_PROTO_COMMON, int cpuflags),
99 TP_ARGS(VCPU_ARGS_COMMON, cpuflags),
101 TP_STRUCT__entry(
102 VCPU_FIELD_COMMON
103 __field(int, cpuflags)
106 TP_fast_assign(
107 VCPU_ASSIGN_COMMON
108 __entry->cpuflags = cpuflags;
111 VCPU_TP_PRINTK("entering sie flags %x", __entry->cpuflags)
114 TRACE_EVENT(kvm_s390_sie_fault,
115 TP_PROTO(VCPU_PROTO_COMMON),
116 TP_ARGS(VCPU_ARGS_COMMON),
118 TP_STRUCT__entry(
119 VCPU_FIELD_COMMON
122 TP_fast_assign(
123 VCPU_ASSIGN_COMMON
126 VCPU_TP_PRINTK("%s", "fault in sie instruction")
129 TRACE_EVENT(kvm_s390_sie_exit,
130 TP_PROTO(VCPU_PROTO_COMMON, u8 icptcode),
131 TP_ARGS(VCPU_ARGS_COMMON, icptcode),
133 TP_STRUCT__entry(
134 VCPU_FIELD_COMMON
135 __field(u8, icptcode)
138 TP_fast_assign(
139 VCPU_ASSIGN_COMMON
140 __entry->icptcode = icptcode;
143 VCPU_TP_PRINTK("exit sie icptcode %d (%s)", __entry->icptcode,
144 __print_symbolic(__entry->icptcode,
145 sie_intercept_code))
149 * Trace point for intercepted instructions.
151 TRACE_EVENT(kvm_s390_intercept_instruction,
152 TP_PROTO(VCPU_PROTO_COMMON, __u16 ipa, __u32 ipb),
153 TP_ARGS(VCPU_ARGS_COMMON, ipa, ipb),
155 TP_STRUCT__entry(
156 VCPU_FIELD_COMMON
157 __field(__u64, instruction)
160 TP_fast_assign(
161 VCPU_ASSIGN_COMMON
162 __entry->instruction = ((__u64)ipa << 48) |
163 ((__u64)ipb << 16);
166 VCPU_TP_PRINTK("intercepted instruction %016llx (%s)",
167 __entry->instruction,
168 __print_symbolic(icpt_insn_decoder(__entry->instruction),
169 icpt_insn_codes))
173 * Trace point for intercepted program interruptions.
175 TRACE_EVENT(kvm_s390_intercept_prog,
176 TP_PROTO(VCPU_PROTO_COMMON, __u16 code),
177 TP_ARGS(VCPU_ARGS_COMMON, code),
179 TP_STRUCT__entry(
180 VCPU_FIELD_COMMON
181 __field(__u16, code)
184 TP_fast_assign(
185 VCPU_ASSIGN_COMMON
186 __entry->code = code;
189 VCPU_TP_PRINTK("intercepted program interruption %04x (%s)",
190 __entry->code,
191 __print_symbolic(__entry->code,
192 icpt_prog_codes))
196 * Trace point for validity intercepts.
198 TRACE_EVENT(kvm_s390_intercept_validity,
199 TP_PROTO(VCPU_PROTO_COMMON, __u16 viwhy),
200 TP_ARGS(VCPU_ARGS_COMMON, viwhy),
202 TP_STRUCT__entry(
203 VCPU_FIELD_COMMON
204 __field(__u16, viwhy)
207 TP_fast_assign(
208 VCPU_ASSIGN_COMMON
209 __entry->viwhy = viwhy;
212 VCPU_TP_PRINTK("got validity intercept %04x", __entry->viwhy)
216 * Trace points for instructions that are of special interest.
219 TRACE_EVENT(kvm_s390_handle_sigp,
220 TP_PROTO(VCPU_PROTO_COMMON, __u8 order_code, __u16 cpu_addr, \
221 __u32 parameter),
222 TP_ARGS(VCPU_ARGS_COMMON, order_code, cpu_addr, parameter),
224 TP_STRUCT__entry(
225 VCPU_FIELD_COMMON
226 __field(__u8, order_code)
227 __field(__u16, cpu_addr)
228 __field(__u32, parameter)
231 TP_fast_assign(
232 VCPU_ASSIGN_COMMON
233 __entry->order_code = order_code;
234 __entry->cpu_addr = cpu_addr;
235 __entry->parameter = parameter;
238 VCPU_TP_PRINTK("handle sigp order %02x (%s), cpu address %04x, " \
239 "parameter %08x", __entry->order_code,
240 __print_symbolic(__entry->order_code,
241 sigp_order_codes),
242 __entry->cpu_addr, __entry->parameter)
245 TRACE_EVENT(kvm_s390_handle_sigp_pei,
246 TP_PROTO(VCPU_PROTO_COMMON, __u8 order_code, __u16 cpu_addr),
247 TP_ARGS(VCPU_ARGS_COMMON, order_code, cpu_addr),
249 TP_STRUCT__entry(
250 VCPU_FIELD_COMMON
251 __field(__u8, order_code)
252 __field(__u16, cpu_addr)
255 TP_fast_assign(
256 VCPU_ASSIGN_COMMON
257 __entry->order_code = order_code;
258 __entry->cpu_addr = cpu_addr;
261 VCPU_TP_PRINTK("handle sigp pei order %02x (%s), cpu address %04x",
262 __entry->order_code,
263 __print_symbolic(__entry->order_code,
264 sigp_order_codes),
265 __entry->cpu_addr)
268 TRACE_EVENT(kvm_s390_handle_diag,
269 TP_PROTO(VCPU_PROTO_COMMON, __u16 code),
270 TP_ARGS(VCPU_ARGS_COMMON, code),
272 TP_STRUCT__entry(
273 VCPU_FIELD_COMMON
274 __field(__u16, code)
277 TP_fast_assign(
278 VCPU_ASSIGN_COMMON
279 __entry->code = code;
282 VCPU_TP_PRINTK("handle diagnose call %04x (%s)", __entry->code,
283 __print_symbolic(__entry->code, diagnose_codes))
286 TRACE_EVENT(kvm_s390_handle_lctl,
287 TP_PROTO(VCPU_PROTO_COMMON, int g, int reg1, int reg3, u64 addr),
288 TP_ARGS(VCPU_ARGS_COMMON, g, reg1, reg3, addr),
290 TP_STRUCT__entry(
291 VCPU_FIELD_COMMON
292 __field(int, g)
293 __field(int, reg1)
294 __field(int, reg3)
295 __field(u64, addr)
298 TP_fast_assign(
299 VCPU_ASSIGN_COMMON
300 __entry->g = g;
301 __entry->reg1 = reg1;
302 __entry->reg3 = reg3;
303 __entry->addr = addr;
306 VCPU_TP_PRINTK("%s: loading cr %x-%x from %016llx",
307 __entry->g ? "lctlg" : "lctl",
308 __entry->reg1, __entry->reg3, __entry->addr)
311 TRACE_EVENT(kvm_s390_handle_stctl,
312 TP_PROTO(VCPU_PROTO_COMMON, int g, int reg1, int reg3, u64 addr),
313 TP_ARGS(VCPU_ARGS_COMMON, g, reg1, reg3, addr),
315 TP_STRUCT__entry(
316 VCPU_FIELD_COMMON
317 __field(int, g)
318 __field(int, reg1)
319 __field(int, reg3)
320 __field(u64, addr)
323 TP_fast_assign(
324 VCPU_ASSIGN_COMMON
325 __entry->g = g;
326 __entry->reg1 = reg1;
327 __entry->reg3 = reg3;
328 __entry->addr = addr;
331 VCPU_TP_PRINTK("%s: storing cr %x-%x to %016llx",
332 __entry->g ? "stctg" : "stctl",
333 __entry->reg1, __entry->reg3, __entry->addr)
336 TRACE_EVENT(kvm_s390_handle_prefix,
337 TP_PROTO(VCPU_PROTO_COMMON, int set, u32 address),
338 TP_ARGS(VCPU_ARGS_COMMON, set, address),
340 TP_STRUCT__entry(
341 VCPU_FIELD_COMMON
342 __field(int, set)
343 __field(u32, address)
346 TP_fast_assign(
347 VCPU_ASSIGN_COMMON
348 __entry->set = set;
349 __entry->address = address;
352 VCPU_TP_PRINTK("%s prefix to %08x",
353 __entry->set ? "setting" : "storing",
354 __entry->address)
357 TRACE_EVENT(kvm_s390_handle_stap,
358 TP_PROTO(VCPU_PROTO_COMMON, u64 address),
359 TP_ARGS(VCPU_ARGS_COMMON, address),
361 TP_STRUCT__entry(
362 VCPU_FIELD_COMMON
363 __field(u64, address)
366 TP_fast_assign(
367 VCPU_ASSIGN_COMMON
368 __entry->address = address;
371 VCPU_TP_PRINTK("storing cpu address to %016llx",
372 __entry->address)
375 TRACE_EVENT(kvm_s390_handle_stfl,
376 TP_PROTO(VCPU_PROTO_COMMON, unsigned int facility_list),
377 TP_ARGS(VCPU_ARGS_COMMON, facility_list),
379 TP_STRUCT__entry(
380 VCPU_FIELD_COMMON
381 __field(unsigned int, facility_list)
384 TP_fast_assign(
385 VCPU_ASSIGN_COMMON
386 __entry->facility_list = facility_list;
389 VCPU_TP_PRINTK("store facility list value %08x",
390 __entry->facility_list)
393 TRACE_EVENT(kvm_s390_handle_stsi,
394 TP_PROTO(VCPU_PROTO_COMMON, int fc, int sel1, int sel2, u64 addr),
395 TP_ARGS(VCPU_ARGS_COMMON, fc, sel1, sel2, addr),
397 TP_STRUCT__entry(
398 VCPU_FIELD_COMMON
399 __field(int, fc)
400 __field(int, sel1)
401 __field(int, sel2)
402 __field(u64, addr)
405 TP_fast_assign(
406 VCPU_ASSIGN_COMMON
407 __entry->fc = fc;
408 __entry->sel1 = sel1;
409 __entry->sel2 = sel2;
410 __entry->addr = addr;
413 VCPU_TP_PRINTK("STSI %d.%d.%d information stored to %016llx",
414 __entry->fc, __entry->sel1, __entry->sel2,
415 __entry->addr)
418 TRACE_EVENT(kvm_s390_handle_operexc,
419 TP_PROTO(VCPU_PROTO_COMMON, __u16 ipa, __u32 ipb),
420 TP_ARGS(VCPU_ARGS_COMMON, ipa, ipb),
422 TP_STRUCT__entry(
423 VCPU_FIELD_COMMON
424 __field(__u64, instruction)
427 TP_fast_assign(
428 VCPU_ASSIGN_COMMON
429 __entry->instruction = ((__u64)ipa << 48) |
430 ((__u64)ipb << 16);
433 VCPU_TP_PRINTK("operation exception on instruction %016llx (%s)",
434 __entry->instruction,
435 __print_symbolic(icpt_insn_decoder(__entry->instruction),
436 icpt_insn_codes))
439 TRACE_EVENT(kvm_s390_handle_sthyi,
440 TP_PROTO(VCPU_PROTO_COMMON, u64 code, u64 addr),
441 TP_ARGS(VCPU_ARGS_COMMON, code, addr),
443 TP_STRUCT__entry(
444 VCPU_FIELD_COMMON
445 __field(u64, code)
446 __field(u64, addr)
449 TP_fast_assign(
450 VCPU_ASSIGN_COMMON
451 __entry->code = code;
452 __entry->addr = addr;
455 VCPU_TP_PRINTK("STHYI fc: %llu addr: %016llx",
456 __entry->code, __entry->addr)
459 #endif /* _TRACE_KVM_H */
461 /* This part must be outside protection */
462 #include <trace/define_trace.h>