From: Jan Kiszka Date: Tue, 24 Jan 2012 15:29:29 +0000 (+0100) Subject: i8259: Do not clear level-triggered lines in IRR on init X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~4515 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aa24822bdc7c4e74afbc6fa1324b01cf067da7cb;p=sdk%2Femulator%2Fqemu.git i8259: Do not clear level-triggered lines in IRR on init When an input line is handled as level-triggered, it will immediately raise an IRQ on the output of a PIC again that goes through an init reset. So only clear the edge-triggered inputs from IRR in that scenario. Signed-off-by: Jan Kiszka Signed-off-by: Anthony Liguori --- diff --git a/hw/i8259.c b/hw/i8259.c index 1a4b1ab..53daf78 100644 --- a/hw/i8259.c +++ b/hw/i8259.c @@ -231,8 +231,8 @@ static void pic_reset(DeviceState *dev) { PICCommonState *s = DO_UPCAST(PICCommonState, dev.qdev, dev); - pic_init_reset(s); s->elcr = 0; + pic_init_reset(s); } static void pic_ioport_write(void *opaque, target_phys_addr_t addr64, diff --git a/hw/i8259_common.c b/hw/i8259_common.c index 775fda4..ab3d98b 100644 --- a/hw/i8259_common.c +++ b/hw/i8259_common.c @@ -28,7 +28,7 @@ void pic_reset_common(PICCommonState *s) { s->last_irr = 0; - s->irr = 0; + s->irr &= s->elcr; s->imr = 0; s->isr = 0; s->priority_add = 0; diff --git a/hw/kvm/i8259.c b/hw/kvm/i8259.c index eb98889..94d1b9a 100644 --- a/hw/kvm/i8259.c +++ b/hw/kvm/i8259.c @@ -84,8 +84,8 @@ static void kvm_pic_reset(DeviceState *dev) { PICCommonState *s = DO_UPCAST(PICCommonState, dev.qdev, dev); - pic_reset_common(s); s->elcr = 0; + pic_reset_common(s); kvm_pic_put(s); }