Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux/fpc-iii.git] / arch / s390 / kvm / trace.h
blob3db76b2daed7d274ba9d1110b568223ba2df8489
1 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
2 #define _TRACE_KVM_H
4 #include <linux/tracepoint.h>
5 #include <asm/sigp.h>
6 #include <asm/debug.h>
7 #include <asm/dis.h>
9 #undef TRACE_SYSTEM
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; \
28 } while (0);
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),
40 TP_STRUCT__entry(
41 VCPU_FIELD_COMMON
42 __field(int, cpuflags)
45 TP_fast_assign(
46 VCPU_ASSIGN_COMMON
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),
57 TP_STRUCT__entry(
58 VCPU_FIELD_COMMON
61 TP_fast_assign(
62 VCPU_ASSIGN_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"}, \
76 {0x20, "Validity"}, \
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),
83 TP_STRUCT__entry(
84 VCPU_FIELD_COMMON
85 __field(u8, icptcode)
88 TP_fast_assign(
89 VCPU_ASSIGN_COMMON
90 __entry->icptcode = icptcode;
93 VCPU_TP_PRINTK("exit sie icptcode %d (%s)", __entry->icptcode,
94 __print_symbolic(__entry->icptcode,
95 sie_intercept_code))
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),
105 TP_STRUCT__entry(
106 VCPU_FIELD_COMMON
107 __field(__u64, instruction)
108 __field(char, insn[8])
111 TP_fast_assign(
112 VCPU_ASSIGN_COMMON
113 __entry->instruction = ((__u64)ipa << 48) |
114 ((__u64)ipb << 16);
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),
132 TP_STRUCT__entry(
133 VCPU_FIELD_COMMON
134 __field(__u16, code)
137 TP_fast_assign(
138 VCPU_ASSIGN_COMMON
139 __entry->code = code;
142 VCPU_TP_PRINTK("intercepted program interruption %04x",
143 __entry->code)
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),
153 TP_STRUCT__entry(
154 VCPU_FIELD_COMMON
155 __field(__u16, viwhy)
158 TP_fast_assign(
159 VCPU_ASSIGN_COMMON
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, \
184 __u32 parameter),
185 TP_ARGS(VCPU_ARGS_COMMON, order_code, cpu_addr, parameter),
187 TP_STRUCT__entry(
188 VCPU_FIELD_COMMON
189 __field(__u8, order_code)
190 __field(__u16, cpu_addr)
191 __field(__u32, parameter)
194 TP_fast_assign(
195 VCPU_ASSIGN_COMMON
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,
204 sigp_order_codes),
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),
219 TP_STRUCT__entry(
220 VCPU_FIELD_COMMON
221 __field(__u16, code)
224 TP_fast_assign(
225 VCPU_ASSIGN_COMMON
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),
237 TP_STRUCT__entry(
238 VCPU_FIELD_COMMON
239 __field(int, g)
240 __field(int, reg1)
241 __field(int, reg3)
242 __field(u64, addr)
245 TP_fast_assign(
246 VCPU_ASSIGN_COMMON
247 __entry->g = g;
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),
262 TP_STRUCT__entry(
263 VCPU_FIELD_COMMON
264 __field(int, set)
265 __field(u32, address)
268 TP_fast_assign(
269 VCPU_ASSIGN_COMMON
270 __entry->set = set;
271 __entry->address = address;
274 VCPU_TP_PRINTK("%s prefix to %08x",
275 __entry->set ? "setting" : "storing",
276 __entry->address)
279 TRACE_EVENT(kvm_s390_handle_stap,
280 TP_PROTO(VCPU_PROTO_COMMON, u64 address),
281 TP_ARGS(VCPU_ARGS_COMMON, address),
283 TP_STRUCT__entry(
284 VCPU_FIELD_COMMON
285 __field(u64, address)
288 TP_fast_assign(
289 VCPU_ASSIGN_COMMON
290 __entry->address = address;
293 VCPU_TP_PRINTK("storing cpu address to %016llx",
294 __entry->address)
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),
301 TP_STRUCT__entry(
302 VCPU_FIELD_COMMON
303 __field(unsigned int, facility_list)
306 TP_fast_assign(
307 VCPU_ASSIGN_COMMON
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),
319 TP_STRUCT__entry(
320 VCPU_FIELD_COMMON
321 __field(int, fc)
322 __field(int, sel1)
323 __field(int, sel2)
324 __field(u64, addr)
327 TP_fast_assign(
328 VCPU_ASSIGN_COMMON
329 __entry->fc = fc;
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,
337 __entry->addr)
340 #endif /* _TRACE_KVM_H */
342 /* This part must be outside protection */
343 #include <trace/define_trace.h>