aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/i8259.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2008-07-26 16:01:00 -0400
committerAvi Kivity <avi@qumranet.com>2008-10-15 04:15:16 -0400
commitf52447261bc8c21dfd4635196e32d2da1352f589 (patch)
treea0de6cefa7fbfdd07285bd60c4f61e4e2f2d4ed6 /arch/x86/kvm/i8259.c
parent564f15378f04921d5749f27ec53d5e68a6d1d446 (diff)
KVM: irq ack notification
Based on a patch from: Ben-Ami Yassour <benami@il.ibm.com> which was based on a patch from: Amit Shah <amit.shah@qumranet.com> Notify IRQ acking on PIC/APIC emulation. The previous patch missed two things: - Edge triggered interrupts on IOAPIC - PIC reset with IRR/ISR set should be equivalent to ack (LAPIC probably needs something similar). Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> CC: Amit Shah <amit.shah@qumranet.com> CC: Ben-Ami Yassour <benami@il.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm/i8259.c')
-rw-r--r--arch/x86/kvm/i8259.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 55e179ad98ef..de704995b819 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -159,9 +159,10 @@ static inline void pic_intack(struct kvm_kpic_state *s, int irq)
159 s->irr &= ~(1 << irq); 159 s->irr &= ~(1 << irq);
160} 160}
161 161
162int kvm_pic_read_irq(struct kvm_pic *s) 162int kvm_pic_read_irq(struct kvm *kvm)
163{ 163{
164 int irq, irq2, intno; 164 int irq, irq2, intno;
165 struct kvm_pic *s = pic_irqchip(kvm);
165 166
166 irq = pic_get_irq(&s->pics[0]); 167 irq = pic_get_irq(&s->pics[0]);
167 if (irq >= 0) { 168 if (irq >= 0) {
@@ -187,12 +188,21 @@ int kvm_pic_read_irq(struct kvm_pic *s)
187 intno = s->pics[0].irq_base + irq; 188 intno = s->pics[0].irq_base + irq;
188 } 189 }
189 pic_update_irq(s); 190 pic_update_irq(s);
191 kvm_notify_acked_irq(kvm, irq);
190 192
191 return intno; 193 return intno;
192} 194}
193 195
194void kvm_pic_reset(struct kvm_kpic_state *s) 196void kvm_pic_reset(struct kvm_kpic_state *s)
195{ 197{
198 int irq;
199 struct kvm *kvm = s->pics_state->irq_request_opaque;
200
201 for (irq = 0; irq < PIC_NUM_PINS; irq++) {
202 if (!(s->imr & (1 << irq)) && (s->irr & (1 << irq) ||
203 s->isr & (1 << irq)))
204 kvm_notify_acked_irq(kvm, irq);
205 }
196 s->last_irr = 0; 206 s->last_irr = 0;
197 s->irr = 0; 207 s->irr = 0;
198 s->imr = 0; 208 s->imr = 0;