KVM: SVM: implement dedicated NMI exit handler
authorJoerg Roedel <joerg.roedel@amd.com>
Wed, 30 Apr 2008 15:56:00 +0000 (17:56 +0200)
committerAvi Kivity <avi@qumranet.com>
Sun, 20 Jul 2008 09:40:47 +0000 (12:40 +0300)
With an exit handler for NMI intercepts its possible to account them using
kvmtrace.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/svm.c

index 6b0d5fa5bab3e7e3a395dd5c3133b0c5f0791b31..8a2118b09fd2631d8d9fd0eb08ad9a03fcce11bb 100644 (file)
@@ -1081,6 +1081,11 @@ static int io_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
        return kvm_emulate_pio(&svm->vcpu, kvm_run, in, size, port);
 }
 
+static int nmi_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
+{
+       return 1;
+}
+
 static int nop_on_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
 {
        return 1;
@@ -1365,7 +1370,7 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm,
        [SVM_EXIT_EXCP_BASE + NM_VECTOR]        = nm_interception,
        [SVM_EXIT_EXCP_BASE + MC_VECTOR]        = mc_interception,
        [SVM_EXIT_INTR]                         = nop_on_interception,
-       [SVM_EXIT_NMI]                          = nop_on_interception,
+       [SVM_EXIT_NMI]                          = nmi_interception,
        [SVM_EXIT_SMI]                          = nop_on_interception,
        [SVM_EXIT_INIT]                         = nop_on_interception,
        [SVM_EXIT_VINTR]                        = interrupt_window_interception,