blob: f7dc5ddd6847ba09a6ced07403cba502bb4f8e4b [file] [log] [blame]
Christoffer Dalle21f0912015-08-30 13:57:20 +02001#if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_KVM_H
3
4#include <linux/tracepoint.h>
5
6#undef TRACE_SYSTEM
7#define TRACE_SYSTEM kvm
8
9/*
Christoffer Dall35d2d5d2017-05-04 13:54:17 +020010 * Tracepoints for entry/exit to guest
Christoffer Dalle21f0912015-08-30 13:57:20 +020011 */
Christoffer Dall35d2d5d2017-05-04 13:54:17 +020012TRACE_EVENT(kvm_entry,
13 TP_PROTO(unsigned long vcpu_pc),
14 TP_ARGS(vcpu_pc),
Christoffer Dalle21f0912015-08-30 13:57:20 +020015
16 TP_STRUCT__entry(
Christoffer Dall35d2d5d2017-05-04 13:54:17 +020017 __field( unsigned long, vcpu_pc )
Christoffer Dalle21f0912015-08-30 13:57:20 +020018 ),
19
20 TP_fast_assign(
Christoffer Dall35d2d5d2017-05-04 13:54:17 +020021 __entry->vcpu_pc = vcpu_pc;
22 ),
23
24 TP_printk("PC: 0x%08lx", __entry->vcpu_pc)
25);
26
27TRACE_EVENT(kvm_exit,
28 TP_PROTO(int idx, unsigned int exit_reason, unsigned long vcpu_pc),
29 TP_ARGS(idx, exit_reason, vcpu_pc),
30
31 TP_STRUCT__entry(
32 __field( int, idx )
33 __field( unsigned int, exit_reason )
34 __field( unsigned long, vcpu_pc )
35 ),
36
37 TP_fast_assign(
38 __entry->idx = idx;
39 __entry->exit_reason = exit_reason;
40 __entry->vcpu_pc = vcpu_pc;
41 ),
42
43 TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%08lx",
44 __print_symbolic(__entry->idx, kvm_arm_exception_type),
45 __entry->exit_reason,
46 __print_symbolic(__entry->exit_reason, kvm_arm_exception_class),
47 __entry->vcpu_pc)
48);
49
50TRACE_EVENT(kvm_guest_fault,
51 TP_PROTO(unsigned long vcpu_pc, unsigned long hsr,
52 unsigned long hxfar,
53 unsigned long long ipa),
54 TP_ARGS(vcpu_pc, hsr, hxfar, ipa),
55
56 TP_STRUCT__entry(
57 __field( unsigned long, vcpu_pc )
58 __field( unsigned long, hsr )
59 __field( unsigned long, hxfar )
60 __field( unsigned long long, ipa )
61 ),
62
63 TP_fast_assign(
64 __entry->vcpu_pc = vcpu_pc;
65 __entry->hsr = hsr;
66 __entry->hxfar = hxfar;
67 __entry->ipa = ipa;
68 ),
69
70 TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#08lx",
71 __entry->ipa, __entry->hsr,
72 __entry->hxfar, __entry->vcpu_pc)
73);
74
75TRACE_EVENT(kvm_access_fault,
76 TP_PROTO(unsigned long ipa),
77 TP_ARGS(ipa),
78
79 TP_STRUCT__entry(
80 __field( unsigned long, ipa )
81 ),
82
83 TP_fast_assign(
84 __entry->ipa = ipa;
85 ),
86
87 TP_printk("IPA: %lx", __entry->ipa)
88);
89
90TRACE_EVENT(kvm_irq_line,
91 TP_PROTO(unsigned int type, int vcpu_idx, int irq_num, int level),
92 TP_ARGS(type, vcpu_idx, irq_num, level),
93
94 TP_STRUCT__entry(
95 __field( unsigned int, type )
96 __field( int, vcpu_idx )
97 __field( int, irq_num )
98 __field( int, level )
99 ),
100
101 TP_fast_assign(
102 __entry->type = type;
103 __entry->vcpu_idx = vcpu_idx;
104 __entry->irq_num = irq_num;
Christoffer Dalle21f0912015-08-30 13:57:20 +0200105 __entry->level = level;
106 ),
107
Christoffer Dall35d2d5d2017-05-04 13:54:17 +0200108 TP_printk("Inject %s interrupt (%d), vcpu->idx: %d, num: %d, level: %d",
109 (__entry->type == KVM_ARM_IRQ_TYPE_CPU) ? "CPU" :
110 (__entry->type == KVM_ARM_IRQ_TYPE_PPI) ? "VGIC PPI" :
111 (__entry->type == KVM_ARM_IRQ_TYPE_SPI) ? "VGIC SPI" : "UNKNOWN",
112 __entry->type, __entry->vcpu_idx, __entry->irq_num, __entry->level)
113);
114
115TRACE_EVENT(kvm_mmio_emulate,
116 TP_PROTO(unsigned long vcpu_pc, unsigned long instr,
117 unsigned long cpsr),
118 TP_ARGS(vcpu_pc, instr, cpsr),
119
120 TP_STRUCT__entry(
121 __field( unsigned long, vcpu_pc )
122 __field( unsigned long, instr )
123 __field( unsigned long, cpsr )
124 ),
125
126 TP_fast_assign(
127 __entry->vcpu_pc = vcpu_pc;
128 __entry->instr = instr;
129 __entry->cpsr = cpsr;
130 ),
131
132 TP_printk("Emulate MMIO at: 0x%08lx (instr: %08lx, cpsr: %08lx)",
133 __entry->vcpu_pc, __entry->instr, __entry->cpsr)
134);
135
136TRACE_EVENT(kvm_unmap_hva,
137 TP_PROTO(unsigned long hva),
138 TP_ARGS(hva),
139
140 TP_STRUCT__entry(
141 __field( unsigned long, hva )
142 ),
143
144 TP_fast_assign(
145 __entry->hva = hva;
146 ),
147
148 TP_printk("mmu notifier unmap hva: %#08lx", __entry->hva)
149);
150
151TRACE_EVENT(kvm_unmap_hva_range,
152 TP_PROTO(unsigned long start, unsigned long end),
153 TP_ARGS(start, end),
154
155 TP_STRUCT__entry(
156 __field( unsigned long, start )
157 __field( unsigned long, end )
158 ),
159
160 TP_fast_assign(
161 __entry->start = start;
162 __entry->end = end;
163 ),
164
165 TP_printk("mmu notifier unmap range: %#08lx -- %#08lx",
166 __entry->start, __entry->end)
167);
168
169TRACE_EVENT(kvm_set_spte_hva,
170 TP_PROTO(unsigned long hva),
171 TP_ARGS(hva),
172
173 TP_STRUCT__entry(
174 __field( unsigned long, hva )
175 ),
176
177 TP_fast_assign(
178 __entry->hva = hva;
179 ),
180
181 TP_printk("mmu notifier set pte hva: %#08lx", __entry->hva)
182);
183
184TRACE_EVENT(kvm_age_hva,
185 TP_PROTO(unsigned long start, unsigned long end),
186 TP_ARGS(start, end),
187
188 TP_STRUCT__entry(
189 __field( unsigned long, start )
190 __field( unsigned long, end )
191 ),
192
193 TP_fast_assign(
194 __entry->start = start;
195 __entry->end = end;
196 ),
197
198 TP_printk("mmu notifier age hva: %#08lx -- %#08lx",
199 __entry->start, __entry->end)
200);
201
202TRACE_EVENT(kvm_test_age_hva,
203 TP_PROTO(unsigned long hva),
204 TP_ARGS(hva),
205
206 TP_STRUCT__entry(
207 __field( unsigned long, hva )
208 ),
209
210 TP_fast_assign(
211 __entry->hva = hva;
212 ),
213
214 TP_printk("mmu notifier test age hva: %#08lx", __entry->hva)
215);
216
217TRACE_EVENT(kvm_set_way_flush,
218 TP_PROTO(unsigned long vcpu_pc, bool cache),
219 TP_ARGS(vcpu_pc, cache),
220
221 TP_STRUCT__entry(
222 __field( unsigned long, vcpu_pc )
223 __field( bool, cache )
224 ),
225
226 TP_fast_assign(
227 __entry->vcpu_pc = vcpu_pc;
228 __entry->cache = cache;
229 ),
230
231 TP_printk("S/W flush at 0x%016lx (cache %s)",
232 __entry->vcpu_pc, __entry->cache ? "on" : "off")
233);
234
235TRACE_EVENT(kvm_toggle_cache,
236 TP_PROTO(unsigned long vcpu_pc, bool was, bool now),
237 TP_ARGS(vcpu_pc, was, now),
238
239 TP_STRUCT__entry(
240 __field( unsigned long, vcpu_pc )
241 __field( bool, was )
242 __field( bool, now )
243 ),
244
245 TP_fast_assign(
246 __entry->vcpu_pc = vcpu_pc;
247 __entry->was = was;
248 __entry->now = now;
249 ),
250
251 TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
252 __entry->vcpu_pc, __entry->was ? "on" : "off",
253 __entry->now ? "on" : "off")
Christoffer Dalle21f0912015-08-30 13:57:20 +0200254);
255
256/*
257 * Tracepoints for arch_timer
258 */
259TRACE_EVENT(kvm_timer_update_irq,
260 TP_PROTO(unsigned long vcpu_id, __u32 irq, int level),
261 TP_ARGS(vcpu_id, irq, level),
262
263 TP_STRUCT__entry(
264 __field( unsigned long, vcpu_id )
265 __field( __u32, irq )
266 __field( int, level )
267 ),
268
269 TP_fast_assign(
270 __entry->vcpu_id = vcpu_id;
271 __entry->irq = irq;
272 __entry->level = level;
273 ),
274
275 TP_printk("VCPU: %ld, IRQ %d, level %d",
276 __entry->vcpu_id, __entry->irq, __entry->level)
277);
278
279#endif /* _TRACE_KVM_H */
280
281#undef TRACE_INCLUDE_PATH
282#define TRACE_INCLUDE_PATH ../../../virt/kvm/arm
283#undef TRACE_INCLUDE_FILE
284#define TRACE_INCLUDE_FILE trace
285
286/* This part must be outside protection */
287#include <trace/define_trace.h>