From patchwork Mon Sep 10 01:27:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Ogilvie X-Patchwork-Id: 182773 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CAA382C007D for ; Mon, 10 Sep 2012 11:29:38 +1000 (EST) Received: from localhost ([::1]:59043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TAsoi-0004r5-JC for incoming@patchwork.ozlabs.org; Sun, 09 Sep 2012 21:29:36 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TAsoJ-0004I1-Gj for qemu-devel@nongnu.org; Sun, 09 Sep 2012 21:29:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TAsoI-0003C2-BG for qemu-devel@nongnu.org; Sun, 09 Sep 2012 21:29:11 -0400 Received: from qmta02.emeryville.ca.mail.comcast.net ([76.96.30.24]:55445) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TAsoI-0003Al-4m for qemu-devel@nongnu.org; Sun, 09 Sep 2012 21:29:10 -0400 Received: from omta07.emeryville.ca.mail.comcast.net ([76.96.30.59]) by qmta02.emeryville.ca.mail.comcast.net with comcast id xDMt1j00F1GXsucA2DV9c3; Mon, 10 Sep 2012 01:29:09 +0000 Received: from mmogilvi.homeip.net ([24.9.53.136]) by omta07.emeryville.ca.mail.comcast.net with comcast id xDV81j00C2wKXRC8UDV8xt; Mon, 10 Sep 2012 01:29:09 +0000 Received: by mmogilvi.homeip.net (Postfix, from userid 501) id 032251E9601B; Sun, 9 Sep 2012 19:29:07 -0600 (MDT) From: Matthew Ogilvie To: qemu-devel@nongnu.org Date: Sun, 9 Sep 2012 19:27:45 -0600 Message-Id: <1347240466-6152-6-git-send-email-mmogilvi_qemu@miniinfo.net> X-Mailer: git-send-email 1.7.10.2.484.gcd07cc5 In-Reply-To: <1347240466-6152-1-git-send-email-mmogilvi_qemu@miniinfo.net> References: <1347240466-6152-1-git-send-email-mmogilvi_qemu@miniinfo.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 76.96.30.24 Cc: Paolo Bonzini , Jan Kiszka , Matthew Ogilvie , "Maciej W. Rozycki" Subject: [Qemu-devel] [PATCH v5 5/6] i8259: fix so that dropping IRQ level always clears the interrupt request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Intel's definition of "edge triggered" means: "asserted with a low-to-high transition at the time an interrupt is registered and then kept high until the interrupt is served via one of the EOI mechanisms or goes away unhandled." So the only difference between edge triggered and level triggered is in the leading edge, with no difference in the trailing edge. This bug manifested itself when the guest was Microport UNIX System V/386 v2.1 (ca. 1987), because it would sometimes mask off IRQ14 in the slave IMR after it had already been asserted. The master would still try to deliver an interrupt even though IRQ2 had dropped again, resulting in a spurious interupt (IRQ15) and a panicked kernel. Signed-off-by: Matthew Ogilvie --- If you missed the previous thread about this, see http://www.mail-archive.com/qemu-devel@nongnu.org/msg129071.html hw/i8259.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/i8259.c b/hw/i8259.c index 6587666..c011787 100644 --- a/hw/i8259.c +++ b/hw/i8259.c @@ -157,6 +157,7 @@ static void pic_set_irq(void *opaque, int irq, int level) } s->last_irr |= mask; } else { + s->irr &= ~mask; s->last_irr &= ~mask; } }