diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2010-04-22 06:33:07 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-05-17 05:19:17 -0400 |
commit | 924584ccb08c338ebd2f40936ff2321c1cce6a6d (patch) | |
tree | 27f91ca0999476765c13c6dd0fa03a552f1d59bd | |
parent | 8d3b9323095ae977406c7f4e73c9aa0f47682cc2 (diff) |
KVM: SVM: Fix nested nmi handling
The patch introducing nested nmi handling had a bug. The
check does not belong to enable_nmi_window but must be in
nmi_allowed. This patch fixes this.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/x86/kvm/svm.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index ab78eb8ba899..ec205847be6a 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -2771,8 +2771,12 @@ static int svm_nmi_allowed(struct kvm_vcpu *vcpu) | |||
2771 | { | 2771 | { |
2772 | struct vcpu_svm *svm = to_svm(vcpu); | 2772 | struct vcpu_svm *svm = to_svm(vcpu); |
2773 | struct vmcb *vmcb = svm->vmcb; | 2773 | struct vmcb *vmcb = svm->vmcb; |
2774 | return !(vmcb->control.int_state & SVM_INTERRUPT_SHADOW_MASK) && | 2774 | int ret; |
2775 | !(svm->vcpu.arch.hflags & HF_NMI_MASK); | 2775 | ret = !(vmcb->control.int_state & SVM_INTERRUPT_SHADOW_MASK) && |
2776 | !(svm->vcpu.arch.hflags & HF_NMI_MASK); | ||
2777 | ret = ret && gif_set(svm) && nested_svm_nmi(svm); | ||
2778 | |||
2779 | return ret; | ||
2776 | } | 2780 | } |
2777 | 2781 | ||
2778 | static bool svm_get_nmi_mask(struct kvm_vcpu *vcpu) | 2782 | static bool svm_get_nmi_mask(struct kvm_vcpu *vcpu) |
@@ -2841,11 +2845,9 @@ static void enable_nmi_window(struct kvm_vcpu *vcpu) | |||
2841 | * Something prevents NMI from been injected. Single step over possible | 2845 | * Something prevents NMI from been injected. Single step over possible |
2842 | * problem (IRET or exception injection or interrupt shadow) | 2846 | * problem (IRET or exception injection or interrupt shadow) |
2843 | */ | 2847 | */ |
2844 | if (gif_set(svm) && nested_svm_nmi(svm)) { | 2848 | svm->nmi_singlestep = true; |
2845 | svm->nmi_singlestep = true; | 2849 | svm->vmcb->save.rflags |= (X86_EFLAGS_TF | X86_EFLAGS_RF); |
2846 | svm->vmcb->save.rflags |= (X86_EFLAGS_TF | X86_EFLAGS_RF); | 2850 | update_db_intercept(vcpu); |
2847 | update_db_intercept(vcpu); | ||
2848 | } | ||
2849 | } | 2851 | } |
2850 | 2852 | ||
2851 | static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr) | 2853 | static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr) |