1 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
4 #include <linux/tracepoint.h>
10 #define TRACE_SYSTEM kvm
11 #define TRACE_INCLUDE_PATH .
12 #undef TRACE_INCLUDE_FILE
13 #define TRACE_INCLUDE_FILE trace
16 * Helpers for vcpu-specific tracepoints containing the same information
17 * as s390dbf VCPU_EVENTs.
19 #define VCPU_PROTO_COMMON struct kvm_vcpu *vcpu
20 #define VCPU_ARGS_COMMON vcpu
21 #define VCPU_FIELD_COMMON __field(int, id) \
22 __field(unsigned long, pswmask) \
23 __field(unsigned long, pswaddr)
24 #define VCPU_ASSIGN_COMMON do { \
25 __entry->id = vcpu->vcpu_id; \
26 __entry->pswmask = vcpu->arch.sie_block->gpsw.mask; \
27 __entry->pswaddr = vcpu->arch.sie_block->gpsw.addr; \
29 #define VCPU_TP_PRINTK(p_str, p_args...) \
30 TP_printk("%02d[%016lx-%016lx]: " p_str, __entry->id, \
31 __entry->pswmask, __entry->pswaddr, p_args)
34 * Tracepoints for SIE entry and exit.
36 TRACE_EVENT(kvm_s390_sie_enter
,
37 TP_PROTO(VCPU_PROTO_COMMON
, int cpuflags
),
38 TP_ARGS(VCPU_ARGS_COMMON
, cpuflags
),
42 __field(int, cpuflags
)
47 __entry
->cpuflags
= cpuflags
;
50 VCPU_TP_PRINTK("entering sie flags %x", __entry
->cpuflags
)
53 TRACE_EVENT(kvm_s390_sie_fault
,
54 TP_PROTO(VCPU_PROTO_COMMON
),
55 TP_ARGS(VCPU_ARGS_COMMON
),
65 VCPU_TP_PRINTK("%s", "fault in sie instruction")
68 #define sie_intercept_code \
69 {0x04, "Instruction"}, \
70 {0x08, "Program interruption"}, \
71 {0x0C, "Instruction and program interruption"}, \
72 {0x10, "External request"}, \
73 {0x14, "External interruption"}, \
74 {0x18, "I/O request"}, \
75 {0x1C, "Wait state"}, \
77 {0x28, "Stop request"}
79 TRACE_EVENT(kvm_s390_sie_exit
,
80 TP_PROTO(VCPU_PROTO_COMMON
, u8 icptcode
),
81 TP_ARGS(VCPU_ARGS_COMMON
, icptcode
),
90 __entry
->icptcode
= icptcode
;
93 VCPU_TP_PRINTK("exit sie icptcode %d (%s)", __entry
->icptcode
,
94 __print_symbolic(__entry
->icptcode
,
99 * Trace point for intercepted instructions.
101 TRACE_EVENT(kvm_s390_intercept_instruction
,
102 TP_PROTO(VCPU_PROTO_COMMON
, __u16 ipa
, __u32 ipb
),
103 TP_ARGS(VCPU_ARGS_COMMON
, ipa
, ipb
),
107 __field(__u64
, instruction
)
108 __field(char, insn
[8])
113 __entry
->instruction
= ((__u64
)ipa
<< 48) |
117 VCPU_TP_PRINTK("intercepted instruction %016llx (%s)",
118 __entry
->instruction
,
119 insn_to_mnemonic((unsigned char *)
120 &__entry
->instruction
,
121 __entry
->insn
, sizeof(__entry
->insn
)) ?
122 "unknown" : __entry
->insn
)
126 * Trace point for intercepted program interruptions.
128 TRACE_EVENT(kvm_s390_intercept_prog
,
129 TP_PROTO(VCPU_PROTO_COMMON
, __u16 code
),
130 TP_ARGS(VCPU_ARGS_COMMON
, code
),
139 __entry
->code
= code
;
142 VCPU_TP_PRINTK("intercepted program interruption %04x",
147 * Trace point for validity intercepts.
149 TRACE_EVENT(kvm_s390_intercept_validity
,
150 TP_PROTO(VCPU_PROTO_COMMON
, __u16 viwhy
),
151 TP_ARGS(VCPU_ARGS_COMMON
, viwhy
),
155 __field(__u16
, viwhy
)
160 __entry
->viwhy
= viwhy
;
163 VCPU_TP_PRINTK("got validity intercept %04x", __entry
->viwhy
)
167 * Trace points for instructions that are of special interest.
170 #define sigp_order_codes \
171 {SIGP_SENSE, "sense"}, \
172 {SIGP_EXTERNAL_CALL, "external call"}, \
173 {SIGP_EMERGENCY_SIGNAL, "emergency signal"}, \
174 {SIGP_STOP, "stop"}, \
175 {SIGP_STOP_AND_STORE_STATUS, "stop and store status"}, \
176 {SIGP_SET_ARCHITECTURE, "set architecture"}, \
177 {SIGP_SET_PREFIX, "set prefix"}, \
178 {SIGP_STORE_STATUS_AT_ADDRESS, "store status at addr"}, \
179 {SIGP_SENSE_RUNNING, "sense running"}, \
180 {SIGP_RESTART, "restart"}
182 TRACE_EVENT(kvm_s390_handle_sigp
,
183 TP_PROTO(VCPU_PROTO_COMMON
, __u8 order_code
, __u16 cpu_addr
, \
185 TP_ARGS(VCPU_ARGS_COMMON
, order_code
, cpu_addr
, parameter
),
189 __field(__u8
, order_code
)
190 __field(__u16
, cpu_addr
)
191 __field(__u32
, parameter
)
196 __entry
->order_code
= order_code
;
197 __entry
->cpu_addr
= cpu_addr
;
198 __entry
->parameter
= parameter
;
201 VCPU_TP_PRINTK("handle sigp order %02x (%s), cpu address %04x, " \
202 "parameter %08x", __entry
->order_code
,
203 __print_symbolic(__entry
->order_code
,
205 __entry
->cpu_addr
, __entry
->parameter
)
208 #define diagnose_codes \
209 {0x10, "release pages"}, \
210 {0x44, "time slice end"}, \
211 {0x308, "ipl functions"}, \
212 {0x500, "kvm hypercall"}, \
213 {0x501, "kvm breakpoint"}
215 TRACE_EVENT(kvm_s390_handle_diag
,
216 TP_PROTO(VCPU_PROTO_COMMON
, __u16 code
),
217 TP_ARGS(VCPU_ARGS_COMMON
, code
),
226 __entry
->code
= code
;
229 VCPU_TP_PRINTK("handle diagnose call %04x (%s)", __entry
->code
,
230 __print_symbolic(__entry
->code
, diagnose_codes
))
233 TRACE_EVENT(kvm_s390_handle_lctl
,
234 TP_PROTO(VCPU_PROTO_COMMON
, int g
, int reg1
, int reg3
, u64 addr
),
235 TP_ARGS(VCPU_ARGS_COMMON
, g
, reg1
, reg3
, addr
),
248 __entry
->reg1
= reg1
;
249 __entry
->reg3
= reg3
;
250 __entry
->addr
= addr
;
253 VCPU_TP_PRINTK("%s: loading cr %x-%x from %016llx",
254 __entry
->g
? "lctlg" : "lctl",
255 __entry
->reg1
, __entry
->reg3
, __entry
->addr
)
258 TRACE_EVENT(kvm_s390_handle_prefix
,
259 TP_PROTO(VCPU_PROTO_COMMON
, int set
, u32 address
),
260 TP_ARGS(VCPU_ARGS_COMMON
, set
, address
),
265 __field(u32
, address
)
271 __entry
->address
= address
;
274 VCPU_TP_PRINTK("%s prefix to %08x",
275 __entry
->set
? "setting" : "storing",
279 TRACE_EVENT(kvm_s390_handle_stap
,
280 TP_PROTO(VCPU_PROTO_COMMON
, u64 address
),
281 TP_ARGS(VCPU_ARGS_COMMON
, address
),
285 __field(u64
, address
)
290 __entry
->address
= address
;
293 VCPU_TP_PRINTK("storing cpu address to %016llx",
297 TRACE_EVENT(kvm_s390_handle_stfl
,
298 TP_PROTO(VCPU_PROTO_COMMON
, unsigned int facility_list
),
299 TP_ARGS(VCPU_ARGS_COMMON
, facility_list
),
303 __field(unsigned int, facility_list
)
308 __entry
->facility_list
= facility_list
;
311 VCPU_TP_PRINTK("store facility list value %08x",
312 __entry
->facility_list
)
315 TRACE_EVENT(kvm_s390_handle_stsi
,
316 TP_PROTO(VCPU_PROTO_COMMON
, int fc
, int sel1
, int sel2
, u64 addr
),
317 TP_ARGS(VCPU_ARGS_COMMON
, fc
, sel1
, sel2
, addr
),
330 __entry
->sel1
= sel1
;
331 __entry
->sel2
= sel2
;
332 __entry
->addr
= addr
;
335 VCPU_TP_PRINTK("STSI %d.%d.%d information stored to %016llx",
336 __entry
->fc
, __entry
->sel1
, __entry
->sel2
,
340 #endif /* _TRACE_KVM_H */
342 /* This part must be outside protection */
343 #include <trace/define_trace.h>