From patchwork Wed Sep 28 11:00:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 116768 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CBB85B6F7F for ; Wed, 28 Sep 2011 21:59:59 +1000 (EST) Received: from localhost ([::1]:33316 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8rtw-0007Un-6x for incoming@patchwork.ozlabs.org; Wed, 28 Sep 2011 07:02:08 -0400 Received: from eggs.gnu.org ([140.186.70.92]:46901) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8rt8-0004jb-7R for qemu-devel@nongnu.org; Wed, 28 Sep 2011 07:01:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R8rt2-0004FA-HJ for qemu-devel@nongnu.org; Wed, 28 Sep 2011 07:01:18 -0400 Received: from thoth.sbs.de ([192.35.17.2]:15755) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8rt2-0004Dl-7f for qemu-devel@nongnu.org; Wed, 28 Sep 2011 07:01:12 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id p8SB1AiG005499; Wed, 28 Sep 2011 13:01:10 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id p8SB18Vw017664; Wed, 28 Sep 2011 13:01:10 +0200 From: Jan Kiszka To: Anthony Liguori , qemu-devel Date: Wed, 28 Sep 2011 13:00:56 +0200 Message-Id: X-Mailer: git-send-email 1.7.3.4 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.2 Cc: Blue Swirl Subject: [Qemu-devel] [PATCH 10/22] i8259: Reorder intack in pic_read_irq 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 As we want to move the IRQ update to pic_intack, ordering matters: the slave ack must be executed before the master ack to avoid missing further pending slave IRQs. Signed-off-by: Jan Kiszka --- hw/i8259.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/i8259.c b/hw/i8259.c index cddd3c7..b7a011f 100644 --- a/hw/i8259.c +++ b/hw/i8259.c @@ -228,7 +228,6 @@ int pic_read_irq(PicState2 *s) irq = pic_get_irq(&s->pics[0]); if (irq >= 0) { - pic_intack(&s->pics[0], irq); if (irq == 2) { irq2 = pic_get_irq(&s->pics[1]); if (irq2 >= 0) { @@ -238,12 +237,10 @@ int pic_read_irq(PicState2 *s) irq2 = 7; } intno = s->pics[1].irq_base + irq2; -#if defined(DEBUG_PIC) || defined(DEBUG_IRQ_LATENCY) - irq = irq2 + 8; -#endif } else { intno = s->pics[0].irq_base + irq; } + pic_intack(&s->pics[0], irq); } else { /* spurious IRQ on host controller */ irq = 7; @@ -251,6 +248,11 @@ int pic_read_irq(PicState2 *s) } pic_update_irq(s); +#if defined(DEBUG_PIC) || defined(DEBUG_IRQ_LATENCY) + if (irq == 2) { + irq = irq2 + 8; + } +#endif #ifdef DEBUG_IRQ_LATENCY printf("IRQ%d latency=%0.3fus\n", irq,