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
, bool is_wfe
),
145 TP_ARGS(vcpu_pc
, is_wfe
),
148 __field( unsigned long, vcpu_pc
)
149 __field( bool, is_wfe
)
153 __entry
->vcpu_pc
= vcpu_pc
;
154 __entry
->is_wfe
= is_wfe
;
157 TP_printk("guest executed wf%c at: 0x%08lx",
158 __entry
->is_wfe
? 'e' : 'i', __entry
->vcpu_pc
)
161 TRACE_EVENT(kvm_unmap_hva
,
162 TP_PROTO(unsigned long hva
),
166 __field( unsigned long, hva
)
173 TP_printk("mmu notifier unmap hva: %#08lx", __entry
->hva
)
176 TRACE_EVENT(kvm_unmap_hva_range
,
177 TP_PROTO(unsigned long start
, unsigned long end
),
181 __field( unsigned long, start
)
182 __field( unsigned long, end
)
186 __entry
->start
= start
;
190 TP_printk("mmu notifier unmap range: %#08lx -- %#08lx",
191 __entry
->start
, __entry
->end
)
194 TRACE_EVENT(kvm_set_spte_hva
,
195 TP_PROTO(unsigned long hva
),
199 __field( unsigned long, hva
)
206 TP_printk("mmu notifier set pte hva: %#08lx", __entry
->hva
)
210 TP_PROTO(unsigned long vcpu_pc
, unsigned long r0
, unsigned long imm
),
211 TP_ARGS(vcpu_pc
, r0
, imm
),
214 __field( unsigned long, vcpu_pc
)
215 __field( unsigned long, r0
)
216 __field( unsigned long, imm
)
220 __entry
->vcpu_pc
= vcpu_pc
;
225 TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx",
226 __entry
->vcpu_pc
, __entry
->r0
, __entry
->imm
)
229 TRACE_EVENT(kvm_set_way_flush
,
230 TP_PROTO(unsigned long vcpu_pc
, bool cache
),
231 TP_ARGS(vcpu_pc
, cache
),
234 __field( unsigned long, vcpu_pc
)
235 __field( bool, cache
)
239 __entry
->vcpu_pc
= vcpu_pc
;
240 __entry
->cache
= cache
;
243 TP_printk("S/W flush at 0x%016lx (cache %s)",
244 __entry
->vcpu_pc
, __entry
->cache
? "on" : "off")
247 TRACE_EVENT(kvm_toggle_cache
,
248 TP_PROTO(unsigned long vcpu_pc
, bool was
, bool now
),
249 TP_ARGS(vcpu_pc
, was
, now
),
252 __field( unsigned long, vcpu_pc
)
258 __entry
->vcpu_pc
= vcpu_pc
;
263 TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
264 __entry
->vcpu_pc
, __entry
->was
? "on" : "off",
265 __entry
->now
? "on" : "off")
268 #endif /* _TRACE_KVM_H */
270 #undef TRACE_INCLUDE_PATH
271 #define TRACE_INCLUDE_PATH arch/arm/kvm
272 #undef TRACE_INCLUDE_FILE
273 #define TRACE_INCLUDE_FILE trace
275 /* This part must be outside protection */
276 #include <trace/define_trace.h>