Commit 165072b0 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: x86: Move kvm_{before,after}_interrupt() calls to vendor code

VMX can conditionally call kvm_{before,after}_interrupt() since KVM
always uses "ack interrupt on exit" and therefore explicitly handles
interrupts as opposed to blindly enabling irqs.
Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 2342080c
...@@ -6174,6 +6174,7 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu, ...@@ -6174,6 +6174,7 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu,
static void svm_handle_external_intr(struct kvm_vcpu *vcpu) static void svm_handle_external_intr(struct kvm_vcpu *vcpu)
{ {
kvm_before_interrupt(vcpu);
local_irq_enable(); local_irq_enable();
/* /*
* We must have an instruction with interrupts enabled, so * We must have an instruction with interrupts enabled, so
...@@ -6181,6 +6182,7 @@ static void svm_handle_external_intr(struct kvm_vcpu *vcpu) ...@@ -6181,6 +6182,7 @@ static void svm_handle_external_intr(struct kvm_vcpu *vcpu)
*/ */
asm("nop"); asm("nop");
local_irq_disable(); local_irq_disable();
kvm_after_interrupt(vcpu);
} }
static void svm_sched_in(struct kvm_vcpu *vcpu, int cpu) static void svm_sched_in(struct kvm_vcpu *vcpu, int cpu)
......
...@@ -6145,6 +6145,8 @@ static void vmx_handle_external_intr(struct kvm_vcpu *vcpu) ...@@ -6145,6 +6145,8 @@ static void vmx_handle_external_intr(struct kvm_vcpu *vcpu)
desc = (gate_desc *)host_idt_base + vector; desc = (gate_desc *)host_idt_base + vector;
entry = gate_offset(desc); entry = gate_offset(desc);
kvm_before_interrupt(vcpu);
asm volatile( asm volatile(
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
"mov %%" _ASM_SP ", %[sp]\n\t" "mov %%" _ASM_SP ", %[sp]\n\t"
...@@ -6165,6 +6167,8 @@ static void vmx_handle_external_intr(struct kvm_vcpu *vcpu) ...@@ -6165,6 +6167,8 @@ static void vmx_handle_external_intr(struct kvm_vcpu *vcpu)
[ss]"i"(__KERNEL_DS), [ss]"i"(__KERNEL_DS),
[cs]"i"(__KERNEL_CS) [cs]"i"(__KERNEL_CS)
); );
kvm_after_interrupt(vcpu);
} }
STACK_FRAME_NON_STANDARD(vmx_handle_external_intr); STACK_FRAME_NON_STANDARD(vmx_handle_external_intr);
......
...@@ -7999,9 +7999,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) ...@@ -7999,9 +7999,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
vcpu->mode = OUTSIDE_GUEST_MODE; vcpu->mode = OUTSIDE_GUEST_MODE;
smp_wmb(); smp_wmb();
kvm_before_interrupt(vcpu);
kvm_x86_ops->handle_external_intr(vcpu); kvm_x86_ops->handle_external_intr(vcpu);
kvm_after_interrupt(vcpu);
++vcpu->stat.exits; ++vcpu->stat.exits;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment