1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #if !defined(_TRACE_HANDLE_EXIT_ARM64_KVM_H) || defined(TRACE_HEADER_MULTI_READ) 3 #define _TRACE_HANDLE_EXIT_ARM64_KVM_H 4 5 #include <linux/tracepoint.h> 6 #include "sys_regs.h" 7 8 #undef TRACE_SYSTEM 9 #define TRACE_SYSTEM kvm 10 11 TRACE_EVENT(kvm_wfx_arm64, 12 TP_PROTO(unsigned long vcpu_pc, bool is_wfe), 13 TP_ARGS(vcpu_pc, is_wfe), 14 15 TP_STRUCT__entry( 16 __field(unsigned long, vcpu_pc) 17 __field(bool, is_wfe) 18 ), 19 20 TP_fast_assign( 21 __entry->vcpu_pc = vcpu_pc; 22 __entry->is_wfe = is_wfe; 23 ), 24 25 TP_printk("guest executed wf%c at: 0x%016lx", 26 __entry->is_wfe ? 'e' : 'i', __entry->vcpu_pc) 27 ); 28 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), 32 33 TP_STRUCT__entry( 34 __field(unsigned long, vcpu_pc) 35 __field(unsigned long, r0) 36 __field(unsigned long, imm) 37 ), 38 39 TP_fast_assign( 40 __entry->vcpu_pc = vcpu_pc; 41 __entry->r0 = r0; 42 __entry->imm = imm; 43 ), 44 45 TP_printk("HVC at 0x%016lx (r0: 0x%016lx, imm: 0x%lx)", 46 __entry->vcpu_pc, __entry->r0, __entry->imm) 47 ); 48 49 TRACE_EVENT(kvm_arm_setup_debug, 50 TP_PROTO(struct kvm_vcpu *vcpu, __u32 guest_debug), 51 TP_ARGS(vcpu, guest_debug), 52 53 TP_STRUCT__entry( 54 __field(struct kvm_vcpu *, vcpu) 55 __field(__u32, guest_debug) 56 ), 57 58 TP_fast_assign( 59 __entry->vcpu = vcpu; 60 __entry->guest_debug = guest_debug; 61 ), 62 63 TP_printk("vcpu: %p, flags: 0x%08x", __entry->vcpu, __entry->guest_debug) 64 ); 65 66 TRACE_EVENT(kvm_arm_clear_debug, 67 TP_PROTO(__u32 guest_debug), 68 TP_ARGS(guest_debug), 69 70 TP_STRUCT__entry( 71 __field(__u32, guest_debug) 72 ), 73 74 TP_fast_assign( 75 __entry->guest_debug = guest_debug; 76 ), 77 78 TP_printk("flags: 0x%08x", __entry->guest_debug) 79 ); 80 81 /* 82 * The dreg32 name is a leftover from a distant past. This will really 83 * output a 64bit value... 84 */ 85 TRACE_EVENT(kvm_arm_set_dreg32, 86 TP_PROTO(const char *name, __u64 value), 87 TP_ARGS(name, value), 88 89 TP_STRUCT__entry( 90 __field(const char *, name) 91 __field(__u64, value) 92 ), 93 94 TP_fast_assign( 95 __entry->name = name; 96 __entry->value = value; 97 ), 98 99 TP_printk("%s: 0x%llx", __entry->name, __entry->value) 100 ); 101 102 TRACE_DEFINE_SIZEOF(__u64); 103 104 TRACE_EVENT(kvm_arm_set_regset, 105 TP_PROTO(const char *type, int len, __u64 *control, __u64 *value), 106 TP_ARGS(type, len, control, value), 107 TP_STRUCT__entry( 108 __field(const char *, name) 109 __field(int, len) 110 __array(u64, ctrls, 16) 111 __array(u64, values, 16) 112 ), 113 TP_fast_assign( 114 __entry->name = type; 115 __entry->len = len; 116 memcpy(__entry->ctrls, control, len << 3); 117 memcpy(__entry->values, value, len << 3); 118 ), 119 TP_printk("%d %s CTRL:%s VALUE:%s", __entry->len, __entry->name, 120 __print_array(__entry->ctrls, __entry->len, sizeof(__u64)), 121 __print_array(__entry->values, __entry->len, sizeof(__u64))) 122 ); 123 124 TRACE_EVENT(trap_reg, 125 TP_PROTO(const char *fn, int reg, bool is_write, u64 write_value), 126 TP_ARGS(fn, reg, is_write, write_value), 127 128 TP_STRUCT__entry( 129 __field(const char *, fn) 130 __field(int, reg) 131 __field(bool, is_write) 132 __field(u64, write_value) 133 ), 134 135 TP_fast_assign( 136 __entry->fn = fn; 137 __entry->reg = reg; 138 __entry->is_write = is_write; 139 __entry->write_value = write_value; 140 ), 141 142 TP_printk("%s %s reg %d (0x%016llx)", __entry->fn, __entry->is_write?"write to":"read from", __entry->reg, __entry->write_value) 143 ); 144 145 TRACE_EVENT(kvm_handle_sys_reg, 146 TP_PROTO(unsigned long hsr), 147 TP_ARGS(hsr), 148 149 TP_STRUCT__entry( 150 __field(unsigned long, hsr) 151 ), 152 153 TP_fast_assign( 154 __entry->hsr = hsr; 155 ), 156 157 TP_printk("HSR 0x%08lx", __entry->hsr) 158 ); 159 160 TRACE_EVENT(kvm_sys_access, 161 TP_PROTO(unsigned long vcpu_pc, struct sys_reg_params *params, const struct sys_reg_desc *reg), 162 TP_ARGS(vcpu_pc, params, reg), 163 164 TP_STRUCT__entry( 165 __field(unsigned long, vcpu_pc) 166 __field(bool, is_write) 167 __field(const char *, name) 168 __field(u8, Op0) 169 __field(u8, Op1) 170 __field(u8, CRn) 171 __field(u8, CRm) 172 __field(u8, Op2) 173 ), 174 175 TP_fast_assign( 176 __entry->vcpu_pc = vcpu_pc; 177 __entry->is_write = params->is_write; 178 __entry->name = reg->name; 179 __entry->Op0 = reg->Op0; 180 __entry->Op0 = reg->Op0; 181 __entry->Op1 = reg->Op1; 182 __entry->CRn = reg->CRn; 183 __entry->CRm = reg->CRm; 184 __entry->Op2 = reg->Op2; 185 ), 186 187 TP_printk("PC: %lx %s (%d,%d,%d,%d,%d) %s", 188 __entry->vcpu_pc, __entry->name ?: "UNKN", 189 __entry->Op0, __entry->Op1, __entry->CRn, 190 __entry->CRm, __entry->Op2, 191 __entry->is_write ? "write" : "read") 192 ); 193 194 TRACE_EVENT(kvm_set_guest_debug, 195 TP_PROTO(struct kvm_vcpu *vcpu, __u32 guest_debug), 196 TP_ARGS(vcpu, guest_debug), 197 198 TP_STRUCT__entry( 199 __field(struct kvm_vcpu *, vcpu) 200 __field(__u32, guest_debug) 201 ), 202 203 TP_fast_assign( 204 __entry->vcpu = vcpu; 205 __entry->guest_debug = guest_debug; 206 ), 207 208 TP_printk("vcpu: %p, flags: 0x%08x", __entry->vcpu, __entry->guest_debug) 209 ); 210 211 #endif /* _TRACE_HANDLE_EXIT_ARM64_KVM_H */ 212 213 #undef TRACE_INCLUDE_PATH 214 #define TRACE_INCLUDE_PATH . 215 #undef TRACE_INCLUDE_FILE 216 #define TRACE_INCLUDE_FILE trace_handle_exit 217 218 /* This part must be outside protection */ 219 #include <trace/define_trace.h> 220