Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aea218f3 authored by Gleb Natapov's avatar Gleb Natapov Committed by Avi Kivity
Browse files

KVM: PIC: call ack notifiers for irqs that are dropped form irr



After commit 242ec97c PIT interrupts are no longer delivered after
PIC reset. It happens because PIT injects interrupt only if previous one
was acked, but since on PIC reset it is dropped from irr it will never
be delivered and hence acknowledged. Fix that by calling ack notifier on
PIC reset.

Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent bdc0077a
Loading
Loading
Loading
Loading
+17 −0
Original line number Original line Diff line number Diff line
@@ -316,6 +316,11 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val)
	addr &= 1;
	addr &= 1;
	if (addr == 0) {
	if (addr == 0) {
		if (val & 0x10) {
		if (val & 0x10) {
			u8 edge_irr = s->irr & ~s->elcr;
			int i;
			bool found;
			struct kvm_vcpu *vcpu;

			s->init4 = val & 1;
			s->init4 = val & 1;
			s->last_irr = 0;
			s->last_irr = 0;
			s->irr &= s->elcr;
			s->irr &= s->elcr;
@@ -333,6 +338,18 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val)
			if (val & 0x08)
			if (val & 0x08)
				pr_pic_unimpl(
				pr_pic_unimpl(
					"level sensitive irq not supported");
					"level sensitive irq not supported");

			kvm_for_each_vcpu(i, vcpu, s->pics_state->kvm)
				if (kvm_apic_accept_pic_intr(vcpu)) {
					found = true;
					break;
				}


			if (found)
				for (irq = 0; irq < PIC_NUM_PINS/2; irq++)
					if (edge_irr & (1 << irq))
						pic_clear_isr(s, irq);
		} else if (val & 0x08) {
		} else if (val & 0x08) {
			if (val & 0x04)
			if (val & 0x04)
				s->poll = 1;
				s->poll = 1;