aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/i8259.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2009-08-04 08:30:28 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:33:22 -0400
commit938396a2341a4a96eaa5bea93a2bcdd69827c70c (patch)
tree23ddc1b10de3e01589171fd4e4d9fbe7f1068b8d /arch/x86/kvm/i8259.c
parent956f97cf665dc8c8ce2d5138bb38c022673b12d7 (diff)
KVM: Call ack notifiers from PIC when guest OS acks an IRQ.
Currently they are called when irq vector is been delivered. Calling ack notifiers at this point is wrong. Device assignment ack notifier enables host interrupts, but guest not yet had a chance to clear interrupt condition in a device. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/i8259.c')
-rw-r--r--arch/x86/kvm/i8259.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index d27320c8d464..3aacd331e2de 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -41,25 +41,16 @@ static void pic_lock(struct kvm_pic *s)
41static void pic_unlock(struct kvm_pic *s) 41static void pic_unlock(struct kvm_pic *s)
42 __releases(&s->lock) 42 __releases(&s->lock)
43{ 43{
44 struct kvm *kvm = s->kvm;
45 unsigned acks = s->pending_acks;
46 struct kvm_vcpu *vcpu;
47
48 s->pending_acks = 0;
49
50 spin_unlock(&s->lock); 44 spin_unlock(&s->lock);
51
52 while (acks) {
53 kvm_notify_acked_irq(kvm, SELECT_PIC(__ffs(acks)),
54 __ffs(acks));
55 acks &= acks - 1;
56 }
57} 45}
58 46
59static void pic_clear_isr(struct kvm_kpic_state *s, int irq) 47static void pic_clear_isr(struct kvm_kpic_state *s, int irq)
60{ 48{
61 s->isr &= ~(1 << irq); 49 s->isr &= ~(1 << irq);
62 s->isr_ack |= (1 << irq); 50 s->isr_ack |= (1 << irq);
51 if (s != &s->pics_state->pics[0])
52 irq += 8;
53 kvm_notify_acked_irq(s->pics_state->kvm, SELECT_PIC(irq), irq);
63} 54}
64 55
65void kvm_pic_clear_isr_ack(struct kvm *kvm) 56void kvm_pic_clear_isr_ack(struct kvm *kvm)
@@ -240,7 +231,6 @@ int kvm_pic_read_irq(struct kvm *kvm)
240 } 231 }
241 pic_update_irq(s); 232 pic_update_irq(s);
242 pic_unlock(s); 233 pic_unlock(s);
243 kvm_notify_acked_irq(kvm, SELECT_PIC(irq), irq);
244 234
245 return intno; 235 return intno;
246} 236}
@@ -260,7 +250,7 @@ void kvm_pic_reset(struct kvm_kpic_state *s)
260 if (vcpu0 && kvm_apic_accept_pic_intr(vcpu0)) 250 if (vcpu0 && kvm_apic_accept_pic_intr(vcpu0))
261 if (s->irr & (1 << irq) || s->isr & (1 << irq)) { 251 if (s->irr & (1 << irq) || s->isr & (1 << irq)) {
262 n = irq + irqbase; 252 n = irq + irqbase;
263 s->pics_state->pending_acks |= 1 << n; 253 kvm_notify_acked_irq(kvm, SELECT_PIC(n), n);
264 } 254 }
265 } 255 }
266 s->last_irr = 0; 256 s->last_irr = 0;