1 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
4 #include <linux/tracepoint.h>
9 #define TRACE_SYSTEM kvm
10 #define TRACE_INCLUDE_PATH .
11 #undef TRACE_INCLUDE_FILE
12 #define TRACE_INCLUDE_FILE trace
15 * Helpers for vcpu-specific tracepoints containing the same information
16 * as s390dbf VCPU_EVENTs.
18 #define VCPU_PROTO_COMMON struct kvm_vcpu *vcpu
19 #define VCPU_ARGS_COMMON vcpu
20 #define VCPU_FIELD_COMMON __field(int, id) \
21 __field(unsigned long, pswmask) \
22 __field(unsigned long, pswaddr)
23 #define VCPU_ASSIGN_COMMON do { \
24 __entry->id = vcpu->vcpu_id; \
25 __entry->pswmask = vcpu->arch.sie_block->gpsw.mask; \
26 __entry->pswaddr = vcpu->arch.sie_block->gpsw.addr; \
28 #define VCPU_TP_PRINTK(p_str, p_args...) \
29 TP_printk("%02d[%016lx-%016lx]: " p_str, __entry->id, \
30 __entry->pswmask, __entry->pswaddr, p_args)
33 * Tracepoints for SIE entry and exit.
35 TRACE_EVENT(kvm_s390_sie_enter
,
36 TP_PROTO(VCPU_PROTO_COMMON
, int cpuflags
),
37 TP_ARGS(VCPU_ARGS_COMMON
, cpuflags
),
41 __field(int, cpuflags
)
46 __entry
->cpuflags
= cpuflags
;
49 VCPU_TP_PRINTK("entering sie flags %x", __entry
->cpuflags
)
52 TRACE_EVENT(kvm_s390_sie_fault
,
53 TP_PROTO(VCPU_PROTO_COMMON
),
54 TP_ARGS(VCPU_ARGS_COMMON
),
64 VCPU_TP_PRINTK("%s", "fault in sie instruction")
67 #define sie_intercept_code \
68 {0x04, "Instruction"}, \
69 {0x08, "Program interruption"}, \
70 {0x0C, "Instruction and program interruption"}, \
71 {0x10, "External request"}, \
72 {0x14, "External interruption"}, \
73 {0x18, "I/O request"}, \
74 {0x1C, "Wait state"}, \
76 {0x28, "Stop request"}
78 TRACE_EVENT(kvm_s390_sie_exit
,
79 TP_PROTO(VCPU_PROTO_COMMON
, u8 icptcode
),
80 TP_ARGS(VCPU_ARGS_COMMON
, icptcode
),
89 __entry
->icptcode
= icptcode
;
92 VCPU_TP_PRINTK("exit sie icptcode %d (%s)", __entry
->icptcode
,
93 __print_symbolic(__entry
->icptcode
,
98 * Trace point for intercepted instructions.
100 TRACE_EVENT(kvm_s390_intercept_instruction
,
101 TP_PROTO(VCPU_PROTO_COMMON
, __u16 ipa
, __u32 ipb
),
102 TP_ARGS(VCPU_ARGS_COMMON
, ipa
, ipb
),
106 __field(__u64
, instruction
)
107 __field(char, insn
[8])
112 __entry
->instruction
= ((__u64
)ipa
<< 48) |
116 VCPU_TP_PRINTK("intercepted instruction %016llx (%s)",
117 __entry
->instruction
,
118 insn_to_mnemonic((unsigned char *)
119 &__entry
->instruction
,
120 __entry
->insn
, sizeof(__entry
->insn
)) ?
121 "unknown" : __entry
->insn
)
125 * Trace point for intercepted program interruptions.
127 TRACE_EVENT(kvm_s390_intercept_prog
,
128 TP_PROTO(VCPU_PROTO_COMMON
, __u16 code
),
129 TP_ARGS(VCPU_ARGS_COMMON
, code
),
138 __entry
->code
= code
;
141 VCPU_TP_PRINTK("intercepted program interruption %04x",
146 * Trace point for validity intercepts.
148 TRACE_EVENT(kvm_s390_intercept_validity
,
149 TP_PROTO(VCPU_PROTO_COMMON
, __u16 viwhy
),
150 TP_ARGS(VCPU_ARGS_COMMON
, viwhy
),
154 __field(__u16
, viwhy
)
159 __entry
->viwhy
= viwhy
;
162 VCPU_TP_PRINTK("got validity intercept %04x", __entry
->viwhy
)
166 * Trace points for instructions that are of special interest.
169 #define sigp_order_codes \
170 {SIGP_SENSE, "sense"}, \
171 {SIGP_EXTERNAL_CALL, "external call"}, \
172 {SIGP_EMERGENCY_SIGNAL, "emergency signal"}, \
173 {SIGP_STOP, "stop"}, \
174 {SIGP_STOP_AND_STORE_STATUS, "stop and store status"}, \
175 {SIGP_SET_ARCHITECTURE, "set architecture"}, \
176 {SIGP_SET_PREFIX, "set prefix"}, \
177 {SIGP_SENSE_RUNNING, "sense running"}, \
178 {SIGP_RESTART, "restart"}
180 TRACE_EVENT(kvm_s390_handle_sigp
,
181 TP_PROTO(VCPU_PROTO_COMMON
, __u8 order_code
, __u16 cpu_addr
, \
183 TP_ARGS(VCPU_ARGS_COMMON
, order_code
, cpu_addr
, parameter
),
187 __field(__u8
, order_code
)
188 __field(__u16
, cpu_addr
)
189 __field(__u32
, parameter
)
194 __entry
->order_code
= order_code
;
195 __entry
->cpu_addr
= cpu_addr
;
196 __entry
->parameter
= parameter
;
199 VCPU_TP_PRINTK("handle sigp order %02x (%s), cpu address %04x, " \
200 "parameter %08x", __entry
->order_code
,
201 __print_symbolic(__entry
->order_code
,
203 __entry
->cpu_addr
, __entry
->parameter
)
206 #define diagnose_codes \
207 {0x10, "release pages"}, \
208 {0x44, "time slice end"}, \
209 {0x308, "ipl functions"}, \
210 {0x500, "kvm hypercall"}, \
211 {0x501, "kvm breakpoint"}
213 TRACE_EVENT(kvm_s390_handle_diag
,
214 TP_PROTO(VCPU_PROTO_COMMON
, __u16 code
),
215 TP_ARGS(VCPU_ARGS_COMMON
, code
),
224 __entry
->code
= code
;
227 VCPU_TP_PRINTK("handle diagnose call %04x (%s)", __entry
->code
,
228 __print_symbolic(__entry
->code
, diagnose_codes
))
231 TRACE_EVENT(kvm_s390_handle_lctl
,
232 TP_PROTO(VCPU_PROTO_COMMON
, int g
, int reg1
, int reg3
, u64 addr
),
233 TP_ARGS(VCPU_ARGS_COMMON
, g
, reg1
, reg3
, addr
),
246 __entry
->reg1
= reg1
;
247 __entry
->reg3
= reg3
;
248 __entry
->addr
= addr
;
251 VCPU_TP_PRINTK("%s: loading cr %x-%x from %016llx",
252 __entry
->g
? "lctlg" : "lctl",
253 __entry
->reg1
, __entry
->reg3
, __entry
->addr
)
256 TRACE_EVENT(kvm_s390_handle_prefix
,
257 TP_PROTO(VCPU_PROTO_COMMON
, int set
, u32 address
),
258 TP_ARGS(VCPU_ARGS_COMMON
, set
, address
),
263 __field(u32
, address
)
269 __entry
->address
= address
;
272 VCPU_TP_PRINTK("%s prefix to %08x",
273 __entry
->set
? "setting" : "storing",
277 TRACE_EVENT(kvm_s390_handle_stap
,
278 TP_PROTO(VCPU_PROTO_COMMON
, u64 address
),
279 TP_ARGS(VCPU_ARGS_COMMON
, address
),
283 __field(u64
, address
)
288 __entry
->address
= address
;
291 VCPU_TP_PRINTK("storing cpu address to %016llx",
295 TRACE_EVENT(kvm_s390_handle_stfl
,
296 TP_PROTO(VCPU_PROTO_COMMON
, unsigned int facility_list
),
297 TP_ARGS(VCPU_ARGS_COMMON
, facility_list
),
301 __field(unsigned int, facility_list
)
306 __entry
->facility_list
= facility_list
;
309 VCPU_TP_PRINTK("store facility list value %08x",
310 __entry
->facility_list
)
313 TRACE_EVENT(kvm_s390_handle_stsi
,
314 TP_PROTO(VCPU_PROTO_COMMON
, int fc
, int sel1
, int sel2
, u64 addr
),
315 TP_ARGS(VCPU_ARGS_COMMON
, fc
, sel1
, sel2
, addr
),
328 __entry
->sel1
= sel1
;
329 __entry
->sel2
= sel2
;
330 __entry
->addr
= addr
;
333 VCPU_TP_PRINTK("STSI %d.%d.%d information stored to %016llx",
334 __entry
->fc
, __entry
->sel1
, __entry
->sel2
,
338 #endif /* _TRACE_KVM_H */
340 /* This part must be outside protection */
341 #include <trace/define_trace.h>