WIP FPC-III support
[linux/fpc-iii.git] / arch / arm64 / kvm / trace_arm.h
blobff0444352bba3eea5dfe8f1634a3d615a552b0f3
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if !defined(_TRACE_ARM_ARM64_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
3 #define _TRACE_ARM_ARM64_KVM_H
5 #include <kvm/arm_arch_timer.h>
6 #include <linux/tracepoint.h>
8 #undef TRACE_SYSTEM
9 #define TRACE_SYSTEM kvm
12 * Tracepoints for entry/exit to guest
14 TRACE_EVENT(kvm_entry,
15 TP_PROTO(unsigned long vcpu_pc),
16 TP_ARGS(vcpu_pc),
18 TP_STRUCT__entry(
19 __field( unsigned long, vcpu_pc )
22 TP_fast_assign(
23 __entry->vcpu_pc = vcpu_pc;
26 TP_printk("PC: 0x%016lx", __entry->vcpu_pc)
29 TRACE_EVENT(kvm_exit,
30 TP_PROTO(int ret, unsigned int esr_ec, unsigned long vcpu_pc),
31 TP_ARGS(ret, esr_ec, vcpu_pc),
33 TP_STRUCT__entry(
34 __field( int, ret )
35 __field( unsigned int, esr_ec )
36 __field( unsigned long, vcpu_pc )
39 TP_fast_assign(
40 __entry->ret = ARM_EXCEPTION_CODE(ret);
41 __entry->esr_ec = ARM_EXCEPTION_IS_TRAP(ret) ? esr_ec : 0;
42 __entry->vcpu_pc = vcpu_pc;
45 TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%016lx",
46 __print_symbolic(__entry->ret, kvm_arm_exception_type),
47 __entry->esr_ec,
48 __print_symbolic(__entry->esr_ec, kvm_arm_exception_class),
49 __entry->vcpu_pc)
52 TRACE_EVENT(kvm_guest_fault,
53 TP_PROTO(unsigned long vcpu_pc, unsigned long hsr,
54 unsigned long hxfar,
55 unsigned long long ipa),
56 TP_ARGS(vcpu_pc, hsr, hxfar, ipa),
58 TP_STRUCT__entry(
59 __field( unsigned long, vcpu_pc )
60 __field( unsigned long, hsr )
61 __field( unsigned long, hxfar )
62 __field( unsigned long long, ipa )
65 TP_fast_assign(
66 __entry->vcpu_pc = vcpu_pc;
67 __entry->hsr = hsr;
68 __entry->hxfar = hxfar;
69 __entry->ipa = ipa;
72 TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#016lx",
73 __entry->ipa, __entry->hsr,
74 __entry->hxfar, __entry->vcpu_pc)
77 TRACE_EVENT(kvm_access_fault,
78 TP_PROTO(unsigned long ipa),
79 TP_ARGS(ipa),
81 TP_STRUCT__entry(
82 __field( unsigned long, ipa )
85 TP_fast_assign(
86 __entry->ipa = ipa;
89 TP_printk("IPA: %lx", __entry->ipa)
92 TRACE_EVENT(kvm_irq_line,
93 TP_PROTO(unsigned int type, int vcpu_idx, int irq_num, int level),
94 TP_ARGS(type, vcpu_idx, irq_num, level),
96 TP_STRUCT__entry(
97 __field( unsigned int, type )
98 __field( int, vcpu_idx )
99 __field( int, irq_num )
100 __field( int, level )
103 TP_fast_assign(
104 __entry->type = type;
105 __entry->vcpu_idx = vcpu_idx;
106 __entry->irq_num = irq_num;
107 __entry->level = level;
110 TP_printk("Inject %s interrupt (%d), vcpu->idx: %d, num: %d, level: %d",
111 (__entry->type == KVM_ARM_IRQ_TYPE_CPU) ? "CPU" :
112 (__entry->type == KVM_ARM_IRQ_TYPE_PPI) ? "VGIC PPI" :
113 (__entry->type == KVM_ARM_IRQ_TYPE_SPI) ? "VGIC SPI" : "UNKNOWN",
114 __entry->type, __entry->vcpu_idx, __entry->irq_num, __entry->level)
117 TRACE_EVENT(kvm_mmio_emulate,
118 TP_PROTO(unsigned long vcpu_pc, unsigned long instr,
119 unsigned long cpsr),
120 TP_ARGS(vcpu_pc, instr, cpsr),
122 TP_STRUCT__entry(
123 __field( unsigned long, vcpu_pc )
124 __field( unsigned long, instr )
125 __field( unsigned long, cpsr )
128 TP_fast_assign(
129 __entry->vcpu_pc = vcpu_pc;
130 __entry->instr = instr;
131 __entry->cpsr = cpsr;
134 TP_printk("Emulate MMIO at: 0x%016lx (instr: %08lx, cpsr: %08lx)",
135 __entry->vcpu_pc, __entry->instr, __entry->cpsr)
138 TRACE_EVENT(kvm_unmap_hva_range,
139 TP_PROTO(unsigned long start, unsigned long end),
140 TP_ARGS(start, end),
142 TP_STRUCT__entry(
143 __field( unsigned long, start )
144 __field( unsigned long, end )
147 TP_fast_assign(
148 __entry->start = start;
149 __entry->end = end;
152 TP_printk("mmu notifier unmap range: %#016lx -- %#016lx",
153 __entry->start, __entry->end)
156 TRACE_EVENT(kvm_set_spte_hva,
157 TP_PROTO(unsigned long hva),
158 TP_ARGS(hva),
160 TP_STRUCT__entry(
161 __field( unsigned long, hva )
164 TP_fast_assign(
165 __entry->hva = hva;
168 TP_printk("mmu notifier set pte hva: %#016lx", __entry->hva)
171 TRACE_EVENT(kvm_age_hva,
172 TP_PROTO(unsigned long start, unsigned long end),
173 TP_ARGS(start, end),
175 TP_STRUCT__entry(
176 __field( unsigned long, start )
177 __field( unsigned long, end )
180 TP_fast_assign(
181 __entry->start = start;
182 __entry->end = end;
185 TP_printk("mmu notifier age hva: %#016lx -- %#016lx",
186 __entry->start, __entry->end)
189 TRACE_EVENT(kvm_test_age_hva,
190 TP_PROTO(unsigned long hva),
191 TP_ARGS(hva),
193 TP_STRUCT__entry(
194 __field( unsigned long, hva )
197 TP_fast_assign(
198 __entry->hva = hva;
201 TP_printk("mmu notifier test age hva: %#016lx", __entry->hva)
204 TRACE_EVENT(kvm_set_way_flush,
205 TP_PROTO(unsigned long vcpu_pc, bool cache),
206 TP_ARGS(vcpu_pc, cache),
208 TP_STRUCT__entry(
209 __field( unsigned long, vcpu_pc )
210 __field( bool, cache )
213 TP_fast_assign(
214 __entry->vcpu_pc = vcpu_pc;
215 __entry->cache = cache;
218 TP_printk("S/W flush at 0x%016lx (cache %s)",
219 __entry->vcpu_pc, __entry->cache ? "on" : "off")
222 TRACE_EVENT(kvm_toggle_cache,
223 TP_PROTO(unsigned long vcpu_pc, bool was, bool now),
224 TP_ARGS(vcpu_pc, was, now),
226 TP_STRUCT__entry(
227 __field( unsigned long, vcpu_pc )
228 __field( bool, was )
229 __field( bool, now )
232 TP_fast_assign(
233 __entry->vcpu_pc = vcpu_pc;
234 __entry->was = was;
235 __entry->now = now;
238 TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
239 __entry->vcpu_pc, __entry->was ? "on" : "off",
240 __entry->now ? "on" : "off")
244 * Tracepoints for arch_timer
246 TRACE_EVENT(kvm_timer_update_irq,
247 TP_PROTO(unsigned long vcpu_id, __u32 irq, int level),
248 TP_ARGS(vcpu_id, irq, level),
250 TP_STRUCT__entry(
251 __field( unsigned long, vcpu_id )
252 __field( __u32, irq )
253 __field( int, level )
256 TP_fast_assign(
257 __entry->vcpu_id = vcpu_id;
258 __entry->irq = irq;
259 __entry->level = level;
262 TP_printk("VCPU: %ld, IRQ %d, level %d",
263 __entry->vcpu_id, __entry->irq, __entry->level)
266 TRACE_EVENT(kvm_get_timer_map,
267 TP_PROTO(unsigned long vcpu_id, struct timer_map *map),
268 TP_ARGS(vcpu_id, map),
270 TP_STRUCT__entry(
271 __field( unsigned long, vcpu_id )
272 __field( int, direct_vtimer )
273 __field( int, direct_ptimer )
274 __field( int, emul_ptimer )
277 TP_fast_assign(
278 __entry->vcpu_id = vcpu_id;
279 __entry->direct_vtimer = arch_timer_ctx_index(map->direct_vtimer);
280 __entry->direct_ptimer =
281 (map->direct_ptimer) ? arch_timer_ctx_index(map->direct_ptimer) : -1;
282 __entry->emul_ptimer =
283 (map->emul_ptimer) ? arch_timer_ctx_index(map->emul_ptimer) : -1;
286 TP_printk("VCPU: %ld, dv: %d, dp: %d, ep: %d",
287 __entry->vcpu_id,
288 __entry->direct_vtimer,
289 __entry->direct_ptimer,
290 __entry->emul_ptimer)
293 TRACE_EVENT(kvm_timer_save_state,
294 TP_PROTO(struct arch_timer_context *ctx),
295 TP_ARGS(ctx),
297 TP_STRUCT__entry(
298 __field( unsigned long, ctl )
299 __field( unsigned long long, cval )
300 __field( int, timer_idx )
303 TP_fast_assign(
304 __entry->ctl = timer_get_ctl(ctx);
305 __entry->cval = timer_get_cval(ctx);
306 __entry->timer_idx = arch_timer_ctx_index(ctx);
309 TP_printk(" CTL: %#08lx CVAL: %#16llx arch_timer_ctx_index: %d",
310 __entry->ctl,
311 __entry->cval,
312 __entry->timer_idx)
315 TRACE_EVENT(kvm_timer_restore_state,
316 TP_PROTO(struct arch_timer_context *ctx),
317 TP_ARGS(ctx),
319 TP_STRUCT__entry(
320 __field( unsigned long, ctl )
321 __field( unsigned long long, cval )
322 __field( int, timer_idx )
325 TP_fast_assign(
326 __entry->ctl = timer_get_ctl(ctx);
327 __entry->cval = timer_get_cval(ctx);
328 __entry->timer_idx = arch_timer_ctx_index(ctx);
331 TP_printk("CTL: %#08lx CVAL: %#16llx arch_timer_ctx_index: %d",
332 __entry->ctl,
333 __entry->cval,
334 __entry->timer_idx)
337 TRACE_EVENT(kvm_timer_hrtimer_expire,
338 TP_PROTO(struct arch_timer_context *ctx),
339 TP_ARGS(ctx),
341 TP_STRUCT__entry(
342 __field( int, timer_idx )
345 TP_fast_assign(
346 __entry->timer_idx = arch_timer_ctx_index(ctx);
349 TP_printk("arch_timer_ctx_index: %d", __entry->timer_idx)
352 TRACE_EVENT(kvm_timer_emulate,
353 TP_PROTO(struct arch_timer_context *ctx, bool should_fire),
354 TP_ARGS(ctx, should_fire),
356 TP_STRUCT__entry(
357 __field( int, timer_idx )
358 __field( bool, should_fire )
361 TP_fast_assign(
362 __entry->timer_idx = arch_timer_ctx_index(ctx);
363 __entry->should_fire = should_fire;
366 TP_printk("arch_timer_ctx_index: %d (should_fire: %d)",
367 __entry->timer_idx, __entry->should_fire)
370 #endif /* _TRACE_ARM_ARM64_KVM_H */
372 #undef TRACE_INCLUDE_PATH
373 #define TRACE_INCLUDE_PATH .
374 #undef TRACE_INCLUDE_FILE
375 #define TRACE_INCLUDE_FILE trace_arm
377 /* This part must be outside protection */
378 #include <trace/define_trace.h>