1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if !defined(_TRACE_ARM64_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
3 #define _TRACE_ARM64_KVM_H
5 #include <linux/tracepoint.h>
9 #define TRACE_SYSTEM kvm
11 TRACE_EVENT(kvm_wfx_arm64
,
12 TP_PROTO(unsigned long vcpu_pc
, bool is_wfe
),
13 TP_ARGS(vcpu_pc
, is_wfe
),
16 __field(unsigned long, vcpu_pc
)
21 __entry
->vcpu_pc
= vcpu_pc
;
22 __entry
->is_wfe
= is_wfe
;
25 TP_printk("guest executed wf%c at: 0x%08lx",
26 __entry
->is_wfe
? 'e' : 'i', __entry
->vcpu_pc
)
29 TRACE_EVENT(kvm_hvc_arm64
,
30 TP_PROTO(unsigned long vcpu_pc
, unsigned long r0
, unsigned long imm
),
31 TP_ARGS(vcpu_pc
, r0
, imm
),
34 __field(unsigned long, vcpu_pc
)
35 __field(unsigned long, r0
)
36 __field(unsigned long, imm
)
40 __entry
->vcpu_pc
= vcpu_pc
;
45 TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx)",
46 __entry
->vcpu_pc
, __entry
->r0
, __entry
->imm
)
49 TRACE_EVENT(kvm_arm_setup_debug
,
50 TP_PROTO(struct kvm_vcpu
*vcpu
, __u32 guest_debug
),
51 TP_ARGS(vcpu
, guest_debug
),
54 __field(struct kvm_vcpu
*, vcpu
)
55 __field(__u32
, guest_debug
)
60 __entry
->guest_debug
= guest_debug
;
63 TP_printk("vcpu: %p, flags: 0x%08x", __entry
->vcpu
, __entry
->guest_debug
)
66 TRACE_EVENT(kvm_arm_clear_debug
,
67 TP_PROTO(__u32 guest_debug
),
71 __field(__u32
, guest_debug
)
75 __entry
->guest_debug
= guest_debug
;
78 TP_printk("flags: 0x%08x", __entry
->guest_debug
)
81 TRACE_EVENT(kvm_arm_set_dreg32
,
82 TP_PROTO(const char *name
, __u32 value
),
86 __field(const char *, name
)
92 __entry
->value
= value
;
95 TP_printk("%s: 0x%08x", __entry
->name
, __entry
->value
)
98 TRACE_DEFINE_SIZEOF(__u64
);
100 TRACE_EVENT(kvm_arm_set_regset
,
101 TP_PROTO(const char *type
, int len
, __u64
*control
, __u64
*value
),
102 TP_ARGS(type
, len
, control
, value
),
104 __field(const char *, name
)
106 __array(u64
, ctrls
, 16)
107 __array(u64
, values
, 16)
110 __entry
->name
= type
;
112 memcpy(__entry
->ctrls
, control
, len
<< 3);
113 memcpy(__entry
->values
, value
, len
<< 3);
115 TP_printk("%d %s CTRL:%s VALUE:%s", __entry
->len
, __entry
->name
,
116 __print_array(__entry
->ctrls
, __entry
->len
, sizeof(__u64
)),
117 __print_array(__entry
->values
, __entry
->len
, sizeof(__u64
)))
120 TRACE_EVENT(trap_reg
,
121 TP_PROTO(const char *fn
, int reg
, bool is_write
, u64 write_value
),
122 TP_ARGS(fn
, reg
, is_write
, write_value
),
125 __field(const char *, fn
)
127 __field(bool, is_write
)
128 __field(u64
, write_value
)
134 __entry
->is_write
= is_write
;
135 __entry
->write_value
= write_value
;
138 TP_printk("%s %s reg %d (0x%08llx)", __entry
->fn
, __entry
->is_write
?"write to":"read from", __entry
->reg
, __entry
->write_value
)
141 TRACE_EVENT(kvm_handle_sys_reg
,
142 TP_PROTO(unsigned long hsr
),
146 __field(unsigned long, hsr
)
153 TP_printk("HSR 0x%08lx", __entry
->hsr
)
156 TRACE_EVENT(kvm_sys_access
,
157 TP_PROTO(unsigned long vcpu_pc
, struct sys_reg_params
*params
, const struct sys_reg_desc
*reg
),
158 TP_ARGS(vcpu_pc
, params
, reg
),
161 __field(unsigned long, vcpu_pc
)
162 __field(bool, is_write
)
163 __field(const char *, name
)
172 __entry
->vcpu_pc
= vcpu_pc
;
173 __entry
->is_write
= params
->is_write
;
174 __entry
->name
= reg
->name
;
175 __entry
->Op0
= reg
->Op0
;
176 __entry
->Op0
= reg
->Op0
;
177 __entry
->Op1
= reg
->Op1
;
178 __entry
->CRn
= reg
->CRn
;
179 __entry
->CRm
= reg
->CRm
;
180 __entry
->Op2
= reg
->Op2
;
183 TP_printk("PC: %lx %s (%d,%d,%d,%d,%d) %s",
184 __entry
->vcpu_pc
, __entry
->name
?: "UNKN",
185 __entry
->Op0
, __entry
->Op1
, __entry
->CRn
,
186 __entry
->CRm
, __entry
->Op2
,
187 __entry
->is_write
? "write" : "read")
190 TRACE_EVENT(kvm_set_guest_debug
,
191 TP_PROTO(struct kvm_vcpu
*vcpu
, __u32 guest_debug
),
192 TP_ARGS(vcpu
, guest_debug
),
195 __field(struct kvm_vcpu
*, vcpu
)
196 __field(__u32
, guest_debug
)
200 __entry
->vcpu
= vcpu
;
201 __entry
->guest_debug
= guest_debug
;
204 TP_printk("vcpu: %p, flags: 0x%08x", __entry
->vcpu
, __entry
->guest_debug
)
208 #endif /* _TRACE_ARM64_KVM_H */
210 #undef TRACE_INCLUDE_PATH
211 #define TRACE_INCLUDE_PATH .
212 #undef TRACE_INCLUDE_FILE
213 #define TRACE_INCLUDE_FILE trace
215 /* This part must be outside protection */
216 #include <trace/define_trace.h>