2 #if !defined(_TRACE_ARM_ARM64_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
3 #define _TRACE_ARM_ARM64_KVM_H
5 #include <asm/kvm_emulate.h>
7 #include <linux/tracepoint.h>
10 #define TRACE_SYSTEM kvm
16 TP_PROTO(
unsigned long vcpu_pc),
20 __field(
unsigned long, vcpu_pc )
24 __entry->vcpu_pc = vcpu_pc;
27 TP_printk(
"PC: 0x%016lx", __entry->vcpu_pc)
31 TP_PROTO(
int ret,
unsigned int esr_ec,
unsigned long vcpu_pc),
32 TP_ARGS(ret, esr_ec, vcpu_pc),
36 __field(
unsigned int, esr_ec )
37 __field(
unsigned long, vcpu_pc )
41 __entry->ret = ARM_EXCEPTION_CODE(ret);
42 __entry->esr_ec = ARM_EXCEPTION_IS_TRAP(ret) ? esr_ec : 0;
43 __entry->vcpu_pc = vcpu_pc;
46 TP_printk(
"%s: HSR_EC: 0x%04x (%s), PC: 0x%016lx",
47 __print_symbolic(__entry->ret, kvm_arm_exception_type),
49 __print_symbolic(__entry->esr_ec, kvm_arm_exception_class),
54 TP_PROTO(
unsigned long vcpu_pc,
unsigned long hsr,
56 unsigned long long ipa),
57 TP_ARGS(vcpu_pc, hsr, hxfar, ipa),
60 __field(
unsigned long, vcpu_pc )
61 __field(
unsigned long, hsr )
62 __field(
unsigned long, hxfar )
63 __field(
unsigned long long, ipa )
67 __entry->vcpu_pc = vcpu_pc;
69 __entry->hxfar = hxfar;
73 TP_printk(
"ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#016lx",
74 __entry->ipa, __entry->hsr,
75 __entry->hxfar, __entry->vcpu_pc)
79 TP_PROTO(
unsigned long ipa),
83 __field(
unsigned long, ipa )
90 TP_printk(
"IPA: %lx", __entry->ipa)
94 TP_PROTO(
unsigned int type,
int vcpu_idx,
int irq_num,
int level),
95 TP_ARGS(type, vcpu_idx, irq_num, level),
98 __field(
unsigned int, type )
99 __field(
int, vcpu_idx )
100 __field(
int, irq_num )
101 __field(
int, level )
105 __entry->type = type;
106 __entry->vcpu_idx = vcpu_idx;
107 __entry->irq_num = irq_num;
108 __entry->level = level;
111 TP_printk(
"Inject %s interrupt (%d), vcpu->idx: %d, num: %d, level: %d",
112 (__entry->type == KVM_ARM_IRQ_TYPE_CPU) ?
"CPU" :
113 (__entry->type == KVM_ARM_IRQ_TYPE_PPI) ?
"VGIC PPI" :
114 (__entry->type == KVM_ARM_IRQ_TYPE_SPI) ?
"VGIC SPI" :
"UNKNOWN",
115 __entry->type, __entry->vcpu_idx, __entry->irq_num, __entry->level)
119 TP_PROTO(
unsigned long vcpu_pc,
unsigned long instr,
121 TP_ARGS(vcpu_pc, instr, cpsr),
124 __field(
unsigned long, vcpu_pc )
125 __field(
unsigned long, instr )
126 __field(
unsigned long, cpsr )
130 __entry->vcpu_pc = vcpu_pc;
131 __entry->instr = instr;
132 __entry->cpsr = cpsr;
135 TP_printk(
"Emulate MMIO at: 0x%016lx (instr: %08lx, cpsr: %08lx)",
136 __entry->vcpu_pc, __entry->instr, __entry->cpsr)
140 TP_PROTO(
unsigned long vcpu_pc,
unsigned long esr,
141 unsigned long far,
unsigned long ipa),
142 TP_ARGS(vcpu_pc, esr, far, ipa),
145 __field(
unsigned long, vcpu_pc )
146 __field(
unsigned long, esr )
147 __field(
unsigned long, far )
148 __field(
unsigned long, ipa )
152 __entry->vcpu_pc = vcpu_pc;
158 TP_printk(
"ipa %#016lx, esr %#016lx, far %#016lx, pc %#016lx",
159 __entry->ipa, __entry->esr,
160 __entry->far, __entry->vcpu_pc)
165 TP_PROTO(
unsigned long vcpu_pc,
bool cache),
166 TP_ARGS(vcpu_pc, cache),
169 __field(
unsigned long, vcpu_pc )
170 __field(
bool, cache )
174 __entry->vcpu_pc = vcpu_pc;
175 __entry->cache = cache;
178 TP_printk(
"S/W flush at 0x%016lx (cache %s)",
179 __entry->vcpu_pc, __entry->cache ?
"on" :
"off")
183 TP_PROTO(
unsigned long vcpu_pc,
bool was,
bool now),
184 TP_ARGS(vcpu_pc, was, now),
187 __field(
unsigned long, vcpu_pc )
193 __entry->vcpu_pc = vcpu_pc;
198 TP_printk(
"VM op at 0x%016lx (cache was %s, now %s)",
199 __entry->vcpu_pc, __entry->was ?
"on" :
"off",
200 __entry->now ?
"on" :
"off")
207 TP_PROTO(
unsigned long vcpu_id, __u32 irq,
int level),
208 TP_ARGS(vcpu_id, irq, level),
211 __field(
unsigned long, vcpu_id )
212 __field( __u32, irq )
213 __field(
int, level )
217 __entry->vcpu_id = vcpu_id;
219 __entry->level = level;
222 TP_printk(
"VCPU: %ld, IRQ %d, level %d",
223 __entry->vcpu_id, __entry->irq, __entry->level)
227 TP_PROTO(
unsigned long vcpu_id,
struct timer_map *map),
228 TP_ARGS(vcpu_id, map),
231 __field(
unsigned long, vcpu_id )
232 __field(
int, direct_vtimer )
233 __field(
int, direct_ptimer )
234 __field(
int, emul_vtimer )
235 __field(
int, emul_ptimer )
239 __entry->vcpu_id = vcpu_id;
241 __entry->direct_ptimer =
243 __entry->emul_vtimer =
245 __entry->emul_ptimer =
249 TP_printk(
"VCPU: %ld, dv: %d, dp: %d, ev: %d, ep: %d",
251 __entry->direct_vtimer,
252 __entry->direct_ptimer,
253 __entry->emul_vtimer,
254 __entry->emul_ptimer)
262 __field(
unsigned long, ctl )
263 __field(
unsigned long long, cval )
264 __field(
int, timer_idx )
273 TP_printk(
" CTL: %#08lx CVAL: %#16llx arch_timer_ctx_index: %d",
284 __field(
unsigned long, ctl )
285 __field(
unsigned long long, cval )
286 __field(
int, timer_idx )
295 TP_printk(
"CTL: %#08lx CVAL: %#16llx arch_timer_ctx_index: %d",
306 __field(
int, timer_idx )
313 TP_printk(
"arch_timer_ctx_index: %d", __entry->timer_idx)
318 TP_ARGS(ctx, should_fire),
321 __field(
int, timer_idx )
322 __field(
bool, should_fire )
327 __entry->should_fire = should_fire;
330 TP_printk(
"arch_timer_ctx_index: %d (should_fire: %d)",
331 __entry->timer_idx, __entry->should_fire)
335 TP_PROTO(
struct kvm_vcpu *vcpu,
unsigned long elr_el2,
336 unsigned long spsr_el2),
337 TP_ARGS(vcpu, elr_el2, spsr_el2),
340 __field(
struct kvm_vcpu *, vcpu)
341 __field(
unsigned long, elr_el2)
342 __field(
unsigned long, spsr_el2)
343 __field(
unsigned long, target_mode)
344 __field(
unsigned long, hcr_el2)
348 __entry->vcpu = vcpu;
349 __entry->elr_el2 = elr_el2;
350 __entry->spsr_el2 = spsr_el2;
351 __entry->target_mode = spsr_el2 & (PSR_MODE_MASK | PSR_MODE32_BIT);
352 __entry->hcr_el2 = __vcpu_sys_reg(vcpu, HCR_EL2);
355 TP_printk(
"elr_el2: 0x%lx spsr_el2: 0x%08lx (M: %s) hcr_el2: %lx",
356 __entry->elr_el2, __entry->spsr_el2,
357 __print_symbolic(__entry->target_mode, kvm_mode_names),
362 TP_PROTO(
struct kvm_vcpu *vcpu, u64 esr_el2,
int type),
363 TP_ARGS(vcpu, esr_el2, type),
366 __field(
struct kvm_vcpu *, vcpu)
367 __field(
unsigned long, esr_el2)
369 __field(
unsigned long, spsr_el2)
370 __field(
unsigned long, pc)
371 __field(
unsigned long, source_mode)
372 __field(
unsigned long, hcr_el2)
376 __entry->vcpu = vcpu;
377 __entry->esr_el2 = esr_el2;
378 __entry->type = type;
379 __entry->spsr_el2 = *vcpu_cpsr(vcpu);
380 __entry->pc = *vcpu_pc(vcpu);
381 __entry->source_mode = *vcpu_cpsr(vcpu) & (PSR_MODE_MASK | PSR_MODE32_BIT);
382 __entry->hcr_el2 = __vcpu_sys_reg(vcpu, HCR_EL2);
385 TP_printk(
"%s: esr_el2 0x%lx elr_el2: 0x%lx spsr_el2: 0x%08lx (M: %s) hcr_el2: %lx",
386 __print_symbolic(__entry->type, kvm_exception_type_names),
387 __entry->esr_el2, __entry->pc, __entry->spsr_el2,
388 __print_symbolic(__entry->source_mode, kvm_mode_names),
393 TP_PROTO(
struct kvm_vcpu *vcpu, u32 sysreg,
bool is_read),
394 TP_ARGS(vcpu, sysreg, is_read),
399 __field(
bool, is_read)
403 __entry->pc = *vcpu_pc(vcpu);
404 __entry->sysreg = sysreg;
405 __entry->is_read = is_read;
408 TP_printk(
"%llx %c (%d,%d,%d,%d,%d)",
410 __entry->is_read ?
'R' :
'W',
411 sys_reg_Op0(__entry->sysreg),
412 sys_reg_Op1(__entry->sysreg),
413 sys_reg_CRn(__entry->sysreg),
414 sys_reg_CRm(__entry->sysreg),
415 sys_reg_Op2(__entry->sysreg))
420 #undef TRACE_INCLUDE_PATH
421 #define TRACE_INCLUDE_PATH .
422 #undef TRACE_INCLUDE_FILE
423 #define TRACE_INCLUDE_FILE trace_arm
426 #include <trace/define_trace.h>
static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level, struct arch_timer_context *timer_ctx)
u64 timer_get_cval(struct arch_timer_context *ctxt)
u32 timer_get_ctl(struct arch_timer_context *ctxt)
#define arch_timer_ctx_index(ctx)
void kvm_set_way_flush(struct kvm_vcpu *vcpu)
void kvm_toggle_cache(struct kvm_vcpu *vcpu, bool was_enabled)
struct arch_timer_context * direct_vtimer
struct arch_timer_context * direct_ptimer
struct arch_timer_context * emul_ptimer
struct arch_timer_context * emul_vtimer
TRACE_EVENT(kvm_entry, TP_PROTO(unsigned long vcpu_pc), TP_ARGS(vcpu_pc), TP_STRUCT__entry(__field(unsigned long, vcpu_pc)), TP_fast_assign(__entry->vcpu_pc=vcpu_pc;), TP_printk("PC: 0x%016lx", __entry->vcpu_pc))