0001
0002 #if !defined(_TRACE_ARM_ARM64_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
0003 #define _TRACE_ARM_ARM64_KVM_H
0004
0005 #include <kvm/arm_arch_timer.h>
0006 #include <linux/tracepoint.h>
0007
0008 #undef TRACE_SYSTEM
0009 #define TRACE_SYSTEM kvm
0010
0011
0012
0013
0014 TRACE_EVENT(kvm_entry,
0015 TP_PROTO(unsigned long vcpu_pc),
0016 TP_ARGS(vcpu_pc),
0017
0018 TP_STRUCT__entry(
0019 __field( unsigned long, vcpu_pc )
0020 ),
0021
0022 TP_fast_assign(
0023 __entry->vcpu_pc = vcpu_pc;
0024 ),
0025
0026 TP_printk("PC: 0x%016lx", __entry->vcpu_pc)
0027 );
0028
0029 TRACE_EVENT(kvm_exit,
0030 TP_PROTO(int ret, unsigned int esr_ec, unsigned long vcpu_pc),
0031 TP_ARGS(ret, esr_ec, vcpu_pc),
0032
0033 TP_STRUCT__entry(
0034 __field( int, ret )
0035 __field( unsigned int, esr_ec )
0036 __field( unsigned long, vcpu_pc )
0037 ),
0038
0039 TP_fast_assign(
0040 __entry->ret = ARM_EXCEPTION_CODE(ret);
0041 __entry->esr_ec = ARM_EXCEPTION_IS_TRAP(ret) ? esr_ec : 0;
0042 __entry->vcpu_pc = vcpu_pc;
0043 ),
0044
0045 TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%016lx",
0046 __print_symbolic(__entry->ret, kvm_arm_exception_type),
0047 __entry->esr_ec,
0048 __print_symbolic(__entry->esr_ec, kvm_arm_exception_class),
0049 __entry->vcpu_pc)
0050 );
0051
0052 TRACE_EVENT(kvm_guest_fault,
0053 TP_PROTO(unsigned long vcpu_pc, unsigned long hsr,
0054 unsigned long hxfar,
0055 unsigned long long ipa),
0056 TP_ARGS(vcpu_pc, hsr, hxfar, ipa),
0057
0058 TP_STRUCT__entry(
0059 __field( unsigned long, vcpu_pc )
0060 __field( unsigned long, hsr )
0061 __field( unsigned long, hxfar )
0062 __field( unsigned long long, ipa )
0063 ),
0064
0065 TP_fast_assign(
0066 __entry->vcpu_pc = vcpu_pc;
0067 __entry->hsr = hsr;
0068 __entry->hxfar = hxfar;
0069 __entry->ipa = ipa;
0070 ),
0071
0072 TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#016lx",
0073 __entry->ipa, __entry->hsr,
0074 __entry->hxfar, __entry->vcpu_pc)
0075 );
0076
0077 TRACE_EVENT(kvm_access_fault,
0078 TP_PROTO(unsigned long ipa),
0079 TP_ARGS(ipa),
0080
0081 TP_STRUCT__entry(
0082 __field( unsigned long, ipa )
0083 ),
0084
0085 TP_fast_assign(
0086 __entry->ipa = ipa;
0087 ),
0088
0089 TP_printk("IPA: %lx", __entry->ipa)
0090 );
0091
0092 TRACE_EVENT(kvm_irq_line,
0093 TP_PROTO(unsigned int type, int vcpu_idx, int irq_num, int level),
0094 TP_ARGS(type, vcpu_idx, irq_num, level),
0095
0096 TP_STRUCT__entry(
0097 __field( unsigned int, type )
0098 __field( int, vcpu_idx )
0099 __field( int, irq_num )
0100 __field( int, level )
0101 ),
0102
0103 TP_fast_assign(
0104 __entry->type = type;
0105 __entry->vcpu_idx = vcpu_idx;
0106 __entry->irq_num = irq_num;
0107 __entry->level = level;
0108 ),
0109
0110 TP_printk("Inject %s interrupt (%d), vcpu->idx: %d, num: %d, level: %d",
0111 (__entry->type == KVM_ARM_IRQ_TYPE_CPU) ? "CPU" :
0112 (__entry->type == KVM_ARM_IRQ_TYPE_PPI) ? "VGIC PPI" :
0113 (__entry->type == KVM_ARM_IRQ_TYPE_SPI) ? "VGIC SPI" : "UNKNOWN",
0114 __entry->type, __entry->vcpu_idx, __entry->irq_num, __entry->level)
0115 );
0116
0117 TRACE_EVENT(kvm_mmio_emulate,
0118 TP_PROTO(unsigned long vcpu_pc, unsigned long instr,
0119 unsigned long cpsr),
0120 TP_ARGS(vcpu_pc, instr, cpsr),
0121
0122 TP_STRUCT__entry(
0123 __field( unsigned long, vcpu_pc )
0124 __field( unsigned long, instr )
0125 __field( unsigned long, cpsr )
0126 ),
0127
0128 TP_fast_assign(
0129 __entry->vcpu_pc = vcpu_pc;
0130 __entry->instr = instr;
0131 __entry->cpsr = cpsr;
0132 ),
0133
0134 TP_printk("Emulate MMIO at: 0x%016lx (instr: %08lx, cpsr: %08lx)",
0135 __entry->vcpu_pc, __entry->instr, __entry->cpsr)
0136 );
0137
0138 TRACE_EVENT(kvm_set_way_flush,
0139 TP_PROTO(unsigned long vcpu_pc, bool cache),
0140 TP_ARGS(vcpu_pc, cache),
0141
0142 TP_STRUCT__entry(
0143 __field( unsigned long, vcpu_pc )
0144 __field( bool, cache )
0145 ),
0146
0147 TP_fast_assign(
0148 __entry->vcpu_pc = vcpu_pc;
0149 __entry->cache = cache;
0150 ),
0151
0152 TP_printk("S/W flush at 0x%016lx (cache %s)",
0153 __entry->vcpu_pc, __entry->cache ? "on" : "off")
0154 );
0155
0156 TRACE_EVENT(kvm_toggle_cache,
0157 TP_PROTO(unsigned long vcpu_pc, bool was, bool now),
0158 TP_ARGS(vcpu_pc, was, now),
0159
0160 TP_STRUCT__entry(
0161 __field( unsigned long, vcpu_pc )
0162 __field( bool, was )
0163 __field( bool, now )
0164 ),
0165
0166 TP_fast_assign(
0167 __entry->vcpu_pc = vcpu_pc;
0168 __entry->was = was;
0169 __entry->now = now;
0170 ),
0171
0172 TP_printk("VM op at 0x%016lx (cache was %s, now %s)",
0173 __entry->vcpu_pc, __entry->was ? "on" : "off",
0174 __entry->now ? "on" : "off")
0175 );
0176
0177
0178
0179
0180 TRACE_EVENT(kvm_timer_update_irq,
0181 TP_PROTO(unsigned long vcpu_id, __u32 irq, int level),
0182 TP_ARGS(vcpu_id, irq, level),
0183
0184 TP_STRUCT__entry(
0185 __field( unsigned long, vcpu_id )
0186 __field( __u32, irq )
0187 __field( int, level )
0188 ),
0189
0190 TP_fast_assign(
0191 __entry->vcpu_id = vcpu_id;
0192 __entry->irq = irq;
0193 __entry->level = level;
0194 ),
0195
0196 TP_printk("VCPU: %ld, IRQ %d, level %d",
0197 __entry->vcpu_id, __entry->irq, __entry->level)
0198 );
0199
0200 TRACE_EVENT(kvm_get_timer_map,
0201 TP_PROTO(unsigned long vcpu_id, struct timer_map *map),
0202 TP_ARGS(vcpu_id, map),
0203
0204 TP_STRUCT__entry(
0205 __field( unsigned long, vcpu_id )
0206 __field( int, direct_vtimer )
0207 __field( int, direct_ptimer )
0208 __field( int, emul_ptimer )
0209 ),
0210
0211 TP_fast_assign(
0212 __entry->vcpu_id = vcpu_id;
0213 __entry->direct_vtimer = arch_timer_ctx_index(map->direct_vtimer);
0214 __entry->direct_ptimer =
0215 (map->direct_ptimer) ? arch_timer_ctx_index(map->direct_ptimer) : -1;
0216 __entry->emul_ptimer =
0217 (map->emul_ptimer) ? arch_timer_ctx_index(map->emul_ptimer) : -1;
0218 ),
0219
0220 TP_printk("VCPU: %ld, dv: %d, dp: %d, ep: %d",
0221 __entry->vcpu_id,
0222 __entry->direct_vtimer,
0223 __entry->direct_ptimer,
0224 __entry->emul_ptimer)
0225 );
0226
0227 TRACE_EVENT(kvm_timer_save_state,
0228 TP_PROTO(struct arch_timer_context *ctx),
0229 TP_ARGS(ctx),
0230
0231 TP_STRUCT__entry(
0232 __field( unsigned long, ctl )
0233 __field( unsigned long long, cval )
0234 __field( int, timer_idx )
0235 ),
0236
0237 TP_fast_assign(
0238 __entry->ctl = timer_get_ctl(ctx);
0239 __entry->cval = timer_get_cval(ctx);
0240 __entry->timer_idx = arch_timer_ctx_index(ctx);
0241 ),
0242
0243 TP_printk(" CTL: %#08lx CVAL: %#16llx arch_timer_ctx_index: %d",
0244 __entry->ctl,
0245 __entry->cval,
0246 __entry->timer_idx)
0247 );
0248
0249 TRACE_EVENT(kvm_timer_restore_state,
0250 TP_PROTO(struct arch_timer_context *ctx),
0251 TP_ARGS(ctx),
0252
0253 TP_STRUCT__entry(
0254 __field( unsigned long, ctl )
0255 __field( unsigned long long, cval )
0256 __field( int, timer_idx )
0257 ),
0258
0259 TP_fast_assign(
0260 __entry->ctl = timer_get_ctl(ctx);
0261 __entry->cval = timer_get_cval(ctx);
0262 __entry->timer_idx = arch_timer_ctx_index(ctx);
0263 ),
0264
0265 TP_printk("CTL: %#08lx CVAL: %#16llx arch_timer_ctx_index: %d",
0266 __entry->ctl,
0267 __entry->cval,
0268 __entry->timer_idx)
0269 );
0270
0271 TRACE_EVENT(kvm_timer_hrtimer_expire,
0272 TP_PROTO(struct arch_timer_context *ctx),
0273 TP_ARGS(ctx),
0274
0275 TP_STRUCT__entry(
0276 __field( int, timer_idx )
0277 ),
0278
0279 TP_fast_assign(
0280 __entry->timer_idx = arch_timer_ctx_index(ctx);
0281 ),
0282
0283 TP_printk("arch_timer_ctx_index: %d", __entry->timer_idx)
0284 );
0285
0286 TRACE_EVENT(kvm_timer_emulate,
0287 TP_PROTO(struct arch_timer_context *ctx, bool should_fire),
0288 TP_ARGS(ctx, should_fire),
0289
0290 TP_STRUCT__entry(
0291 __field( int, timer_idx )
0292 __field( bool, should_fire )
0293 ),
0294
0295 TP_fast_assign(
0296 __entry->timer_idx = arch_timer_ctx_index(ctx);
0297 __entry->should_fire = should_fire;
0298 ),
0299
0300 TP_printk("arch_timer_ctx_index: %d (should_fire: %d)",
0301 __entry->timer_idx, __entry->should_fire)
0302 );
0303
0304 #endif
0305
0306 #undef TRACE_INCLUDE_PATH
0307 #define TRACE_INCLUDE_PATH .
0308 #undef TRACE_INCLUDE_FILE
0309 #define TRACE_INCLUDE_FILE trace_arm
0310
0311
0312 #include <trace/define_trace.h>