aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2014-03-07 14:03:15 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2014-03-11 03:41:47 -0400
commitc9a7953f09bbe2b66050ebf97e0532eaeefbc9f3 (patch)
tree8a4387796e3f9946cea1725566e584dff525c3f8 /arch/x86/kvm/vmx.c
parent220c56729766444f3dd823f740a147ca6d82c4c6 (diff)
KVM: x86: Remove return code from enable_irq/nmi_window
It's no longer possible to enter enable_irq_window in guest mode when L1 intercepts external interrupts and we are entering L2. This is now caught in vcpu_enter_guest. So we can remove the check from the VMX version of enable_irq_window, thus the need to return an error code from both enable_irq_window and enable_nmi_window. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 2c9d21e2d033..fcc1947db296 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -4514,39 +4514,28 @@ static bool nested_exit_on_nmi(struct kvm_vcpu *vcpu)
4514 PIN_BASED_NMI_EXITING; 4514 PIN_BASED_NMI_EXITING;
4515} 4515}
4516 4516
4517static int enable_irq_window(struct kvm_vcpu *vcpu) 4517static void enable_irq_window(struct kvm_vcpu *vcpu)
4518{ 4518{
4519 u32 cpu_based_vm_exec_control; 4519 u32 cpu_based_vm_exec_control;
4520 4520
4521 if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu))
4522 /*
4523 * We get here if vmx_interrupt_allowed() said we can't
4524 * inject to L1 now because L2 must run. The caller will have
4525 * to make L2 exit right after entry, so we can inject to L1
4526 * more promptly.
4527 */
4528 return -EBUSY;
4529
4530 cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); 4521 cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
4531 cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_INTR_PENDING; 4522 cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_INTR_PENDING;
4532 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control); 4523 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
4533 return 0;
4534} 4524}
4535 4525
4536static int enable_nmi_window(struct kvm_vcpu *vcpu) 4526static void enable_nmi_window(struct kvm_vcpu *vcpu)
4537{ 4527{
4538 u32 cpu_based_vm_exec_control; 4528 u32 cpu_based_vm_exec_control;
4539 4529
4540 if (!cpu_has_virtual_nmis()) 4530 if (!cpu_has_virtual_nmis() ||
4541 return enable_irq_window(vcpu); 4531 vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_STI) {
4542 4532 enable_irq_window(vcpu);
4543 if (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_STI) 4533 return;
4544 return enable_irq_window(vcpu); 4534 }
4545 4535
4546 cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); 4536 cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
4547 cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_NMI_PENDING; 4537 cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_NMI_PENDING;
4548 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control); 4538 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
4549 return 0;
4550} 4539}
4551 4540
4552static void vmx_inject_irq(struct kvm_vcpu *vcpu) 4541static void vmx_inject_irq(struct kvm_vcpu *vcpu)