diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 2 | ||||
-rw-r--r-- | arch/x86/kvm/svm.c | 5 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 16 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 3 |
4 files changed, 13 insertions, 13 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index ec14b7245a4e..3741c653767c 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -695,7 +695,7 @@ struct kvm_x86_ops { | |||
695 | int (*nmi_allowed)(struct kvm_vcpu *vcpu); | 695 | int (*nmi_allowed)(struct kvm_vcpu *vcpu); |
696 | bool (*get_nmi_mask)(struct kvm_vcpu *vcpu); | 696 | bool (*get_nmi_mask)(struct kvm_vcpu *vcpu); |
697 | void (*set_nmi_mask)(struct kvm_vcpu *vcpu, bool masked); | 697 | void (*set_nmi_mask)(struct kvm_vcpu *vcpu, bool masked); |
698 | void (*enable_nmi_window)(struct kvm_vcpu *vcpu); | 698 | int (*enable_nmi_window)(struct kvm_vcpu *vcpu); |
699 | int (*enable_irq_window)(struct kvm_vcpu *vcpu); | 699 | int (*enable_irq_window)(struct kvm_vcpu *vcpu); |
700 | void (*update_cr8_intercept)(struct kvm_vcpu *vcpu, int tpr, int irr); | 700 | void (*update_cr8_intercept)(struct kvm_vcpu *vcpu, int tpr, int irr); |
701 | int (*vm_has_apicv)(struct kvm *kvm); | 701 | int (*vm_has_apicv)(struct kvm *kvm); |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 7f896cbe717f..3421d5a92c06 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -3649,13 +3649,13 @@ static int enable_irq_window(struct kvm_vcpu *vcpu) | |||
3649 | return 0; | 3649 | return 0; |
3650 | } | 3650 | } |
3651 | 3651 | ||
3652 | static void enable_nmi_window(struct kvm_vcpu *vcpu) | 3652 | static int enable_nmi_window(struct kvm_vcpu *vcpu) |
3653 | { | 3653 | { |
3654 | struct vcpu_svm *svm = to_svm(vcpu); | 3654 | struct vcpu_svm *svm = to_svm(vcpu); |
3655 | 3655 | ||
3656 | if ((svm->vcpu.arch.hflags & (HF_NMI_MASK | HF_IRET_MASK)) | 3656 | if ((svm->vcpu.arch.hflags & (HF_NMI_MASK | HF_IRET_MASK)) |
3657 | == HF_NMI_MASK) | 3657 | == HF_NMI_MASK) |
3658 | return; /* IRET will cause a vm exit */ | 3658 | return 0; /* IRET will cause a vm exit */ |
3659 | 3659 | ||
3660 | /* | 3660 | /* |
3661 | * Something prevents NMI from been injected. Single step over possible | 3661 | * Something prevents NMI from been injected. Single step over possible |
@@ -3664,6 +3664,7 @@ static void enable_nmi_window(struct kvm_vcpu *vcpu) | |||
3664 | svm->nmi_singlestep = true; | 3664 | svm->nmi_singlestep = true; |
3665 | svm->vmcb->save.rflags |= (X86_EFLAGS_TF | X86_EFLAGS_RF); | 3665 | svm->vmcb->save.rflags |= (X86_EFLAGS_TF | X86_EFLAGS_RF); |
3666 | update_db_bp_intercept(vcpu); | 3666 | update_db_bp_intercept(vcpu); |
3667 | return 0; | ||
3667 | } | 3668 | } |
3668 | 3669 | ||
3669 | static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr) | 3670 | static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr) |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index e10217e99d2c..e53a5f7aa8a9 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -4417,22 +4417,20 @@ static int enable_irq_window(struct kvm_vcpu *vcpu) | |||
4417 | return 0; | 4417 | return 0; |
4418 | } | 4418 | } |
4419 | 4419 | ||
4420 | static void enable_nmi_window(struct kvm_vcpu *vcpu) | 4420 | static int enable_nmi_window(struct kvm_vcpu *vcpu) |
4421 | { | 4421 | { |
4422 | u32 cpu_based_vm_exec_control; | 4422 | u32 cpu_based_vm_exec_control; |
4423 | 4423 | ||
4424 | if (!cpu_has_virtual_nmis()) { | 4424 | if (!cpu_has_virtual_nmis()) |
4425 | enable_irq_window(vcpu); | 4425 | return enable_irq_window(vcpu); |
4426 | return; | 4426 | |
4427 | } | 4427 | if (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_STI) |
4428 | return enable_irq_window(vcpu); | ||
4428 | 4429 | ||
4429 | if (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_STI) { | ||
4430 | enable_irq_window(vcpu); | ||
4431 | return; | ||
4432 | } | ||
4433 | cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); | 4430 | cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); |
4434 | cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_NMI_PENDING; | 4431 | cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_NMI_PENDING; |
4435 | vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control); | 4432 | vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control); |
4433 | return 0; | ||
4436 | } | 4434 | } |
4437 | 4435 | ||
4438 | static void vmx_inject_irq(struct kvm_vcpu *vcpu) | 4436 | static void vmx_inject_irq(struct kvm_vcpu *vcpu) |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 96f914e828d4..94f35d22c5fb 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -5756,7 +5756,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) | |||
5756 | 5756 | ||
5757 | /* enable NMI/IRQ window open exits if needed */ | 5757 | /* enable NMI/IRQ window open exits if needed */ |
5758 | if (vcpu->arch.nmi_pending) | 5758 | if (vcpu->arch.nmi_pending) |
5759 | kvm_x86_ops->enable_nmi_window(vcpu); | 5759 | req_immediate_exit = |
5760 | kvm_x86_ops->enable_nmi_window(vcpu) != 0; | ||
5760 | else if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win) | 5761 | else if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win) |
5761 | req_immediate_exit = | 5762 | req_immediate_exit = |
5762 | kvm_x86_ops->enable_irq_window(vcpu) != 0; | 5763 | kvm_x86_ops->enable_irq_window(vcpu) != 0; |