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 int exit_reason
, unsigned long vcpu_pc
),
29 TP_ARGS(exit_reason
, vcpu_pc
),
32 __field( unsigned int, exit_reason
)
33 __field( unsigned long, vcpu_pc
)
37 __entry
->exit_reason
= exit_reason
;
38 __entry
->vcpu_pc
= vcpu_pc
;
41 TP_printk("HSR_EC: 0x%04x, PC: 0x%08lx",
46 TRACE_EVENT(kvm_guest_fault
,
47 TP_PROTO(unsigned long vcpu_pc
, unsigned long hsr
,
49 unsigned long long ipa
),
50 TP_ARGS(vcpu_pc
, hsr
, hxfar
, ipa
),
53 __field( unsigned long, vcpu_pc
)
54 __field( unsigned long, hsr
)
55 __field( unsigned long, hxfar
)
56 __field( unsigned long long, ipa
)
60 __entry
->vcpu_pc
= vcpu_pc
;
62 __entry
->hxfar
= hxfar
;
66 TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#08lx",
67 __entry
->ipa
, __entry
->hsr
,
68 __entry
->hxfar
, __entry
->vcpu_pc
)
71 TRACE_EVENT(kvm_access_fault
,
72 TP_PROTO(unsigned long ipa
),
76 __field( unsigned long, ipa
)
83 TP_printk("IPA: %lx", __entry
->ipa
)
86 TRACE_EVENT(kvm_irq_line
,
87 TP_PROTO(unsigned int type
, int vcpu_idx
, int irq_num
, int level
),
88 TP_ARGS(type
, vcpu_idx
, irq_num
, level
),
91 __field( unsigned int, type
)
92 __field( int, vcpu_idx
)
93 __field( int, irq_num
)
99 __entry
->vcpu_idx
= vcpu_idx
;
100 __entry
->irq_num
= irq_num
;
101 __entry
->level
= level
;
104 TP_printk("Inject %s interrupt (%d), vcpu->idx: %d, num: %d, level: %d",
105 (__entry
->type
== KVM_ARM_IRQ_TYPE_CPU
) ? "CPU" :
106 (__entry
->type
== KVM_ARM_IRQ_TYPE_PPI
) ? "VGIC PPI" :
107 (__entry
->type
== KVM_ARM_IRQ_TYPE_SPI
) ? "VGIC SPI" : "UNKNOWN",
108 __entry
->type
, __entry
->vcpu_idx
, __entry
->irq_num
, __entry
->level
)
111 TRACE_EVENT(kvm_mmio_emulate
,
112 TP_PROTO(unsigned long vcpu_pc
, unsigned long instr
,
114 TP_ARGS(vcpu_pc
, instr
, cpsr
),
117 __field( unsigned long, vcpu_pc
)
118 __field( unsigned long, instr
)
119 __field( unsigned long, cpsr
)
123 __entry
->vcpu_pc
= vcpu_pc
;
124 __entry
->instr
= instr
;
125 __entry
->cpsr
= cpsr
;
128 TP_printk("Emulate MMIO at: 0x%08lx (instr: %08lx, cpsr: %08lx)",
129 __entry
->vcpu_pc
, __entry
->instr
, __entry
->cpsr
)
132 /* Architecturally implementation defined CP15 register access */
133 TRACE_EVENT(kvm_emulate_cp15_imp
,
134 TP_PROTO(unsigned long Op1
, unsigned long Rt1
, unsigned long CRn
,
135 unsigned long CRm
, unsigned long Op2
, bool is_write
),
136 TP_ARGS(Op1
, Rt1
, CRn
, CRm
, Op2
, is_write
),
139 __field( unsigned int, Op1
)
140 __field( unsigned int, Rt1
)
141 __field( unsigned int, CRn
)
142 __field( unsigned int, CRm
)
143 __field( unsigned int, Op2
)
144 __field( bool, is_write
)
148 __entry
->is_write
= is_write
;
156 TP_printk("Implementation defined CP15: %s\tp15, %u, r%u, c%u, c%u, %u",
157 (__entry
->is_write
) ? "mcr" : "mrc",
158 __entry
->Op1
, __entry
->Rt1
, __entry
->CRn
,
159 __entry
->CRm
, __entry
->Op2
)
163 TP_PROTO(unsigned long vcpu_pc
, bool is_wfe
),
164 TP_ARGS(vcpu_pc
, is_wfe
),
167 __field( unsigned long, vcpu_pc
)
168 __field( bool, is_wfe
)
172 __entry
->vcpu_pc
= vcpu_pc
;
173 __entry
->is_wfe
= is_wfe
;
176 TP_printk("guest executed wf%c at: 0x%08lx",
177 __entry
->is_wfe
? 'e' : 'i', __entry
->vcpu_pc
)
180 TRACE_EVENT(kvm_unmap_hva
,
181 TP_PROTO(unsigned long hva
),
185 __field( unsigned long, hva
)
192 TP_printk("mmu notifier unmap hva: %#08lx", __entry
->hva
)
195 TRACE_EVENT(kvm_unmap_hva_range
,
196 TP_PROTO(unsigned long start
, unsigned long end
),
200 __field( unsigned long, start
)
201 __field( unsigned long, end
)
205 __entry
->start
= start
;
209 TP_printk("mmu notifier unmap range: %#08lx -- %#08lx",
210 __entry
->start
, __entry
->end
)
213 TRACE_EVENT(kvm_set_spte_hva
,
214 TP_PROTO(unsigned long hva
),
218 __field( unsigned long, hva
)
225 TP_printk("mmu notifier set pte hva: %#08lx", __entry
->hva
)
228 TRACE_EVENT(kvm_age_hva
,
229 TP_PROTO(unsigned long start
, unsigned long end
),
233 __field( unsigned long, start
)
234 __field( unsigned long, end
)
238 __entry
->start
= start
;
242 TP_printk("mmu notifier age hva: %#08lx -- %#08lx",
243 __entry
->start
, __entry
->end
)
246 TRACE_EVENT(kvm_test_age_hva
,
247 TP_PROTO(unsigned long hva
),
251 __field( unsigned long, hva
)
258 TP_printk("mmu notifier test age hva: %#08lx", __entry
->hva
)
262 TP_PROTO(unsigned long vcpu_pc
, unsigned long r0
, unsigned long imm
),
263 TP_ARGS(vcpu_pc
, r0
, imm
),
266 __field( unsigned long, vcpu_pc
)
267 __field( unsigned long, r0
)
268 __field( unsigned long, imm
)
272 __entry
->vcpu_pc
= vcpu_pc
;
277 TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx",
278 __entry
->vcpu_pc
, __entry
->r0
, __entry
->imm
)
281 TRACE_EVENT(kvm_set_way_flush
,
282 TP_PROTO(unsigned long vcpu_pc
, bool cache
),
283 TP_ARGS(vcpu_pc
, cache
),
286 __field( unsigned long, vcpu_pc
)
287 __field( bool, cache
)
291 __entry
->vcpu_pc
= vcpu_pc
;
292 __entry
->cache
= cache
;
295 TP_printk("S/W flush at 0x%016lx (cache %s)",
296 __entry
->vcpu_pc
, __entry
->cache
? "on" : "off")
299 TRACE_EVENT(kvm_toggle_cache
,
300 TP_PROTO(unsigned long vcpu_pc
, bool was
, bool now
),
301 TP_ARGS(vcpu_pc
, was
, now
),
304 __field( unsigned long, vcpu_pc
)
310 __entry
->vcpu_pc
= vcpu_pc
;
315 TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
316 __entry
->vcpu_pc
, __entry
->was
? "on" : "off",
317 __entry
->now
? "on" : "off")
320 #endif /* _TRACE_KVM_H */
322 #undef TRACE_INCLUDE_PATH
323 #define TRACE_INCLUDE_PATH arch/arm/kvm
324 #undef TRACE_INCLUDE_FILE
325 #define TRACE_INCLUDE_FILE trace
327 /* This part must be outside protection */
328 #include <trace/define_trace.h>