aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2009-03-23 06:12:11 -0400
committerAvi Kivity <avi@redhat.com>2009-06-10 04:48:33 -0400
commit78646121e9a2fcf7977cc15966420e572a450bc3 (patch)
tree55aeac260f4a43bef8e1bc1147f93a3f7e867ec7 /arch/x86/kvm/svm.c
parent09cec754885f900f6aab23801878c0cd217ee1d6 (diff)
KVM: Fix interrupt unhalting a vcpu when it shouldn't
kvm_vcpu_block() unhalts vpu on an interrupt/timer without checking if interrupt window is actually opened. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r--arch/x86/kvm/svm.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index aa528dbad070..de741043c5b1 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2270,6 +2270,15 @@ static void update_cr8_intercept(struct kvm_vcpu *vcpu)
2270 vmcb->control.intercept_cr_write |= INTERCEPT_CR8_MASK; 2270 vmcb->control.intercept_cr_write |= INTERCEPT_CR8_MASK;
2271} 2271}
2272 2272
2273static int svm_interrupt_allowed(struct kvm_vcpu *vcpu)
2274{
2275 struct vcpu_svm *svm = to_svm(vcpu);
2276 struct vmcb *vmcb = svm->vmcb;
2277 return (vmcb->save.rflags & X86_EFLAGS_IF) &&
2278 !(vmcb->control.int_state & SVM_INTERRUPT_SHADOW_MASK) &&
2279 (svm->vcpu.arch.hflags & HF_GIF_MASK);
2280}
2281
2273static void svm_intr_assist(struct kvm_vcpu *vcpu) 2282static void svm_intr_assist(struct kvm_vcpu *vcpu)
2274{ 2283{
2275 struct vcpu_svm *svm = to_svm(vcpu); 2284 struct vcpu_svm *svm = to_svm(vcpu);
@@ -2649,6 +2658,7 @@ static struct kvm_x86_ops svm_x86_ops = {
2649 .exception_injected = svm_exception_injected, 2658 .exception_injected = svm_exception_injected,
2650 .inject_pending_irq = svm_intr_assist, 2659 .inject_pending_irq = svm_intr_assist,
2651 .inject_pending_vectors = do_interrupt_requests, 2660 .inject_pending_vectors = do_interrupt_requests,
2661 .interrupt_allowed = svm_interrupt_allowed,
2652 2662
2653 .set_tss_addr = svm_set_tss_addr, 2663 .set_tss_addr = svm_set_tss_addr,
2654 .get_tdp_level = get_npt_level, 2664 .get_tdp_level = get_npt_level,