arm/arm64: KVM: Improve kvm_exit tracepoint
[linux/fpc-iii.git] / arch / arm / kvm / trace.h
blobc25a88598eb04d02dde1085a20427eb123a18248
1 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
2 #define _TRACE_KVM_H
4 #include <linux/tracepoint.h>
6 #undef TRACE_SYSTEM
7 #define TRACE_SYSTEM kvm
9 /*
10 * Tracepoints for entry/exit to guest
12 TRACE_EVENT(kvm_entry,
13 TP_PROTO(unsigned long vcpu_pc),
14 TP_ARGS(vcpu_pc),
16 TP_STRUCT__entry(
17 __field( unsigned long, vcpu_pc )
20 TP_fast_assign(
21 __entry->vcpu_pc = vcpu_pc;
24 TP_printk("PC: 0x%08lx", __entry->vcpu_pc)
27 TRACE_EVENT(kvm_exit,
28 TP_PROTO(int idx, unsigned int exit_reason, unsigned long vcpu_pc),
29 TP_ARGS(idx, exit_reason, vcpu_pc),
31 TP_STRUCT__entry(
32 __field( int, idx )
33 __field( unsigned int, exit_reason )
34 __field( unsigned long, vcpu_pc )
37 TP_fast_assign(
38 __entry->idx = idx;
39 __entry->exit_reason = exit_reason;
40 __entry->vcpu_pc = vcpu_pc;
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)
50 TRACE_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),
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 )
63 TP_fast_assign(
64 __entry->vcpu_pc = vcpu_pc;
65 __entry->hsr = hsr;
66 __entry->hxfar = hxfar;
67 __entry->ipa = ipa;
70 TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#08lx",
71 __entry->ipa, __entry->hsr,
72 __entry->hxfar, __entry->vcpu_pc)
75 TRACE_EVENT(kvm_access_fault,
76 TP_PROTO(unsigned long ipa),
77 TP_ARGS(ipa),
79 TP_STRUCT__entry(
80 __field( unsigned long, ipa )
83 TP_fast_assign(
84 __entry->ipa = ipa;
87 TP_printk("IPA: %lx", __entry->ipa)
90 TRACE_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),
94 TP_STRUCT__entry(
95 __field( unsigned int, type )
96 __field( int, vcpu_idx )
97 __field( int, irq_num )
98 __field( int, level )
101 TP_fast_assign(
102 __entry->type = type;
103 __entry->vcpu_idx = vcpu_idx;
104 __entry->irq_num = irq_num;
105 __entry->level = level;
108 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)
115 TRACE_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),
120 TP_STRUCT__entry(
121 __field( unsigned long, vcpu_pc )
122 __field( unsigned long, instr )
123 __field( unsigned long, cpsr )
126 TP_fast_assign(
127 __entry->vcpu_pc = vcpu_pc;
128 __entry->instr = instr;
129 __entry->cpsr = cpsr;
132 TP_printk("Emulate MMIO at: 0x%08lx (instr: %08lx, cpsr: %08lx)",
133 __entry->vcpu_pc, __entry->instr, __entry->cpsr)
136 /* Architecturally implementation defined CP15 register access */
137 TRACE_EVENT(kvm_emulate_cp15_imp,
138 TP_PROTO(unsigned long Op1, unsigned long Rt1, unsigned long CRn,
139 unsigned long CRm, unsigned long Op2, bool is_write),
140 TP_ARGS(Op1, Rt1, CRn, CRm, Op2, is_write),
142 TP_STRUCT__entry(
143 __field( unsigned int, Op1 )
144 __field( unsigned int, Rt1 )
145 __field( unsigned int, CRn )
146 __field( unsigned int, CRm )
147 __field( unsigned int, Op2 )
148 __field( bool, is_write )
151 TP_fast_assign(
152 __entry->is_write = is_write;
153 __entry->Op1 = Op1;
154 __entry->Rt1 = Rt1;
155 __entry->CRn = CRn;
156 __entry->CRm = CRm;
157 __entry->Op2 = Op2;
160 TP_printk("Implementation defined CP15: %s\tp15, %u, r%u, c%u, c%u, %u",
161 (__entry->is_write) ? "mcr" : "mrc",
162 __entry->Op1, __entry->Rt1, __entry->CRn,
163 __entry->CRm, __entry->Op2)
166 TRACE_EVENT(kvm_wfx,
167 TP_PROTO(unsigned long vcpu_pc, bool is_wfe),
168 TP_ARGS(vcpu_pc, is_wfe),
170 TP_STRUCT__entry(
171 __field( unsigned long, vcpu_pc )
172 __field( bool, is_wfe )
175 TP_fast_assign(
176 __entry->vcpu_pc = vcpu_pc;
177 __entry->is_wfe = is_wfe;
180 TP_printk("guest executed wf%c at: 0x%08lx",
181 __entry->is_wfe ? 'e' : 'i', __entry->vcpu_pc)
184 TRACE_EVENT(kvm_unmap_hva,
185 TP_PROTO(unsigned long hva),
186 TP_ARGS(hva),
188 TP_STRUCT__entry(
189 __field( unsigned long, hva )
192 TP_fast_assign(
193 __entry->hva = hva;
196 TP_printk("mmu notifier unmap hva: %#08lx", __entry->hva)
199 TRACE_EVENT(kvm_unmap_hva_range,
200 TP_PROTO(unsigned long start, unsigned long end),
201 TP_ARGS(start, end),
203 TP_STRUCT__entry(
204 __field( unsigned long, start )
205 __field( unsigned long, end )
208 TP_fast_assign(
209 __entry->start = start;
210 __entry->end = end;
213 TP_printk("mmu notifier unmap range: %#08lx -- %#08lx",
214 __entry->start, __entry->end)
217 TRACE_EVENT(kvm_set_spte_hva,
218 TP_PROTO(unsigned long hva),
219 TP_ARGS(hva),
221 TP_STRUCT__entry(
222 __field( unsigned long, hva )
225 TP_fast_assign(
226 __entry->hva = hva;
229 TP_printk("mmu notifier set pte hva: %#08lx", __entry->hva)
232 TRACE_EVENT(kvm_age_hva,
233 TP_PROTO(unsigned long start, unsigned long end),
234 TP_ARGS(start, end),
236 TP_STRUCT__entry(
237 __field( unsigned long, start )
238 __field( unsigned long, end )
241 TP_fast_assign(
242 __entry->start = start;
243 __entry->end = end;
246 TP_printk("mmu notifier age hva: %#08lx -- %#08lx",
247 __entry->start, __entry->end)
250 TRACE_EVENT(kvm_test_age_hva,
251 TP_PROTO(unsigned long hva),
252 TP_ARGS(hva),
254 TP_STRUCT__entry(
255 __field( unsigned long, hva )
258 TP_fast_assign(
259 __entry->hva = hva;
262 TP_printk("mmu notifier test age hva: %#08lx", __entry->hva)
265 TRACE_EVENT(kvm_hvc,
266 TP_PROTO(unsigned long vcpu_pc, unsigned long r0, unsigned long imm),
267 TP_ARGS(vcpu_pc, r0, imm),
269 TP_STRUCT__entry(
270 __field( unsigned long, vcpu_pc )
271 __field( unsigned long, r0 )
272 __field( unsigned long, imm )
275 TP_fast_assign(
276 __entry->vcpu_pc = vcpu_pc;
277 __entry->r0 = r0;
278 __entry->imm = imm;
281 TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx",
282 __entry->vcpu_pc, __entry->r0, __entry->imm)
285 TRACE_EVENT(kvm_set_way_flush,
286 TP_PROTO(unsigned long vcpu_pc, bool cache),
287 TP_ARGS(vcpu_pc, cache),
289 TP_STRUCT__entry(
290 __field( unsigned long, vcpu_pc )
291 __field( bool, cache )
294 TP_fast_assign(
295 __entry->vcpu_pc = vcpu_pc;
296 __entry->cache = cache;
299 TP_printk("S/W flush at 0x%016lx (cache %s)",
300 __entry->vcpu_pc, __entry->cache ? "on" : "off")
303 TRACE_EVENT(kvm_toggle_cache,
304 TP_PROTO(unsigned long vcpu_pc, bool was, bool now),
305 TP_ARGS(vcpu_pc, was, now),
307 TP_STRUCT__entry(
308 __field( unsigned long, vcpu_pc )
309 __field( bool, was )
310 __field( bool, now )
313 TP_fast_assign(
314 __entry->vcpu_pc = vcpu_pc;
315 __entry->was = was;
316 __entry->now = now;
319 TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
320 __entry->vcpu_pc, __entry->was ? "on" : "off",
321 __entry->now ? "on" : "off")
324 #endif /* _TRACE_KVM_H */
326 #undef TRACE_INCLUDE_PATH
327 #define TRACE_INCLUDE_PATH arch/arm/kvm
328 #undef TRACE_INCLUDE_FILE
329 #define TRACE_INCLUDE_FILE trace
331 /* This part must be outside protection */
332 #include <trace/define_trace.h>