Il 04/09/2012 16:29, Maciej W. Rozycki ha scritto: > So first of all, the *output* of the 8259A is always edge triggered, > regardless of whether it's the master or one of the slaves (only one slave > is used in the PC/AT architecture, but up to eight are supported; the > PC/XT had none).
I swear I read all your message :) but this seems to be the crux. It means that something like this ought to fix the bug too. Matthew, can you post your code or test it? diff --git a/hw/i8259.c b/hw/i8259.c index 53daf78..3dc1dff 100644 --- a/hw/i8259.c +++ b/hw/i8259.c @@ -104,12 +104,11 @@ static void pic_update_irq(PICCommonState *s) int irq; irq = pic_get_irq(s); + qemu_irq_lower(s->int_out[0]); if (irq >= 0) { DPRINTF("pic%d: imr=%x irr=%x padd=%d\n", s->master ? 0 : 1, s->imr, s->irr, s->priority_add); qemu_irq_raise(s->int_out[0]); - } else { - qemu_irq_lower(s->int_out[0]); } } The logic of the in-kernel 8259 is a bit different, but something like this should do it, too: diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c index 81cf4fa..feb6d5b 100644 --- a/arch/x86/kvm/i8259.c +++ b/arch/x86/kvm/i8259.c @@ -174,9 +174,11 @@ static void pic_update_irq(struct kvm_pic *s) /* * if irq request by slave pic, signal master PIC */ + pic_set_irq1(&s->pics[0], 2, 0); pic_set_irq1(&s->pics[0], 2, 1); + } else if (s->pics[0].irr & (1 << 2)) pic_set_irq1(&s->pics[0], 2, 0); - } + irq = pic_get_irq(&s->pics[0]); pic_irq_request(s->kvm, irq >= 0); } Both patches untested. Paolo