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(unsigned long vcpu_pc),
32 __field( unsigned long, vcpu_pc )
36 __entry->vcpu_pc = vcpu_pc;
39 TP_printk("PC: 0x%08lx", __entry->vcpu_pc)
42 TRACE_EVENT(kvm_guest_fault,
43 TP_PROTO(unsigned long vcpu_pc, unsigned long hsr,
45 unsigned long long ipa),
46 TP_ARGS(vcpu_pc, hsr, hxfar, ipa),
49 __field( unsigned long, vcpu_pc )
50 __field( unsigned long, hsr )
51 __field( unsigned long, hxfar )
52 __field( unsigned long long, ipa )
56 __entry->vcpu_pc = vcpu_pc;
58 __entry->hxfar = hxfar;
62 TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#08lx",
63 __entry->ipa, __entry->hsr,
64 __entry->hxfar, __entry->vcpu_pc)
67 TRACE_EVENT(kvm_irq_line,
68 TP_PROTO(unsigned int type, int vcpu_idx, int irq_num, int level),
69 TP_ARGS(type, vcpu_idx, irq_num, level),
72 __field( unsigned int, type )
73 __field( int, vcpu_idx )
74 __field( int, irq_num )
80 __entry->vcpu_idx = vcpu_idx;
81 __entry->irq_num = irq_num;
82 __entry->level = level;
85 TP_printk("Inject %s interrupt (%d), vcpu->idx: %d, num: %d, level: %d",
86 (__entry->type == KVM_ARM_IRQ_TYPE_CPU) ? "CPU" :
87 (__entry->type == KVM_ARM_IRQ_TYPE_PPI) ? "VGIC PPI" :
88 (__entry->type == KVM_ARM_IRQ_TYPE_SPI) ? "VGIC SPI" : "UNKNOWN",
89 __entry->type, __entry->vcpu_idx, __entry->irq_num, __entry->level)
92 TRACE_EVENT(kvm_mmio_emulate,
93 TP_PROTO(unsigned long vcpu_pc, unsigned long instr,
95 TP_ARGS(vcpu_pc, instr, cpsr),
98 __field( unsigned long, vcpu_pc )
99 __field( unsigned long, instr )
100 __field( unsigned long, cpsr )
104 __entry->vcpu_pc = vcpu_pc;
105 __entry->instr = instr;
106 __entry->cpsr = cpsr;
109 TP_printk("Emulate MMIO at: 0x%08lx (instr: %08lx, cpsr: %08lx)",
110 __entry->vcpu_pc, __entry->instr, __entry->cpsr)
113 /* Architecturally implementation defined CP15 register access */
114 TRACE_EVENT(kvm_emulate_cp15_imp,
115 TP_PROTO(unsigned long Op1, unsigned long Rt1, unsigned long CRn,
116 unsigned long CRm, unsigned long Op2, bool is_write),
117 TP_ARGS(Op1, Rt1, CRn, CRm, Op2, is_write),
120 __field( unsigned int, Op1 )
121 __field( unsigned int, Rt1 )
122 __field( unsigned int, CRn )
123 __field( unsigned int, CRm )
124 __field( unsigned int, Op2 )
125 __field( bool, is_write )
129 __entry->is_write = is_write;
137 TP_printk("Implementation defined CP15: %s\tp15, %u, r%u, c%u, c%u, %u",
138 (__entry->is_write) ? "mcr" : "mrc",
139 __entry->Op1, __entry->Rt1, __entry->CRn,
140 __entry->CRm, __entry->Op2)
144 TP_PROTO(unsigned long vcpu_pc),
148 __field( unsigned long, vcpu_pc )
152 __entry->vcpu_pc = vcpu_pc;
155 TP_printk("guest executed wfi at: 0x%08lx", __entry->vcpu_pc)
158 TRACE_EVENT(kvm_unmap_hva,
159 TP_PROTO(unsigned long hva),
163 __field( unsigned long, hva )
170 TP_printk("mmu notifier unmap hva: %#08lx", __entry->hva)
173 TRACE_EVENT(kvm_unmap_hva_range,
174 TP_PROTO(unsigned long start, unsigned long end),
178 __field( unsigned long, start )
179 __field( unsigned long, end )
183 __entry->start = start;
187 TP_printk("mmu notifier unmap range: %#08lx -- %#08lx",
188 __entry->start, __entry->end)
191 TRACE_EVENT(kvm_set_spte_hva,
192 TP_PROTO(unsigned long hva),
196 __field( unsigned long, hva )
203 TP_printk("mmu notifier set pte hva: %#08lx", __entry->hva)
207 TP_PROTO(unsigned long vcpu_pc, unsigned long r0, unsigned long imm),
208 TP_ARGS(vcpu_pc, r0, imm),
211 __field( unsigned long, vcpu_pc )
212 __field( unsigned long, r0 )
213 __field( unsigned long, imm )
217 __entry->vcpu_pc = vcpu_pc;
222 TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx",
223 __entry->vcpu_pc, __entry->r0, __entry->imm)
226 TRACE_EVENT(kvm_set_way_flush,
227 TP_PROTO(unsigned long vcpu_pc, bool cache),
228 TP_ARGS(vcpu_pc, cache),
231 __field( unsigned long, vcpu_pc )
232 __field( bool, cache )
236 __entry->vcpu_pc = vcpu_pc;
237 __entry->cache = cache;
240 TP_printk("S/W flush at 0x%016lx (cache %s)",
241 __entry->vcpu_pc, __entry->cache ? "on" : "off")
244 TRACE_EVENT(kvm_toggle_cache,
245 TP_PROTO(unsigned long vcpu_pc, bool was, bool now),
246 TP_ARGS(vcpu_pc, was, now),
249 __field( unsigned long, vcpu_pc )
255 __entry->vcpu_pc = vcpu_pc;
260 TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
261 __entry->vcpu_pc, __entry->was ? "on" : "off",
262 __entry->now ? "on" : "off")
265 #endif /* _TRACE_KVM_H */
267 #undef TRACE_INCLUDE_PATH
268 #define TRACE_INCLUDE_PATH arch/arm/kvm
269 #undef TRACE_INCLUDE_FILE
270 #define TRACE_INCLUDE_FILE trace
272 /* This part must be outside protection */
273 #include <trace/define_trace.h>