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, |
| 28 | TP_PROTO(unsigned long vcpu_pc), |
| 29 | TP_ARGS(vcpu_pc), |
| 30 | |
| 31 | TP_STRUCT__entry( |
| 32 | __field( unsigned long, vcpu_pc ) |
| 33 | ), |
| 34 | |
| 35 | TP_fast_assign( |
| 36 | __entry->vcpu_pc = vcpu_pc; |
| 37 | ), |
| 38 | |
| 39 | TP_printk("PC: 0x%08lx", __entry->vcpu_pc) |
| 40 | ); |
| 41 | |
Christoffer Dall | 94f8e64 | 2013-01-20 18:28:12 -0500 | [diff] [blame] | 42 | TRACE_EVENT(kvm_guest_fault, |
| 43 | TP_PROTO(unsigned long vcpu_pc, unsigned long hsr, |
| 44 | unsigned long hxfar, |
| 45 | unsigned long long ipa), |
| 46 | TP_ARGS(vcpu_pc, hsr, hxfar, ipa), |
| 47 | |
| 48 | TP_STRUCT__entry( |
| 49 | __field( unsigned long, vcpu_pc ) |
| 50 | __field( unsigned long, hsr ) |
| 51 | __field( unsigned long, hxfar ) |
| 52 | __field( unsigned long long, ipa ) |
| 53 | ), |
| 54 | |
| 55 | TP_fast_assign( |
| 56 | __entry->vcpu_pc = vcpu_pc; |
| 57 | __entry->hsr = hsr; |
| 58 | __entry->hxfar = hxfar; |
| 59 | __entry->ipa = ipa; |
| 60 | ), |
| 61 | |
| 62 | TP_printk("guest fault at PC %#08lx (hxfar %#08lx, " |
| 63 | "ipa %#16llx, hsr %#08lx", |
| 64 | __entry->vcpu_pc, __entry->hxfar, |
| 65 | __entry->ipa, __entry->hsr) |
| 66 | ); |
| 67 | |
Christoffer Dall | 86ce853 | 2013-01-20 18:28:08 -0500 | [diff] [blame] | 68 | TRACE_EVENT(kvm_irq_line, |
| 69 | TP_PROTO(unsigned int type, int vcpu_idx, int irq_num, int level), |
| 70 | TP_ARGS(type, vcpu_idx, irq_num, level), |
| 71 | |
| 72 | TP_STRUCT__entry( |
| 73 | __field( unsigned int, type ) |
| 74 | __field( int, vcpu_idx ) |
| 75 | __field( int, irq_num ) |
| 76 | __field( int, level ) |
| 77 | ), |
| 78 | |
| 79 | TP_fast_assign( |
| 80 | __entry->type = type; |
| 81 | __entry->vcpu_idx = vcpu_idx; |
| 82 | __entry->irq_num = irq_num; |
| 83 | __entry->level = level; |
| 84 | ), |
| 85 | |
| 86 | TP_printk("Inject %s interrupt (%d), vcpu->idx: %d, num: %d, level: %d", |
| 87 | (__entry->type == KVM_ARM_IRQ_TYPE_CPU) ? "CPU" : |
| 88 | (__entry->type == KVM_ARM_IRQ_TYPE_PPI) ? "VGIC PPI" : |
| 89 | (__entry->type == KVM_ARM_IRQ_TYPE_SPI) ? "VGIC SPI" : "UNKNOWN", |
| 90 | __entry->type, __entry->vcpu_idx, __entry->irq_num, __entry->level) |
| 91 | ); |
| 92 | |
Christoffer Dall | 45e96ea | 2013-01-20 18:43:58 -0500 | [diff] [blame] | 93 | TRACE_EVENT(kvm_mmio_emulate, |
| 94 | TP_PROTO(unsigned long vcpu_pc, unsigned long instr, |
| 95 | unsigned long cpsr), |
| 96 | TP_ARGS(vcpu_pc, instr, cpsr), |
| 97 | |
| 98 | TP_STRUCT__entry( |
| 99 | __field( unsigned long, vcpu_pc ) |
| 100 | __field( unsigned long, instr ) |
| 101 | __field( unsigned long, cpsr ) |
| 102 | ), |
| 103 | |
| 104 | TP_fast_assign( |
| 105 | __entry->vcpu_pc = vcpu_pc; |
| 106 | __entry->instr = instr; |
| 107 | __entry->cpsr = cpsr; |
| 108 | ), |
| 109 | |
| 110 | TP_printk("Emulate MMIO at: 0x%08lx (instr: %08lx, cpsr: %08lx)", |
| 111 | __entry->vcpu_pc, __entry->instr, __entry->cpsr) |
| 112 | ); |
| 113 | |
Christoffer Dall | 5b3e5e5 | 2013-01-20 18:28:09 -0500 | [diff] [blame] | 114 | /* Architecturally implementation defined CP15 register access */ |
| 115 | TRACE_EVENT(kvm_emulate_cp15_imp, |
| 116 | TP_PROTO(unsigned long Op1, unsigned long Rt1, unsigned long CRn, |
| 117 | unsigned long CRm, unsigned long Op2, bool is_write), |
| 118 | TP_ARGS(Op1, Rt1, CRn, CRm, Op2, is_write), |
| 119 | |
| 120 | TP_STRUCT__entry( |
| 121 | __field( unsigned int, Op1 ) |
| 122 | __field( unsigned int, Rt1 ) |
| 123 | __field( unsigned int, CRn ) |
| 124 | __field( unsigned int, CRm ) |
| 125 | __field( unsigned int, Op2 ) |
| 126 | __field( bool, is_write ) |
| 127 | ), |
| 128 | |
| 129 | TP_fast_assign( |
| 130 | __entry->is_write = is_write; |
| 131 | __entry->Op1 = Op1; |
| 132 | __entry->Rt1 = Rt1; |
| 133 | __entry->CRn = CRn; |
| 134 | __entry->CRm = CRm; |
| 135 | __entry->Op2 = Op2; |
| 136 | ), |
| 137 | |
| 138 | TP_printk("Implementation defined CP15: %s\tp15, %u, r%u, c%u, c%u, %u", |
| 139 | (__entry->is_write) ? "mcr" : "mrc", |
| 140 | __entry->Op1, __entry->Rt1, __entry->CRn, |
| 141 | __entry->CRm, __entry->Op2) |
| 142 | ); |
| 143 | |
| 144 | TRACE_EVENT(kvm_wfi, |
| 145 | TP_PROTO(unsigned long vcpu_pc), |
| 146 | TP_ARGS(vcpu_pc), |
| 147 | |
| 148 | TP_STRUCT__entry( |
| 149 | __field( unsigned long, vcpu_pc ) |
| 150 | ), |
| 151 | |
| 152 | TP_fast_assign( |
| 153 | __entry->vcpu_pc = vcpu_pc; |
| 154 | ), |
| 155 | |
| 156 | TP_printk("guest executed wfi at: 0x%08lx", __entry->vcpu_pc) |
| 157 | ); |
| 158 | |
Christoffer Dall | d5d8184 | 2013-01-20 18:28:07 -0500 | [diff] [blame] | 159 | TRACE_EVENT(kvm_unmap_hva, |
| 160 | TP_PROTO(unsigned long hva), |
| 161 | TP_ARGS(hva), |
Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 162 | |
Christoffer Dall | d5d8184 | 2013-01-20 18:28:07 -0500 | [diff] [blame] | 163 | TP_STRUCT__entry( |
| 164 | __field( unsigned long, hva ) |
| 165 | ), |
| 166 | |
| 167 | TP_fast_assign( |
| 168 | __entry->hva = hva; |
| 169 | ), |
| 170 | |
| 171 | TP_printk("mmu notifier unmap hva: %#08lx", __entry->hva) |
| 172 | ); |
| 173 | |
| 174 | TRACE_EVENT(kvm_unmap_hva_range, |
| 175 | TP_PROTO(unsigned long start, unsigned long end), |
| 176 | TP_ARGS(start, end), |
| 177 | |
| 178 | TP_STRUCT__entry( |
| 179 | __field( unsigned long, start ) |
| 180 | __field( unsigned long, end ) |
| 181 | ), |
| 182 | |
| 183 | TP_fast_assign( |
| 184 | __entry->start = start; |
| 185 | __entry->end = end; |
| 186 | ), |
| 187 | |
| 188 | TP_printk("mmu notifier unmap range: %#08lx -- %#08lx", |
| 189 | __entry->start, __entry->end) |
| 190 | ); |
| 191 | |
| 192 | TRACE_EVENT(kvm_set_spte_hva, |
| 193 | TP_PROTO(unsigned long hva), |
| 194 | TP_ARGS(hva), |
| 195 | |
| 196 | TP_STRUCT__entry( |
| 197 | __field( unsigned long, hva ) |
| 198 | ), |
| 199 | |
| 200 | TP_fast_assign( |
| 201 | __entry->hva = hva; |
| 202 | ), |
| 203 | |
| 204 | TP_printk("mmu notifier set pte hva: %#08lx", __entry->hva) |
| 205 | ); |
Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 206 | |
Christoffer Dall | 5b3e5e5 | 2013-01-20 18:28:09 -0500 | [diff] [blame] | 207 | TRACE_EVENT(kvm_hvc, |
| 208 | TP_PROTO(unsigned long vcpu_pc, unsigned long r0, unsigned long imm), |
| 209 | TP_ARGS(vcpu_pc, r0, imm), |
| 210 | |
| 211 | TP_STRUCT__entry( |
| 212 | __field( unsigned long, vcpu_pc ) |
| 213 | __field( unsigned long, r0 ) |
| 214 | __field( unsigned long, imm ) |
| 215 | ), |
| 216 | |
| 217 | TP_fast_assign( |
| 218 | __entry->vcpu_pc = vcpu_pc; |
| 219 | __entry->r0 = r0; |
| 220 | __entry->imm = imm; |
| 221 | ), |
| 222 | |
| 223 | TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx", |
| 224 | __entry->vcpu_pc, __entry->r0, __entry->imm) |
| 225 | ); |
| 226 | |
Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 227 | #endif /* _TRACE_KVM_H */ |
| 228 | |
| 229 | #undef TRACE_INCLUDE_PATH |
| 230 | #define TRACE_INCLUDE_PATH arch/arm/kvm |
| 231 | #undef TRACE_INCLUDE_FILE |
| 232 | #define TRACE_INCLUDE_FILE trace |
| 233 | |
| 234 | /* This part must be outside protection */ |
| 235 | #include <trace/define_trace.h> |