blob: cc1d6c68356fc3ede1cb2dd22cc6781f83c8288b [file] [log] [blame]
Cornelia Huckade38c32012-07-23 17:20:30 +02001#if !defined(_TRACE_KVMS390_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_KVMS390_H
3
4#include <linux/tracepoint.h>
5
6#undef TRACE_SYSTEM
7#define TRACE_SYSTEM kvm-s390
8#define TRACE_INCLUDE_PATH .
9#undef TRACE_INCLUDE_FILE
10#define TRACE_INCLUDE_FILE trace-s390
11
12/*
Steven Rostedt (Red Hat)bd412022015-04-01 14:19:06 -040013 * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a
14 * legitimate C variable. It is not exported to user space.
15 */
16#undef TRACE_SYSTEM_VAR
17#define TRACE_SYSTEM_VAR kvm_s390
18
19/*
Cornelia Huckade38c32012-07-23 17:20:30 +020020 * Trace point for the creation of the kvm instance.
21 */
22TRACE_EVENT(kvm_s390_create_vm,
23 TP_PROTO(unsigned long type),
24 TP_ARGS(type),
25
26 TP_STRUCT__entry(
27 __field(unsigned long, type)
28 ),
29
30 TP_fast_assign(
31 __entry->type = type;
32 ),
33
34 TP_printk("create vm%s",
35 __entry->type & KVM_VM_S390_UCONTROL ? " (UCONTROL)" : "")
36 );
37
38/*
39 * Trace points for creation and destruction of vpcus.
40 */
41TRACE_EVENT(kvm_s390_create_vcpu,
42 TP_PROTO(unsigned int id, struct kvm_vcpu *vcpu,
43 struct kvm_s390_sie_block *sie_block),
44 TP_ARGS(id, vcpu, sie_block),
45
46 TP_STRUCT__entry(
47 __field(unsigned int, id)
48 __field(struct kvm_vcpu *, vcpu)
49 __field(struct kvm_s390_sie_block *, sie_block)
50 ),
51
52 TP_fast_assign(
53 __entry->id = id;
54 __entry->vcpu = vcpu;
55 __entry->sie_block = sie_block;
56 ),
57
58 TP_printk("create cpu %d at %p, sie block at %p", __entry->id,
59 __entry->vcpu, __entry->sie_block)
60 );
61
62TRACE_EVENT(kvm_s390_destroy_vcpu,
63 TP_PROTO(unsigned int id),
64 TP_ARGS(id),
65
66 TP_STRUCT__entry(
67 __field(unsigned int, id)
68 ),
69
70 TP_fast_assign(
71 __entry->id = id;
72 ),
73
74 TP_printk("destroy cpu %d", __entry->id)
75 );
76
77/*
David Hildenbrand6852d7b2014-03-14 10:59:29 +010078 * Trace point for start and stop of vpcus.
79 */
80TRACE_EVENT(kvm_s390_vcpu_start_stop,
81 TP_PROTO(unsigned int id, int state),
82 TP_ARGS(id, state),
83
84 TP_STRUCT__entry(
85 __field(unsigned int, id)
86 __field(int, state)
87 ),
88
89 TP_fast_assign(
90 __entry->id = id;
91 __entry->state = state;
92 ),
93
94 TP_printk("%s cpu %d", __entry->state ? "starting" : "stopping",
95 __entry->id)
96 );
97
98/*
Cornelia Huckade38c32012-07-23 17:20:30 +020099 * Trace points for injection of interrupts, either per machine or
100 * per vcpu.
101 */
102
103#define kvm_s390_int_type \
104 {KVM_S390_SIGP_STOP, "sigp stop"}, \
105 {KVM_S390_PROGRAM_INT, "program interrupt"}, \
106 {KVM_S390_SIGP_SET_PREFIX, "sigp set prefix"}, \
107 {KVM_S390_RESTART, "sigp restart"}, \
David Hildenbranda37281b2014-11-21 13:45:08 +0100108 {KVM_S390_INT_PFAULT_INIT, "pfault init"}, \
109 {KVM_S390_INT_PFAULT_DONE, "pfault done"}, \
110 {KVM_S390_MCHK, "machine check"}, \
111 {KVM_S390_INT_CLOCK_COMP, "clock comparator"}, \
112 {KVM_S390_INT_CPU_TIMER, "cpu timer"}, \
Cornelia Huckade38c32012-07-23 17:20:30 +0200113 {KVM_S390_INT_VIRTIO, "virtio interrupt"}, \
114 {KVM_S390_INT_SERVICE, "sclp interrupt"}, \
115 {KVM_S390_INT_EMERGENCY, "sigp emergency"}, \
116 {KVM_S390_INT_EXTERNAL_CALL, "sigp ext call"}
117
David Hildenbranda37281b2014-11-21 13:45:08 +0100118#define get_irq_name(__type) \
119 (__type > KVM_S390_INT_IO_MAX ? \
120 __print_symbolic(__type, kvm_s390_int_type) : \
121 (__type & KVM_S390_INT_IO_AI_MASK ? \
122 "adapter I/O interrupt" : "subchannel I/O interrupt"))
123
Cornelia Huckade38c32012-07-23 17:20:30 +0200124TRACE_EVENT(kvm_s390_inject_vm,
125 TP_PROTO(__u64 type, __u32 parm, __u64 parm64, int who),
126 TP_ARGS(type, parm, parm64, who),
127
128 TP_STRUCT__entry(
129 __field(__u32, inttype)
130 __field(__u32, parm)
131 __field(__u64, parm64)
132 __field(int, who)
133 ),
134
135 TP_fast_assign(
136 __entry->inttype = type & 0x00000000ffffffff;
137 __entry->parm = parm;
138 __entry->parm64 = parm64;
139 __entry->who = who;
140 ),
141
142 TP_printk("inject%s: type:%x (%s) parm:%x parm64:%llx",
143 (__entry->who == 1) ? " (from kernel)" :
144 (__entry->who == 2) ? " (from user)" : "",
David Hildenbranda37281b2014-11-21 13:45:08 +0100145 __entry->inttype, get_irq_name(__entry->inttype),
Cornelia Huckade38c32012-07-23 17:20:30 +0200146 __entry->parm, __entry->parm64)
147 );
148
149TRACE_EVENT(kvm_s390_inject_vcpu,
David Hildenbranded2afcf2015-07-20 10:33:03 +0200150 TP_PROTO(unsigned int id, __u64 type, __u32 parm, __u64 parm64),
151 TP_ARGS(id, type, parm, parm64),
Cornelia Huckade38c32012-07-23 17:20:30 +0200152
153 TP_STRUCT__entry(
154 __field(int, id)
155 __field(__u32, inttype)
156 __field(__u32, parm)
157 __field(__u64, parm64)
Cornelia Huckade38c32012-07-23 17:20:30 +0200158 ),
159
160 TP_fast_assign(
161 __entry->id = id;
162 __entry->inttype = type & 0x00000000ffffffff;
163 __entry->parm = parm;
164 __entry->parm64 = parm64;
Cornelia Huckade38c32012-07-23 17:20:30 +0200165 ),
166
David Hildenbranded2afcf2015-07-20 10:33:03 +0200167 TP_printk("inject (vcpu %d): type:%x (%s) parm:%x parm64:%llx",
Cornelia Huckade38c32012-07-23 17:20:30 +0200168 __entry->id, __entry->inttype,
David Hildenbranda37281b2014-11-21 13:45:08 +0100169 get_irq_name(__entry->inttype), __entry->parm,
170 __entry->parm64)
Cornelia Huckade38c32012-07-23 17:20:30 +0200171 );
172
173/*
174 * Trace point for the actual delivery of interrupts.
175 */
176TRACE_EVENT(kvm_s390_deliver_interrupt,
Cornelia Huck48a3e952012-12-20 15:32:09 +0100177 TP_PROTO(unsigned int id, __u64 type, __u64 data0, __u64 data1),
Cornelia Huckade38c32012-07-23 17:20:30 +0200178 TP_ARGS(id, type, data0, data1),
179
180 TP_STRUCT__entry(
181 __field(int, id)
182 __field(__u32, inttype)
Cornelia Huck48a3e952012-12-20 15:32:09 +0100183 __field(__u64, data0)
Cornelia Huckade38c32012-07-23 17:20:30 +0200184 __field(__u64, data1)
185 ),
186
187 TP_fast_assign(
188 __entry->id = id;
189 __entry->inttype = type & 0x00000000ffffffff;
190 __entry->data0 = data0;
191 __entry->data1 = data1;
192 ),
193
194 TP_printk("deliver interrupt (vcpu %d): type:%x (%s) " \
Cornelia Huck48a3e952012-12-20 15:32:09 +0100195 "data:%08llx %016llx",
Cornelia Huckade38c32012-07-23 17:20:30 +0200196 __entry->id, __entry->inttype,
David Hildenbranda37281b2014-11-21 13:45:08 +0100197 get_irq_name(__entry->inttype), __entry->data0,
198 __entry->data1)
Cornelia Huckade38c32012-07-23 17:20:30 +0200199 );
200
201/*
202 * Trace point for resets that may be requested from userspace.
203 */
204TRACE_EVENT(kvm_s390_request_resets,
205 TP_PROTO(__u64 resets),
206 TP_ARGS(resets),
207
208 TP_STRUCT__entry(
209 __field(__u64, resets)
210 ),
211
212 TP_fast_assign(
213 __entry->resets = resets;
214 ),
215
216 TP_printk("requesting userspace resets %llx",
217 __entry->resets)
218 );
219
220/*
221 * Trace point for a vcpu's stop requests.
222 */
223TRACE_EVENT(kvm_s390_stop_request,
David Hildenbrand6cddd432014-10-15 16:48:53 +0200224 TP_PROTO(unsigned char stop_irq, unsigned char flags),
225 TP_ARGS(stop_irq, flags),
Cornelia Huckade38c32012-07-23 17:20:30 +0200226
227 TP_STRUCT__entry(
David Hildenbrand6cddd432014-10-15 16:48:53 +0200228 __field(unsigned char, stop_irq)
229 __field(unsigned char, flags)
Cornelia Huckade38c32012-07-23 17:20:30 +0200230 ),
231
232 TP_fast_assign(
David Hildenbrand6cddd432014-10-15 16:48:53 +0200233 __entry->stop_irq = stop_irq;
234 __entry->flags = flags;
Cornelia Huckade38c32012-07-23 17:20:30 +0200235 ),
236
David Hildenbrand6cddd432014-10-15 16:48:53 +0200237 TP_printk("stop request, stop irq = %u, flags = %08x",
238 __entry->stop_irq, __entry->flags)
Cornelia Huckade38c32012-07-23 17:20:30 +0200239 );
240
241
Cornelia Huckfa6b7fe2012-12-20 15:32:12 +0100242/*
243 * Trace point for enabling channel I/O instruction support.
244 */
245TRACE_EVENT(kvm_s390_enable_css,
246 TP_PROTO(void *kvm),
247 TP_ARGS(kvm),
248
249 TP_STRUCT__entry(
250 __field(void *, kvm)
251 ),
252
253 TP_fast_assign(
254 __entry->kvm = kvm;
255 ),
256
257 TP_printk("enabling channel I/O support (kvm @ %p)\n",
258 __entry->kvm)
259 );
260
David Hildenbrand8ad35752014-03-14 11:00:21 +0100261/*
262 * Trace point for enabling and disabling interlocking-and-broadcasting
263 * suppression.
264 */
265TRACE_EVENT(kvm_s390_enable_disable_ibs,
266 TP_PROTO(unsigned int id, int state),
267 TP_ARGS(id, state),
268
269 TP_STRUCT__entry(
270 __field(unsigned int, id)
271 __field(int, state)
272 ),
273
274 TP_fast_assign(
275 __entry->id = id;
276 __entry->state = state;
277 ),
278
279 TP_printk("%s ibs on cpu %d",
280 __entry->state ? "enabling" : "disabling", __entry->id)
281 );
282
Cornelia Huckfa6b7fe2012-12-20 15:32:12 +0100283
Cornelia Huckade38c32012-07-23 17:20:30 +0200284#endif /* _TRACE_KVMS390_H */
285
286/* This part must be outside protection */
287#include <trace/define_trace.h>