1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
5 #include <linux/tracepoint.h>
8 #define TRACE_SYSTEM kvm
11 * Tracepoints for entry/exit to guest
13 TRACE_EVENT(kvm_entry
,
14 TP_PROTO(unsigned long vcpu_pc
),
18 __field( unsigned long, vcpu_pc
)
22 __entry
->vcpu_pc
= vcpu_pc
;
25 TP_printk("PC: 0x%08lx", __entry
->vcpu_pc
)
29 TP_PROTO(int idx
, unsigned int exit_reason
, unsigned long vcpu_pc
),
30 TP_ARGS(idx
, exit_reason
, vcpu_pc
),
34 __field( unsigned int, exit_reason
)
35 __field( unsigned long, vcpu_pc
)
40 __entry
->exit_reason
= exit_reason
;
41 __entry
->vcpu_pc
= vcpu_pc
;
44 TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%08lx",
45 __print_symbolic(__entry
->idx
, kvm_arm_exception_type
),
47 __print_symbolic(__entry
->exit_reason
, kvm_arm_exception_class
),
51 TRACE_EVENT(kvm_guest_fault
,
52 TP_PROTO(unsigned long vcpu_pc
, unsigned long hsr
,
54 unsigned long long ipa
),
55 TP_ARGS(vcpu_pc
, hsr
, hxfar
, ipa
),
58 __field( unsigned long, vcpu_pc
)
59 __field( unsigned long, hsr
)
60 __field( unsigned long, hxfar
)
61 __field( unsigned long long, ipa
)
65 __entry
->vcpu_pc
= vcpu_pc
;
67 __entry
->hxfar
= hxfar
;
71 TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#08lx",
72 __entry
->ipa
, __entry
->hsr
,
73 __entry
->hxfar
, __entry
->vcpu_pc
)
76 TRACE_EVENT(kvm_access_fault
,
77 TP_PROTO(unsigned long ipa
),
81 __field( unsigned long, ipa
)
88 TP_printk("IPA: %lx", __entry
->ipa
)
91 TRACE_EVENT(kvm_irq_line
,
92 TP_PROTO(unsigned int type
, int vcpu_idx
, int irq_num
, int level
),
93 TP_ARGS(type
, vcpu_idx
, irq_num
, level
),
96 __field( unsigned int, type
)
97 __field( int, vcpu_idx
)
98 __field( int, irq_num
)
103 __entry
->type
= type
;
104 __entry
->vcpu_idx
= vcpu_idx
;
105 __entry
->irq_num
= irq_num
;
106 __entry
->level
= level
;
109 TP_printk("Inject %s interrupt (%d), vcpu->idx: %d, num: %d, level: %d",
110 (__entry
->type
== KVM_ARM_IRQ_TYPE_CPU
) ? "CPU" :
111 (__entry
->type
== KVM_ARM_IRQ_TYPE_PPI
) ? "VGIC PPI" :
112 (__entry
->type
== KVM_ARM_IRQ_TYPE_SPI
) ? "VGIC SPI" : "UNKNOWN",
113 __entry
->type
, __entry
->vcpu_idx
, __entry
->irq_num
, __entry
->level
)
116 TRACE_EVENT(kvm_mmio_emulate
,
117 TP_PROTO(unsigned long vcpu_pc
, unsigned long instr
,
119 TP_ARGS(vcpu_pc
, instr
, cpsr
),
122 __field( unsigned long, vcpu_pc
)
123 __field( unsigned long, instr
)
124 __field( unsigned long, cpsr
)
128 __entry
->vcpu_pc
= vcpu_pc
;
129 __entry
->instr
= instr
;
130 __entry
->cpsr
= cpsr
;
133 TP_printk("Emulate MMIO at: 0x%08lx (instr: %08lx, cpsr: %08lx)",
134 __entry
->vcpu_pc
, __entry
->instr
, __entry
->cpsr
)
137 TRACE_EVENT(kvm_unmap_hva
,
138 TP_PROTO(unsigned long hva
),
142 __field( unsigned long, hva
)
149 TP_printk("mmu notifier unmap hva: %#08lx", __entry
->hva
)
152 TRACE_EVENT(kvm_unmap_hva_range
,
153 TP_PROTO(unsigned long start
, unsigned long end
),
157 __field( unsigned long, start
)
158 __field( unsigned long, end
)
162 __entry
->start
= start
;
166 TP_printk("mmu notifier unmap range: %#08lx -- %#08lx",
167 __entry
->start
, __entry
->end
)
170 TRACE_EVENT(kvm_set_spte_hva
,
171 TP_PROTO(unsigned long hva
),
175 __field( unsigned long, hva
)
182 TP_printk("mmu notifier set pte hva: %#08lx", __entry
->hva
)
185 TRACE_EVENT(kvm_age_hva
,
186 TP_PROTO(unsigned long start
, unsigned long end
),
190 __field( unsigned long, start
)
191 __field( unsigned long, end
)
195 __entry
->start
= start
;
199 TP_printk("mmu notifier age hva: %#08lx -- %#08lx",
200 __entry
->start
, __entry
->end
)
203 TRACE_EVENT(kvm_test_age_hva
,
204 TP_PROTO(unsigned long hva
),
208 __field( unsigned long, hva
)
215 TP_printk("mmu notifier test age hva: %#08lx", __entry
->hva
)
218 TRACE_EVENT(kvm_set_way_flush
,
219 TP_PROTO(unsigned long vcpu_pc
, bool cache
),
220 TP_ARGS(vcpu_pc
, cache
),
223 __field( unsigned long, vcpu_pc
)
224 __field( bool, cache
)
228 __entry
->vcpu_pc
= vcpu_pc
;
229 __entry
->cache
= cache
;
232 TP_printk("S/W flush at 0x%016lx (cache %s)",
233 __entry
->vcpu_pc
, __entry
->cache
? "on" : "off")
236 TRACE_EVENT(kvm_toggle_cache
,
237 TP_PROTO(unsigned long vcpu_pc
, bool was
, bool now
),
238 TP_ARGS(vcpu_pc
, was
, now
),
241 __field( unsigned long, vcpu_pc
)
247 __entry
->vcpu_pc
= vcpu_pc
;
252 TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
253 __entry
->vcpu_pc
, __entry
->was
? "on" : "off",
254 __entry
->now
? "on" : "off")
258 * Tracepoints for arch_timer
260 TRACE_EVENT(kvm_timer_update_irq
,
261 TP_PROTO(unsigned long vcpu_id
, __u32 irq
, int level
),
262 TP_ARGS(vcpu_id
, irq
, level
),
265 __field( unsigned long, vcpu_id
)
266 __field( __u32
, irq
)
267 __field( int, level
)
271 __entry
->vcpu_id
= vcpu_id
;
273 __entry
->level
= level
;
276 TP_printk("VCPU: %ld, IRQ %d, level %d",
277 __entry
->vcpu_id
, __entry
->irq
, __entry
->level
)
280 #endif /* _TRACE_KVM_H */
282 #undef TRACE_INCLUDE_PATH
283 #define TRACE_INCLUDE_PATH ../../../virt/kvm/arm
284 #undef TRACE_INCLUDE_FILE
285 #define TRACE_INCLUDE_FILE trace
287 /* This part must be outside protection */
288 #include <trace/define_trace.h>