xref: /openbmc/linux/arch/s390/kvm/trace-s390.h (revision c0e297dc)
1 #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 /*
13  * 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 /*
20  * Trace point for the creation of the kvm instance.
21  */
22 TRACE_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  */
41 TRACE_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 
62 TRACE_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 /*
78  * Trace point for start and stop of vpcus.
79  */
80 TRACE_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 /*
99  * 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"},				\
108 	{KVM_S390_INT_VIRTIO, "virtio interrupt"},			\
109 	{KVM_S390_INT_SERVICE, "sclp interrupt"},			\
110 	{KVM_S390_INT_EMERGENCY, "sigp emergency"},			\
111 	{KVM_S390_INT_EXTERNAL_CALL, "sigp ext call"}
112 
113 TRACE_EVENT(kvm_s390_inject_vm,
114 	    TP_PROTO(__u64 type, __u32 parm, __u64 parm64, int who),
115 	    TP_ARGS(type, parm, parm64, who),
116 
117 	    TP_STRUCT__entry(
118 		    __field(__u32, inttype)
119 		    __field(__u32, parm)
120 		    __field(__u64, parm64)
121 		    __field(int, who)
122 		    ),
123 
124 	    TP_fast_assign(
125 		    __entry->inttype = type & 0x00000000ffffffff;
126 		    __entry->parm = parm;
127 		    __entry->parm64 = parm64;
128 		    __entry->who = who;
129 		    ),
130 
131 	    TP_printk("inject%s: type:%x (%s) parm:%x parm64:%llx",
132 		      (__entry->who == 1) ? " (from kernel)" :
133 		      (__entry->who == 2) ? " (from user)" : "",
134 		      __entry->inttype,
135 		      __print_symbolic(__entry->inttype, kvm_s390_int_type),
136 		      __entry->parm, __entry->parm64)
137 	);
138 
139 TRACE_EVENT(kvm_s390_inject_vcpu,
140 	    TP_PROTO(unsigned int id, __u64 type, __u32 parm, __u64 parm64, \
141 		     int who),
142 	    TP_ARGS(id, type, parm, parm64, who),
143 
144 	    TP_STRUCT__entry(
145 		    __field(int, id)
146 		    __field(__u32, inttype)
147 		    __field(__u32, parm)
148 		    __field(__u64, parm64)
149 		    __field(int, who)
150 		    ),
151 
152 	    TP_fast_assign(
153 		    __entry->id = id;
154 		    __entry->inttype = type & 0x00000000ffffffff;
155 		    __entry->parm = parm;
156 		    __entry->parm64 = parm64;
157 		    __entry->who = who;
158 		    ),
159 
160 	    TP_printk("inject%s (vcpu %d): type:%x (%s) parm:%x parm64:%llx",
161 		      (__entry->who == 1) ? " (from kernel)" :
162 		      (__entry->who == 2) ? " (from user)" : "",
163 		      __entry->id, __entry->inttype,
164 		      __print_symbolic(__entry->inttype, kvm_s390_int_type),
165 		      __entry->parm, __entry->parm64)
166 	);
167 
168 /*
169  * Trace point for the actual delivery of interrupts.
170  */
171 TRACE_EVENT(kvm_s390_deliver_interrupt,
172 	    TP_PROTO(unsigned int id, __u64 type, __u64 data0, __u64 data1),
173 	    TP_ARGS(id, type, data0, data1),
174 
175 	    TP_STRUCT__entry(
176 		    __field(int, id)
177 		    __field(__u32, inttype)
178 		    __field(__u64, data0)
179 		    __field(__u64, data1)
180 		    ),
181 
182 	    TP_fast_assign(
183 		    __entry->id = id;
184 		    __entry->inttype = type & 0x00000000ffffffff;
185 		    __entry->data0 = data0;
186 		    __entry->data1 = data1;
187 		    ),
188 
189 	    TP_printk("deliver interrupt (vcpu %d): type:%x (%s) "	\
190 		      "data:%08llx %016llx",
191 		      __entry->id, __entry->inttype,
192 		      __print_symbolic(__entry->inttype, kvm_s390_int_type),
193 		      __entry->data0, __entry->data1)
194 	);
195 
196 /*
197  * Trace point for resets that may be requested from userspace.
198  */
199 TRACE_EVENT(kvm_s390_request_resets,
200 	    TP_PROTO(__u64 resets),
201 	    TP_ARGS(resets),
202 
203 	    TP_STRUCT__entry(
204 		    __field(__u64, resets)
205 		    ),
206 
207 	    TP_fast_assign(
208 		    __entry->resets = resets;
209 		    ),
210 
211 	    TP_printk("requesting userspace resets %llx",
212 		      __entry->resets)
213 	);
214 
215 /*
216  * Trace point for a vcpu's stop requests.
217  */
218 TRACE_EVENT(kvm_s390_stop_request,
219 	    TP_PROTO(unsigned char stop_irq, unsigned char flags),
220 	    TP_ARGS(stop_irq, flags),
221 
222 	    TP_STRUCT__entry(
223 		    __field(unsigned char, stop_irq)
224 		    __field(unsigned char, flags)
225 		    ),
226 
227 	    TP_fast_assign(
228 		    __entry->stop_irq = stop_irq;
229 		    __entry->flags = flags;
230 		    ),
231 
232 	    TP_printk("stop request, stop irq = %u, flags = %08x",
233 		      __entry->stop_irq, __entry->flags)
234 	);
235 
236 
237 /*
238  * Trace point for enabling channel I/O instruction support.
239  */
240 TRACE_EVENT(kvm_s390_enable_css,
241 	    TP_PROTO(void *kvm),
242 	    TP_ARGS(kvm),
243 
244 	    TP_STRUCT__entry(
245 		    __field(void *, kvm)
246 		    ),
247 
248 	    TP_fast_assign(
249 		    __entry->kvm = kvm;
250 		    ),
251 
252 	    TP_printk("enabling channel I/O support (kvm @ %p)\n",
253 		      __entry->kvm)
254 	);
255 
256 /*
257  * Trace point for enabling and disabling interlocking-and-broadcasting
258  * suppression.
259  */
260 TRACE_EVENT(kvm_s390_enable_disable_ibs,
261 	    TP_PROTO(unsigned int id, int state),
262 	    TP_ARGS(id, state),
263 
264 	    TP_STRUCT__entry(
265 		    __field(unsigned int, id)
266 		    __field(int, state)
267 		    ),
268 
269 	    TP_fast_assign(
270 		    __entry->id = id;
271 		    __entry->state = state;
272 		    ),
273 
274 	    TP_printk("%s ibs on cpu %d",
275 		      __entry->state ? "enabling" : "disabling", __entry->id)
276 	);
277 
278 
279 #endif /* _TRACE_KVMS390_H */
280 
281 /* This part must be outside protection */
282 #include <trace/define_trace.h>
283