1 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
9 #define TRACE_SYSTEM kvm
19 __field(
unsigned int, vcpu_id )
34 unsigned long a2,
unsigned long a3),
53 TP_printk(
"nr 0x%lx a0 0x%lx a1 0x%lx a2 0x%lx a3 0x%lx",
64 TP_ARGS(code, fast, rep_cnt, rep_idx, ingpa, outgpa),
84 TP_printk(
"code 0x%x %s cnt 0x%x idx 0x%x in 0x%llx out 0x%llx",
112 TP_printk(
"pio_%s at 0x%x size %d count %d",
113 __entry->rw ?
"write" :
"read",
121 TP_PROTO(
unsigned int function,
unsigned long rax,
unsigned long rbx,
122 unsigned long rcx,
unsigned long rdx),
123 TP_ARGS(
function, rax, rbx, rcx, rdx),
126 __field(
unsigned int,
function )
141 TP_printk(
"func %x rax %lx rbx %lx rcx %lx rdx %lx",
146 #define AREG(x) { APIC_##x, "APIC_" #x }
148 #define kvm_trace_symbol_apic \
149 AREG(ID), AREG(LVR), AREG(TASKPRI), AREG(ARBPRI), AREG(PROCPRI), \
150 AREG(EOI), AREG(RRR), AREG(LDR), AREG(DFR), AREG(SPIV), AREG(ISR), \
151 AREG(TMR), AREG(IRR), AREG(ESR), AREG(ICR), AREG(ICR2), AREG(LVTT), \
152 AREG(LVTTHMR), AREG(LVTPC), AREG(LVT0), AREG(LVT1), AREG(LVTERR), \
153 AREG(TMICT), AREG(TMCCT), AREG(TDCR), AREG(SELF_IPI), AREG(EFEAT), \
175 __entry->rw ?
"write" :
"read",
180 #define trace_kvm_apic_read(reg, val) trace_kvm_apic(0, reg, val)
181 #define trace_kvm_apic_write(reg, val) trace_kvm_apic(1, reg, val)
183 #define KVM_ISA_VMX 1
184 #define KVM_ISA_SVM 2
191 TP_ARGS(exit_reason, vcpu, isa),
194 __field(
unsigned int, exit_reason )
195 __field(
unsigned long, guest_rip )
202 __entry->exit_reason = exit_reason;
203 __entry->guest_rip = kvm_rip_read(vcpu);
209 TP_printk(
"reason %s rip 0x%lx info %llx %llx",
234 #define EXS(x) { x##_VECTOR, "#" #x }
236 #define kvm_trace_sym_exc \
237 EXS(DE), EXS(DB), EXS(BP), EXS(OF), EXS(BR), EXS(UD), EXS(NM), \
238 EXS(DF), EXS(TS), EXS(NP), EXS(SS), EXS(GP), EXS(PF), \
246 TP_ARGS(exception, has_error, error_code),
255 __entry->exception = exception;
256 __entry->has_error = has_error;
257 __entry->error_code = error_code;
270 TP_PROTO(
unsigned long fault_address,
unsigned int error_code),
271 TP_ARGS(fault_address, error_code),
274 __field(
unsigned long, fault_address )
275 __field(
unsigned int, error_code )
279 __entry->fault_address = fault_address;
280 __entry->error_code = error_code;
292 TP_ARGS(write, ecx, data, exception),
305 __entry->exception = exception;
309 __entry->write ?
"write" :
"read",
311 __entry->exception ?
" (#GP)" :
"")
314 #define trace_kvm_msr_read(ecx, data) trace_kvm_msr(0, ecx, data, false)
315 #define trace_kvm_msr_write(ecx, data) trace_kvm_msr(1, ecx, data, false)
316 #define trace_kvm_msr_read_ex(ecx) trace_kvm_msr(0, ecx, 0, true)
317 #define trace_kvm_msr_write_ex(ecx, data) trace_kvm_msr(1, ecx, data, true)
323 TP_PROTO(
unsigned int rw,
unsigned int cr,
unsigned long val),
339 __entry->rw ?
"write" :
"read",
343 #define trace_kvm_cr_read(cr, val) trace_kvm_cr(0, cr, val)
344 #define trace_kvm_cr_write(cr, val) trace_kvm_cr(1, cr, val)
348 TP_ARGS(chip, pin, elcr, imr, coalesced),
363 __entry->coalesced = coalesced;
370 __entry->coalesced ?
" (coalesced)" :
"")
373 #define kvm_apic_dst_shorthand \
377 {0x3, "all-but-self"}
393 TP_printk(
"dst %x vec %u (%s|%s|%s|%s|%s)",
397 (
__entry->icr_low & (1<<11)) ?
"logical" :
"physical",
398 (
__entry->icr_low & (1<<14)) ?
"assert" :
"de-assert",
399 (
__entry->icr_low & (1<<15)) ?
"level" :
"edge",
406 TP_ARGS(apicid, dm, tm, vec, coalesced),
421 __entry->coalesced = coalesced;
427 __entry->tm ?
"level" :
"edge",
428 __entry->coalesced ?
" (coalesced)" :
"")
470 __u32 event_inj,
bool npt),
471 TP_ARGS(rip, vmcb, nested_rip, int_ctl, event_inj, npt),
485 __entry->nested_rip = nested_rip;
487 __entry->event_inj = event_inj;
491 TP_printk(
"rip: 0x%016llx vmcb: 0x%016llx nrip: 0x%016llx int_ctl: 0x%08x "
492 "event_inj: 0x%08x npt: %s",
500 TP_ARGS(cr_read, cr_write, exceptions, intercept),
512 __entry->exceptions = exceptions;
513 __entry->intercept = intercept;
516 TP_printk(
"cr_read: %04x cr_write: %04x excp: %08x intercept: %016llx",
527 TP_ARGS(rip, exit_code, exit_info1, exit_info2,
528 exit_int_info, exit_int_info_err, isa),
542 __entry->exit_code = exit_code;
543 __entry->exit_info1 = exit_info1;
544 __entry->exit_info2 = exit_info2;
545 __entry->exit_int_info = exit_int_info;
546 __entry->exit_int_info_err = exit_int_info_err;
549 TP_printk(
"rip: 0x%016llx reason: %s ext_inf1: 0x%016llx "
550 "ext_inf2: 0x%016llx ext_int: 0x%08x ext_int_err: 0x%08x",
566 TP_ARGS(exit_code, exit_info1, exit_info2,
567 exit_int_info, exit_int_info_err, isa),
579 __entry->exit_code = exit_code;
580 __entry->exit_info1 = exit_info1;
581 __entry->exit_info2 = exit_info2;
582 __entry->exit_int_info = exit_int_info;
583 __entry->exit_int_info_err = exit_int_info_err;
587 TP_printk(
"reason: %s ext_inf1: 0x%016llx "
588 "ext_inf2: 0x%016llx ext_int: 0x%08x ext_int_err: 0x%08x",
633 TP_printk(
"rip: 0x%016llx asid: %d address: 0x%016llx",
658 #define KVM_EMUL_INSN_F_CR0_PE (1 << 0)
659 #define KVM_EMUL_INSN_F_EFL_VM (1 << 1)
660 #define KVM_EMUL_INSN_F_CS_D (1 << 2)
661 #define KVM_EMUL_INSN_F_CS_L (1 << 3)
663 #define kvm_trace_symbol_emul_flags \
665 { KVM_EMUL_INSN_F_CR0_PE \
666 | KVM_EMUL_INSN_F_EFL_VM, "vm16" }, \
667 { KVM_EMUL_INSN_F_CR0_PE, "prot16" }, \
668 { KVM_EMUL_INSN_F_CR0_PE \
669 | KVM_EMUL_INSN_F_CS_D, "prot32" }, \
670 { KVM_EMUL_INSN_F_CR0_PE \
671 | KVM_EMUL_INSN_F_CS_L, "prot64" }
673 #define kei_decode_mode(mode) ({ \
676 case X86EMUL_MODE_REAL: \
679 case X86EMUL_MODE_VM86: \
680 flags = KVM_EMUL_INSN_F_EFL_VM; \
682 case X86EMUL_MODE_PROT16: \
683 flags = KVM_EMUL_INSN_F_CR0_PE; \
685 case X86EMUL_MODE_PROT32: \
686 flags = KVM_EMUL_INSN_F_CR0_PE \
687 | KVM_EMUL_INSN_F_CS_D; \
689 case X86EMUL_MODE_PROT64: \
690 flags = KVM_EMUL_INSN_F_CR0_PE \
691 | KVM_EMUL_INSN_F_CS_L; \
711 __entry->rip = vcpu->
arch.emulate_ctxt.fetch.start;
714 - vcpu->
arch.emulate_ctxt.fetch.start;
716 vcpu->
arch.emulate_ctxt.fetch.data,
727 __entry->failed ?
" failed" :
""
731 #define trace_kvm_emulate_insn_start(vcpu) trace_kvm_emulate_insn(vcpu, 0)
732 #define trace_kvm_emulate_insn_failed(vcpu) trace_kvm_emulate_insn(vcpu, 1)
737 TP_ARGS(gva, gpa, write, gpa_match),
754 __entry->write ?
"Write" :
"Read",
755 __entry->gpa_match ?
"GPA" :
"GVA")
759 #undef TRACE_INCLUDE_PATH
760 #define TRACE_INCLUDE_PATH arch/x86/kvm
761 #undef TRACE_INCLUDE_FILE
762 #define TRACE_INCLUDE_FILE trace