Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 1 | #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ) |
| 2 | #define _TRACE_KVM_H |
| 3 | |
| 4 | #include <linux/tracepoint.h> |
| 5 | |
| 6 | #undef TRACE_SYSTEM |
| 7 | #define TRACE_SYSTEM kvm |
| 8 | |
| 9 | /* |
| 10 | * Tracepoints for entry/exit to guest |
| 11 | */ |
| 12 | TRACE_EVENT(kvm_entry, |
| 13 | TP_PROTO(unsigned long vcpu_pc), |
| 14 | TP_ARGS(vcpu_pc), |
| 15 | |
| 16 | TP_STRUCT__entry( |
| 17 | __field( unsigned long, vcpu_pc ) |
| 18 | ), |
| 19 | |
| 20 | TP_fast_assign( |
| 21 | __entry->vcpu_pc = vcpu_pc; |
| 22 | ), |
| 23 | |
| 24 | TP_printk("PC: 0x%08lx", __entry->vcpu_pc) |
| 25 | ); |
| 26 | |
| 27 | TRACE_EVENT(kvm_exit, |
Wei Huang | 91314cb | 2015-01-30 13:09:26 -0500 | [diff] [blame] | 28 | TP_PROTO(unsigned int exit_reason, unsigned long vcpu_pc), |
| 29 | TP_ARGS(exit_reason, vcpu_pc), |
Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 30 | |
| 31 | TP_STRUCT__entry( |
Wei Huang | 91314cb | 2015-01-30 13:09:26 -0500 | [diff] [blame] | 32 | __field( unsigned int, exit_reason ) |
Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 33 | __field( unsigned long, vcpu_pc ) |
| 34 | ), |
| 35 | |
| 36 | TP_fast_assign( |
Wei Huang | 91314cb | 2015-01-30 13:09:26 -0500 | [diff] [blame] | 37 | __entry->exit_reason = exit_reason; |
Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 38 | __entry->vcpu_pc = vcpu_pc; |
| 39 | ), |
| 40 | |
Wei Huang | 91314cb | 2015-01-30 13:09:26 -0500 | [diff] [blame] | 41 | TP_printk("HSR_EC: 0x%04x, PC: 0x%08lx", |
| 42 | __entry->exit_reason, |
| 43 | __entry->vcpu_pc) |
Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 44 | ); |
| 45 | |
Christoffer Dall | 94f8e64 | 2013-01-20 18:28:12 -0500 | [diff] [blame] | 46 | TRACE_EVENT(kvm_guest_fault, |
| 47 | TP_PROTO(unsigned long vcpu_pc, unsigned long hsr, |
| 48 | unsigned long hxfar, |
| 49 | unsigned long long ipa), |
| 50 | TP_ARGS(vcpu_pc, hsr, hxfar, ipa), |
| 51 | |
| 52 | TP_STRUCT__entry( |
| 53 | __field( unsigned long, vcpu_pc ) |
| 54 | __field( unsigned long, hsr ) |
| 55 | __field( unsigned long, hxfar ) |
| 56 | __field( unsigned long long, ipa ) |
| 57 | ), |
| 58 | |
| 59 | TP_fast_assign( |
| 60 | __entry->vcpu_pc = vcpu_pc; |
| 61 | __entry->hsr = hsr; |
| 62 | __entry->hxfar = hxfar; |
| 63 | __entry->ipa = ipa; |
| 64 | ), |
| 65 | |
Christoffer Dall | 6e72cc5 | 2013-08-08 20:34:22 -0700 | [diff] [blame] | 66 | TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#08lx", |
| 67 | __entry->ipa, __entry->hsr, |
| 68 | __entry->hxfar, __entry->vcpu_pc) |
Christoffer Dall | 94f8e64 | 2013-01-20 18:28:12 -0500 | [diff] [blame] | 69 | ); |
| 70 | |
Christoffer Dall | 86ce8535 | 2013-01-20 18:28:08 -0500 | [diff] [blame] | 71 | TRACE_EVENT(kvm_irq_line, |
| 72 | TP_PROTO(unsigned int type, int vcpu_idx, int irq_num, int level), |
| 73 | TP_ARGS(type, vcpu_idx, irq_num, level), |
| 74 | |
| 75 | TP_STRUCT__entry( |
| 76 | __field( unsigned int, type ) |
| 77 | __field( int, vcpu_idx ) |
| 78 | __field( int, irq_num ) |
| 79 | __field( int, level ) |
| 80 | ), |
| 81 | |
| 82 | TP_fast_assign( |
| 83 | __entry->type = type; |
| 84 | __entry->vcpu_idx = vcpu_idx; |
| 85 | __entry->irq_num = irq_num; |
| 86 | __entry->level = level; |
| 87 | ), |
| 88 | |
| 89 | TP_printk("Inject %s interrupt (%d), vcpu->idx: %d, num: %d, level: %d", |
| 90 | (__entry->type == KVM_ARM_IRQ_TYPE_CPU) ? "CPU" : |
| 91 | (__entry->type == KVM_ARM_IRQ_TYPE_PPI) ? "VGIC PPI" : |
| 92 | (__entry->type == KVM_ARM_IRQ_TYPE_SPI) ? "VGIC SPI" : "UNKNOWN", |
| 93 | __entry->type, __entry->vcpu_idx, __entry->irq_num, __entry->level) |
| 94 | ); |
| 95 | |
Christoffer Dall | 45e96ea | 2013-01-20 18:43:58 -0500 | [diff] [blame] | 96 | TRACE_EVENT(kvm_mmio_emulate, |
| 97 | TP_PROTO(unsigned long vcpu_pc, unsigned long instr, |
| 98 | unsigned long cpsr), |
| 99 | TP_ARGS(vcpu_pc, instr, cpsr), |
| 100 | |
| 101 | TP_STRUCT__entry( |
| 102 | __field( unsigned long, vcpu_pc ) |
| 103 | __field( unsigned long, instr ) |
| 104 | __field( unsigned long, cpsr ) |
| 105 | ), |
| 106 | |
| 107 | TP_fast_assign( |
| 108 | __entry->vcpu_pc = vcpu_pc; |
| 109 | __entry->instr = instr; |
| 110 | __entry->cpsr = cpsr; |
| 111 | ), |
| 112 | |
| 113 | TP_printk("Emulate MMIO at: 0x%08lx (instr: %08lx, cpsr: %08lx)", |
| 114 | __entry->vcpu_pc, __entry->instr, __entry->cpsr) |
| 115 | ); |
| 116 | |
Christoffer Dall | 5b3e5e5 | 2013-01-20 18:28:09 -0500 | [diff] [blame] | 117 | /* Architecturally implementation defined CP15 register access */ |
| 118 | TRACE_EVENT(kvm_emulate_cp15_imp, |
| 119 | TP_PROTO(unsigned long Op1, unsigned long Rt1, unsigned long CRn, |
| 120 | unsigned long CRm, unsigned long Op2, bool is_write), |
| 121 | TP_ARGS(Op1, Rt1, CRn, CRm, Op2, is_write), |
| 122 | |
| 123 | TP_STRUCT__entry( |
| 124 | __field( unsigned int, Op1 ) |
| 125 | __field( unsigned int, Rt1 ) |
| 126 | __field( unsigned int, CRn ) |
| 127 | __field( unsigned int, CRm ) |
| 128 | __field( unsigned int, Op2 ) |
| 129 | __field( bool, is_write ) |
| 130 | ), |
| 131 | |
| 132 | TP_fast_assign( |
| 133 | __entry->is_write = is_write; |
| 134 | __entry->Op1 = Op1; |
| 135 | __entry->Rt1 = Rt1; |
| 136 | __entry->CRn = CRn; |
| 137 | __entry->CRm = CRm; |
| 138 | __entry->Op2 = Op2; |
| 139 | ), |
| 140 | |
| 141 | TP_printk("Implementation defined CP15: %s\tp15, %u, r%u, c%u, c%u, %u", |
| 142 | (__entry->is_write) ? "mcr" : "mrc", |
| 143 | __entry->Op1, __entry->Rt1, __entry->CRn, |
| 144 | __entry->CRm, __entry->Op2) |
| 145 | ); |
| 146 | |
Andre Przywara | 924de80 | 2015-01-12 16:56:16 +0000 | [diff] [blame] | 147 | TRACE_EVENT(kvm_wfx, |
| 148 | TP_PROTO(unsigned long vcpu_pc, bool is_wfe), |
| 149 | TP_ARGS(vcpu_pc, is_wfe), |
Christoffer Dall | 5b3e5e5 | 2013-01-20 18:28:09 -0500 | [diff] [blame] | 150 | |
| 151 | TP_STRUCT__entry( |
| 152 | __field( unsigned long, vcpu_pc ) |
Andre Przywara | 924de80 | 2015-01-12 16:56:16 +0000 | [diff] [blame] | 153 | __field( bool, is_wfe ) |
Christoffer Dall | 5b3e5e5 | 2013-01-20 18:28:09 -0500 | [diff] [blame] | 154 | ), |
| 155 | |
| 156 | TP_fast_assign( |
| 157 | __entry->vcpu_pc = vcpu_pc; |
Andre Przywara | 924de80 | 2015-01-12 16:56:16 +0000 | [diff] [blame] | 158 | __entry->is_wfe = is_wfe; |
Christoffer Dall | 5b3e5e5 | 2013-01-20 18:28:09 -0500 | [diff] [blame] | 159 | ), |
| 160 | |
Andre Przywara | 924de80 | 2015-01-12 16:56:16 +0000 | [diff] [blame] | 161 | TP_printk("guest executed wf%c at: 0x%08lx", |
| 162 | __entry->is_wfe ? 'e' : 'i', __entry->vcpu_pc) |
Christoffer Dall | 5b3e5e5 | 2013-01-20 18:28:09 -0500 | [diff] [blame] | 163 | ); |
| 164 | |
Christoffer Dall | d5d8184 | 2013-01-20 18:28:07 -0500 | [diff] [blame] | 165 | TRACE_EVENT(kvm_unmap_hva, |
| 166 | TP_PROTO(unsigned long hva), |
| 167 | TP_ARGS(hva), |
Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 168 | |
Christoffer Dall | d5d8184 | 2013-01-20 18:28:07 -0500 | [diff] [blame] | 169 | TP_STRUCT__entry( |
| 170 | __field( unsigned long, hva ) |
| 171 | ), |
| 172 | |
| 173 | TP_fast_assign( |
| 174 | __entry->hva = hva; |
| 175 | ), |
| 176 | |
| 177 | TP_printk("mmu notifier unmap hva: %#08lx", __entry->hva) |
| 178 | ); |
| 179 | |
| 180 | TRACE_EVENT(kvm_unmap_hva_range, |
| 181 | TP_PROTO(unsigned long start, unsigned long end), |
| 182 | TP_ARGS(start, end), |
| 183 | |
| 184 | TP_STRUCT__entry( |
| 185 | __field( unsigned long, start ) |
| 186 | __field( unsigned long, end ) |
| 187 | ), |
| 188 | |
| 189 | TP_fast_assign( |
| 190 | __entry->start = start; |
| 191 | __entry->end = end; |
| 192 | ), |
| 193 | |
| 194 | TP_printk("mmu notifier unmap range: %#08lx -- %#08lx", |
| 195 | __entry->start, __entry->end) |
| 196 | ); |
| 197 | |
| 198 | TRACE_EVENT(kvm_set_spte_hva, |
| 199 | TP_PROTO(unsigned long hva), |
| 200 | TP_ARGS(hva), |
| 201 | |
| 202 | TP_STRUCT__entry( |
| 203 | __field( unsigned long, hva ) |
| 204 | ), |
| 205 | |
| 206 | TP_fast_assign( |
| 207 | __entry->hva = hva; |
| 208 | ), |
| 209 | |
| 210 | TP_printk("mmu notifier set pte hva: %#08lx", __entry->hva) |
| 211 | ); |
Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 212 | |
Christoffer Dall | 5b3e5e5 | 2013-01-20 18:28:09 -0500 | [diff] [blame] | 213 | TRACE_EVENT(kvm_hvc, |
| 214 | TP_PROTO(unsigned long vcpu_pc, unsigned long r0, unsigned long imm), |
| 215 | TP_ARGS(vcpu_pc, r0, imm), |
| 216 | |
| 217 | TP_STRUCT__entry( |
| 218 | __field( unsigned long, vcpu_pc ) |
| 219 | __field( unsigned long, r0 ) |
| 220 | __field( unsigned long, imm ) |
| 221 | ), |
| 222 | |
| 223 | TP_fast_assign( |
| 224 | __entry->vcpu_pc = vcpu_pc; |
| 225 | __entry->r0 = r0; |
| 226 | __entry->imm = imm; |
| 227 | ), |
| 228 | |
| 229 | TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx", |
| 230 | __entry->vcpu_pc, __entry->r0, __entry->imm) |
| 231 | ); |
| 232 | |
Marc Zyngier | 3c1e716 | 2014-12-19 16:05:31 +0000 | [diff] [blame] | 233 | TRACE_EVENT(kvm_set_way_flush, |
| 234 | TP_PROTO(unsigned long vcpu_pc, bool cache), |
| 235 | TP_ARGS(vcpu_pc, cache), |
| 236 | |
| 237 | TP_STRUCT__entry( |
| 238 | __field( unsigned long, vcpu_pc ) |
| 239 | __field( bool, cache ) |
| 240 | ), |
| 241 | |
| 242 | TP_fast_assign( |
| 243 | __entry->vcpu_pc = vcpu_pc; |
| 244 | __entry->cache = cache; |
| 245 | ), |
| 246 | |
| 247 | TP_printk("S/W flush at 0x%016lx (cache %s)", |
| 248 | __entry->vcpu_pc, __entry->cache ? "on" : "off") |
| 249 | ); |
| 250 | |
| 251 | TRACE_EVENT(kvm_toggle_cache, |
| 252 | TP_PROTO(unsigned long vcpu_pc, bool was, bool now), |
| 253 | TP_ARGS(vcpu_pc, was, now), |
| 254 | |
| 255 | TP_STRUCT__entry( |
| 256 | __field( unsigned long, vcpu_pc ) |
| 257 | __field( bool, was ) |
| 258 | __field( bool, now ) |
| 259 | ), |
| 260 | |
| 261 | TP_fast_assign( |
| 262 | __entry->vcpu_pc = vcpu_pc; |
| 263 | __entry->was = was; |
| 264 | __entry->now = now; |
| 265 | ), |
| 266 | |
| 267 | TP_printk("VM op at 0x%016lx (cache was %s, now %s)", |
| 268 | __entry->vcpu_pc, __entry->was ? "on" : "off", |
| 269 | __entry->now ? "on" : "off") |
| 270 | ); |
| 271 | |
Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 272 | #endif /* _TRACE_KVM_H */ |
| 273 | |
| 274 | #undef TRACE_INCLUDE_PATH |
| 275 | #define TRACE_INCLUDE_PATH arch/arm/kvm |
| 276 | #undef TRACE_INCLUDE_FILE |
| 277 | #define TRACE_INCLUDE_FILE trace |
| 278 | |
| 279 | /* This part must be outside protection */ |
| 280 | #include <trace/define_trace.h> |