From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9Hlr-0001bH-4B for qemu-devel@nongnu.org; Wed, 05 Sep 2012 11:44:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9Hll-0006HK-AZ for qemu-devel@nongnu.org; Wed, 05 Sep 2012 11:44:03 -0400 Received: from david.siemens.de ([192.35.17.14]:15669) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9Hll-0006H4-11 for qemu-devel@nongnu.org; Wed, 05 Sep 2012 11:43:57 -0400 Message-ID: <50477334.5000508@siemens.com> Date: Wed, 05 Sep 2012 17:43:48 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1346640974-30974-1-git-send-email-mmogilvi_qemu@miniinfo.net> <1346640974-30974-6-git-send-email-mmogilvi_qemu@miniinfo.net> <50446F9A.4070809@web.de> <5046135B.2080200@redhat.com> <20120905043346.GA7965@comcast.net> In-Reply-To: <20120905043346.GA7965@comcast.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 5/5] i8259: fix dynamically masking slave IRQs with IMR register List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Matthew Ogilvie Cc: Paolo Bonzini , qemu-devel@nongnu.org, "Maciej W. Rozycki" On 2012-09-05 06:33, Matthew Ogilvie wrote: > According to later discussion, the main issue is actually the input > IRQ behavior on a high to low transition; hence the following fixes > both the test program and the Microport UNIX problem: > > diff --git a/hw/i8259.c b/hw/i8259.c > index 6587666..c011787 100644 > --- a/hw/i8259.c > +++ b/hw/i8259.c > @@ -143,22 +143,23 @@ static void pic_set_irq(void *opaque, int irq, int level) > if (s->elcr & mask) { > /* level triggered */ > if (level) { > s->irr |= mask; > s->last_irr |= mask; > } else { > s->irr &= ~mask; > s->last_irr &= ~mask; > } > } else { > /* edge triggered */ > if (level) { > if ((s->last_irr & mask) == 0) { > s->irr |= mask; > } > s->last_irr |= mask; > } else { > + s->irr &= ~mask; > s->last_irr &= ~mask; > } > } > pic_update_irq(s); > } > > > Perhaps it would be worth it to swap around the "if"s a little bit > to avoid the (!level) duplication, and clarify that the only difference > is in the low to high transition? Yes, refactoring would be welcome. But I would suggest to do this in two patches, leaving the above change (+ changelog that explains the reason) in its current clarity. Hurray, no vmstate subsections needed! :) Jan -- Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux