aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2009-10-09 10:08:32 -0400
committerAvi Kivity <avi@redhat.com>2009-12-03 02:32:16 -0500
commit532a46b98963f110e9425a251e127d6537915dde (patch)
tree54b41094e6f1fef54db79fbcad3e4b36128542a5 /arch/x86/kvm
parentec1ff79084fccdae0dca9b04b89dcdf3235bbfa1 (diff)
KVM: SVM: Add tracepoint for skinit instruction
This patch adds a tracepoint for the event that the guest executed the SKINIT instruction. This information is important because SKINIT is an SVM extenstion not yet implemented by nested SVM and we may need this information for debugging hypervisors that do not yet run on nested SVM. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/svm.c10
-rw-r--r--arch/x86/kvm/trace.h22
-rw-r--r--arch/x86/kvm/x86.c1
3 files changed, 32 insertions, 1 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index ba18fb7d3657..8b9f6fbba48c 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1987,6 +1987,14 @@ static int invlpga_interception(struct vcpu_svm *svm)
1987 return 1; 1987 return 1;
1988} 1988}
1989 1989
1990static int skinit_interception(struct vcpu_svm *svm)
1991{
1992 trace_kvm_skinit(svm->vmcb->save.rip, svm->vcpu.arch.regs[VCPU_REGS_RAX]);
1993
1994 kvm_queue_exception(&svm->vcpu, UD_VECTOR);
1995 return 1;
1996}
1997
1990static int invalid_op_interception(struct vcpu_svm *svm) 1998static int invalid_op_interception(struct vcpu_svm *svm)
1991{ 1999{
1992 kvm_queue_exception(&svm->vcpu, UD_VECTOR); 2000 kvm_queue_exception(&svm->vcpu, UD_VECTOR);
@@ -2350,7 +2358,7 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm) = {
2350 [SVM_EXIT_VMSAVE] = vmsave_interception, 2358 [SVM_EXIT_VMSAVE] = vmsave_interception,
2351 [SVM_EXIT_STGI] = stgi_interception, 2359 [SVM_EXIT_STGI] = stgi_interception,
2352 [SVM_EXIT_CLGI] = clgi_interception, 2360 [SVM_EXIT_CLGI] = clgi_interception,
2353 [SVM_EXIT_SKINIT] = invalid_op_interception, 2361 [SVM_EXIT_SKINIT] = skinit_interception,
2354 [SVM_EXIT_WBINVD] = emulate_on_interception, 2362 [SVM_EXIT_WBINVD] = emulate_on_interception,
2355 [SVM_EXIT_MONITOR] = invalid_op_interception, 2363 [SVM_EXIT_MONITOR] = invalid_op_interception,
2356 [SVM_EXIT_MWAIT] = invalid_op_interception, 2364 [SVM_EXIT_MWAIT] = invalid_op_interception,
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index 7e1f08e959bc..816e0449db0b 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -492,6 +492,28 @@ TRACE_EVENT(kvm_invlpga,
492 TP_printk("rip: 0x%016llx asid: %d address: 0x%016llx\n", 492 TP_printk("rip: 0x%016llx asid: %d address: 0x%016llx\n",
493 __entry->rip, __entry->asid, __entry->address) 493 __entry->rip, __entry->asid, __entry->address)
494); 494);
495
496/*
497 * Tracepoint for nested #vmexit because of interrupt pending
498 */
499TRACE_EVENT(kvm_skinit,
500 TP_PROTO(__u64 rip, __u32 slb),
501 TP_ARGS(rip, slb),
502
503 TP_STRUCT__entry(
504 __field( __u64, rip )
505 __field( __u32, slb )
506 ),
507
508 TP_fast_assign(
509 __entry->rip = rip;
510 __entry->slb = slb;
511 ),
512
513 TP_printk("rip: 0x%016llx slb: 0x%08x\n",
514 __entry->rip, __entry->slb)
515);
516
495#endif /* _TRACE_KVM_H */ 517#endif /* _TRACE_KVM_H */
496 518
497/* This part must be outside protection */ 519/* This part must be outside protection */
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 86596fc7941c..098e7f886306 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4989,3 +4989,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_vmexit);
4989EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_vmexit_inject); 4989EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_vmexit_inject);
4990EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_intr_vmexit); 4990EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_intr_vmexit);
4991EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_invlpga); 4991EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_invlpga);
4992EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_skinit);