xref: /openbmc/linux/arch/s390/kvm/trace-s390.h (revision b34e08d5)
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  * Trace point for the creation of the kvm instance.
14  */
15 TRACE_EVENT(kvm_s390_create_vm,
16 	    TP_PROTO(unsigned long type),
17 	    TP_ARGS(type),
18 
19 	    TP_STRUCT__entry(
20 		    __field(unsigned long, type)
21 		    ),
22 
23 	    TP_fast_assign(
24 		    __entry->type = type;
25 		    ),
26 
27 	    TP_printk("create vm%s",
28 		      __entry->type & KVM_VM_S390_UCONTROL ? " (UCONTROL)" : "")
29 	);
30 
31 /*
32  * Trace points for creation and destruction of vpcus.
33  */
34 TRACE_EVENT(kvm_s390_create_vcpu,
35 	    TP_PROTO(unsigned int id, struct kvm_vcpu *vcpu,
36 		     struct kvm_s390_sie_block *sie_block),
37 	    TP_ARGS(id, vcpu, sie_block),
38 
39 	    TP_STRUCT__entry(
40 		    __field(unsigned int, id)
41 		    __field(struct kvm_vcpu *, vcpu)
42 		    __field(struct kvm_s390_sie_block *, sie_block)
43 		    ),
44 
45 	    TP_fast_assign(
46 		    __entry->id = id;
47 		    __entry->vcpu = vcpu;
48 		    __entry->sie_block = sie_block;
49 		    ),
50 
51 	    TP_printk("create cpu %d at %p, sie block at %p", __entry->id,
52 		      __entry->vcpu, __entry->sie_block)
53 	);
54 
55 TRACE_EVENT(kvm_s390_destroy_vcpu,
56 	    TP_PROTO(unsigned int id),
57 	    TP_ARGS(id),
58 
59 	    TP_STRUCT__entry(
60 		    __field(unsigned int, id)
61 		    ),
62 
63 	    TP_fast_assign(
64 		    __entry->id = id;
65 		    ),
66 
67 	    TP_printk("destroy cpu %d", __entry->id)
68 	);
69 
70 /*
71  * Trace points for injection of interrupts, either per machine or
72  * per vcpu.
73  */
74 
75 #define kvm_s390_int_type						\
76 	{KVM_S390_SIGP_STOP, "sigp stop"},				\
77 	{KVM_S390_PROGRAM_INT, "program interrupt"},			\
78 	{KVM_S390_SIGP_SET_PREFIX, "sigp set prefix"},			\
79 	{KVM_S390_RESTART, "sigp restart"},				\
80 	{KVM_S390_INT_VIRTIO, "virtio interrupt"},			\
81 	{KVM_S390_INT_SERVICE, "sclp interrupt"},			\
82 	{KVM_S390_INT_EMERGENCY, "sigp emergency"},			\
83 	{KVM_S390_INT_EXTERNAL_CALL, "sigp ext call"}
84 
85 TRACE_EVENT(kvm_s390_inject_vm,
86 	    TP_PROTO(__u64 type, __u32 parm, __u64 parm64, int who),
87 	    TP_ARGS(type, parm, parm64, who),
88 
89 	    TP_STRUCT__entry(
90 		    __field(__u32, inttype)
91 		    __field(__u32, parm)
92 		    __field(__u64, parm64)
93 		    __field(int, who)
94 		    ),
95 
96 	    TP_fast_assign(
97 		    __entry->inttype = type & 0x00000000ffffffff;
98 		    __entry->parm = parm;
99 		    __entry->parm64 = parm64;
100 		    __entry->who = who;
101 		    ),
102 
103 	    TP_printk("inject%s: type:%x (%s) parm:%x parm64:%llx",
104 		      (__entry->who == 1) ? " (from kernel)" :
105 		      (__entry->who == 2) ? " (from user)" : "",
106 		      __entry->inttype,
107 		      __print_symbolic(__entry->inttype, kvm_s390_int_type),
108 		      __entry->parm, __entry->parm64)
109 	);
110 
111 TRACE_EVENT(kvm_s390_inject_vcpu,
112 	    TP_PROTO(unsigned int id, __u64 type, __u32 parm, __u64 parm64, \
113 		     int who),
114 	    TP_ARGS(id, type, parm, parm64, who),
115 
116 	    TP_STRUCT__entry(
117 		    __field(int, id)
118 		    __field(__u32, inttype)
119 		    __field(__u32, parm)
120 		    __field(__u64, parm64)
121 		    __field(int, who)
122 		    ),
123 
124 	    TP_fast_assign(
125 		    __entry->id = id;
126 		    __entry->inttype = type & 0x00000000ffffffff;
127 		    __entry->parm = parm;
128 		    __entry->parm64 = parm64;
129 		    __entry->who = who;
130 		    ),
131 
132 	    TP_printk("inject%s (vcpu %d): type:%x (%s) parm:%x parm64:%llx",
133 		      (__entry->who == 1) ? " (from kernel)" :
134 		      (__entry->who == 2) ? " (from user)" : "",
135 		      __entry->id, __entry->inttype,
136 		      __print_symbolic(__entry->inttype, kvm_s390_int_type),
137 		      __entry->parm, __entry->parm64)
138 	);
139 
140 /*
141  * Trace point for the actual delivery of interrupts.
142  */
143 TRACE_EVENT(kvm_s390_deliver_interrupt,
144 	    TP_PROTO(unsigned int id, __u64 type, __u64 data0, __u64 data1),
145 	    TP_ARGS(id, type, data0, data1),
146 
147 	    TP_STRUCT__entry(
148 		    __field(int, id)
149 		    __field(__u32, inttype)
150 		    __field(__u64, data0)
151 		    __field(__u64, data1)
152 		    ),
153 
154 	    TP_fast_assign(
155 		    __entry->id = id;
156 		    __entry->inttype = type & 0x00000000ffffffff;
157 		    __entry->data0 = data0;
158 		    __entry->data1 = data1;
159 		    ),
160 
161 	    TP_printk("deliver interrupt (vcpu %d): type:%x (%s) "	\
162 		      "data:%08llx %016llx",
163 		      __entry->id, __entry->inttype,
164 		      __print_symbolic(__entry->inttype, kvm_s390_int_type),
165 		      __entry->data0, __entry->data1)
166 	);
167 
168 /*
169  * Trace point for resets that may be requested from userspace.
170  */
171 TRACE_EVENT(kvm_s390_request_resets,
172 	    TP_PROTO(__u64 resets),
173 	    TP_ARGS(resets),
174 
175 	    TP_STRUCT__entry(
176 		    __field(__u64, resets)
177 		    ),
178 
179 	    TP_fast_assign(
180 		    __entry->resets = resets;
181 		    ),
182 
183 	    TP_printk("requesting userspace resets %llx",
184 		      __entry->resets)
185 	);
186 
187 /*
188  * Trace point for a vcpu's stop requests.
189  */
190 TRACE_EVENT(kvm_s390_stop_request,
191 	    TP_PROTO(unsigned int action_bits),
192 	    TP_ARGS(action_bits),
193 
194 	    TP_STRUCT__entry(
195 		    __field(unsigned int, action_bits)
196 		    ),
197 
198 	    TP_fast_assign(
199 		    __entry->action_bits = action_bits;
200 		    ),
201 
202 	    TP_printk("stop request, action_bits = %08x",
203 		      __entry->action_bits)
204 	);
205 
206 
207 /*
208  * Trace point for enabling channel I/O instruction support.
209  */
210 TRACE_EVENT(kvm_s390_enable_css,
211 	    TP_PROTO(void *kvm),
212 	    TP_ARGS(kvm),
213 
214 	    TP_STRUCT__entry(
215 		    __field(void *, kvm)
216 		    ),
217 
218 	    TP_fast_assign(
219 		    __entry->kvm = kvm;
220 		    ),
221 
222 	    TP_printk("enabling channel I/O support (kvm @ %p)\n",
223 		      __entry->kvm)
224 	);
225 
226 
227 #endif /* _TRACE_KVMS390_H */
228 
229 /* This part must be outside protection */
230 #include <trace/define_trace.h>
231