1 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
4 #include <linux/tracepoint.h>
7 #define TRACE_SYSTEM kvm
10 * Tracepoints for entry/exit to guest
12 TRACE_EVENT(kvm_entry,
13 TP_PROTO(unsigned long vcpu_pc),
17 __field( unsigned long, vcpu_pc )
21 __entry->vcpu_pc = vcpu_pc;
24 TP_printk("PC: 0x%08lx", __entry->vcpu_pc)
28 TP_PROTO(int idx, unsigned int exit_reason, unsigned long vcpu_pc),
29 TP_ARGS(idx, exit_reason, vcpu_pc),
33 __field( unsigned int, exit_reason )
34 __field( unsigned long, vcpu_pc )
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),
46 __print_symbolic(__entry->exit_reason, kvm_arm_exception_class),
50 TRACE_EVENT(kvm_guest_fault,
51 TP_PROTO(unsigned long vcpu_pc, unsigned long hsr,
53 unsigned long long ipa),
54 TP_ARGS(vcpu_pc, hsr, hxfar, ipa),
57 __field( unsigned long, vcpu_pc )
58 __field( unsigned long, hsr )
59 __field( unsigned long, hxfar )
60 __field( unsigned long long, ipa )
64 __entry->vcpu_pc = vcpu_pc;
66 __entry->hxfar = hxfar;
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),
80 __field( unsigned long, 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),
95 __field( unsigned int, type )
96 __field( int, vcpu_idx )
97 __field( int, irq_num )
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,
118 TP_ARGS(vcpu_pc, instr, cpsr),
121 __field( unsigned long, vcpu_pc )
122 __field( unsigned long, instr )
123 __field( unsigned long, cpsr )
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),
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 )
152 __entry->is_write = is_write;
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)
167 TP_PROTO(unsigned long vcpu_pc, bool is_wfe),
168 TP_ARGS(vcpu_pc, is_wfe),
171 __field( unsigned long, vcpu_pc )
172 __field( bool, is_wfe )
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),
189 __field( unsigned long, 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),
204 __field( unsigned long, start )
205 __field( unsigned long, end )
209 __entry->start = start;
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),
222 __field( unsigned long, 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),
237 __field( unsigned long, start )
238 __field( unsigned long, end )
242 __entry->start = start;
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),
255 __field( unsigned long, hva )
262 TP_printk("mmu notifier test age hva: %#08lx", __entry->hva)
266 TP_PROTO(unsigned long vcpu_pc, unsigned long r0, unsigned long imm),
267 TP_ARGS(vcpu_pc, r0, imm),
270 __field( unsigned long, vcpu_pc )
271 __field( unsigned long, r0 )
272 __field( unsigned long, imm )
276 __entry->vcpu_pc = vcpu_pc;
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),
290 __field( unsigned long, vcpu_pc )
291 __field( bool, cache )
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),
308 __field( unsigned long, vcpu_pc )
314 __entry->vcpu_pc = vcpu_pc;
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>