1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
5 #include <linux/tracepoint.h>
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; \
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
),
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
),
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
),
68 __field(long, pfault_token
)
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
),
84 __field(long, pfault_token
)
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
),
103 __field(int, cpuflags
)
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
),
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
),
135 __field(u8
, icptcode
)
140 __entry
->icptcode
= icptcode
;
143 VCPU_TP_PRINTK("exit sie icptcode %d (%s)", __entry
->icptcode
,
144 __print_symbolic(__entry
->icptcode
,
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
),
157 __field(__u64
, instruction
)
162 __entry
->instruction
= ((__u64
)ipa
<< 48) |
166 VCPU_TP_PRINTK("intercepted instruction %016llx (%s)",
167 __entry
->instruction
,
168 __print_symbolic(icpt_insn_decoder(__entry
->instruction
),
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
),
186 __entry
->code
= code
;
189 VCPU_TP_PRINTK("intercepted program interruption %04x (%s)",
191 __print_symbolic(__entry
->code
,
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
),
204 __field(__u16
, viwhy
)
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
, \
222 TP_ARGS(VCPU_ARGS_COMMON
, order_code
, cpu_addr
, parameter
),
226 __field(__u8
, order_code
)
227 __field(__u16
, cpu_addr
)
228 __field(__u32
, parameter
)
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
,
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
),
251 __field(__u8
, order_code
)
252 __field(__u16
, cpu_addr
)
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",
263 __print_symbolic(__entry
->order_code
,
268 TRACE_EVENT(kvm_s390_handle_diag
,
269 TP_PROTO(VCPU_PROTO_COMMON
, __u16 code
),
270 TP_ARGS(VCPU_ARGS_COMMON
, code
),
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
),
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
),
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
),
343 __field(u32
, address
)
349 __entry
->address
= address
;
352 VCPU_TP_PRINTK("%s prefix to %08x",
353 __entry
->set
? "setting" : "storing",
357 TRACE_EVENT(kvm_s390_handle_stap
,
358 TP_PROTO(VCPU_PROTO_COMMON
, u64 address
),
359 TP_ARGS(VCPU_ARGS_COMMON
, address
),
363 __field(u64
, address
)
368 __entry
->address
= address
;
371 VCPU_TP_PRINTK("storing cpu address to %016llx",
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
),
381 __field(unsigned int, facility_list
)
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
),
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
,
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
),
424 __field(__u64
, instruction
)
429 __entry
->instruction
= ((__u64
)ipa
<< 48) |
433 VCPU_TP_PRINTK("operation exception on instruction %016llx (%s)",
434 __entry
->instruction
,
435 __print_symbolic(icpt_insn_decoder(__entry
->instruction
),
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
),
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>