From patchwork Tue Mar 22 22:59:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 87967 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 26E9CB6F44 for ; Wed, 23 Mar 2011 10:01:11 +1100 (EST) Received: from localhost ([127.0.0.1]:52877 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q2AZY-0004ct-AW for incoming@patchwork.ozlabs.org; Tue, 22 Mar 2011 19:01:08 -0400 Received: from [140.186.70.92] (port=54478 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q2AY3-0004bF-EA for qemu-devel@nongnu.org; Tue, 22 Mar 2011 18:59:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q2AY2-0007am-7a for qemu-devel@nongnu.org; Tue, 22 Mar 2011 18:59:35 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:46279) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q2AY0-0007a9-QZ for qemu-devel@nongnu.org; Tue, 22 Mar 2011 18:59:34 -0400 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id D240118929; Wed, 23 Mar 2011 07:59:28 +0900 (JST) Received: (nullmailer pid 13838 invoked by uid 1000); Tue, 22 Mar 2011 22:59:28 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org Date: Wed, 23 Mar 2011 07:59:28 +0900 Message-Id: X-Mailer: git-send-email 1.7.1.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 210.128.90.3 Cc: yamahata@valinux.co.jp, mst@redhat.com Subject: [Qemu-devel] [PATCH v4 4/4] piix_pci: load path clean up X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The previous patch didn't change the behavior when load, it resulted in ugly code. This patch cleans it up. With this patch, pic irq lines are manipulated when loaded. It is expected that it won't change the behaviour because the interrupts are level: at the moment e.g. pci devices already reassert interrupts on load. Signed-off-by: Isaku Yamahata --- Changes v3 -> v4: - newly introduced - TODO: test more OSes, stress test with save/load, live-migration --- hw/piix_pci.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/piix_pci.c b/hw/piix_pci.c index eb9a398..1b8dcef 100644 --- a/hw/piix_pci.c +++ b/hw/piix_pci.c @@ -280,8 +280,7 @@ static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq) ((PIIX_NUM_PIRQS - 1) << (pic_irq * PIIX_NUM_PIRQS)))); } -static void piix3_set_irq_level(PIIX3State *piix3, int pirq, int level, - bool propagate) +static void piix3_set_irq_level(PIIX3State *piix3, int pirq, int level) { int pic_irq; uint64_t mask; @@ -295,15 +294,13 @@ static void piix3_set_irq_level(PIIX3State *piix3, int pirq, int level, piix3->pic_levels &= ~mask; piix3->pic_levels |= mask * !!level; - if (propagate) { - piix3_set_irq_pic(piix3, pic_irq); - } + piix3_set_irq_pic(piix3, pic_irq); } static void piix3_set_irq(void *opaque, int pirq, int level) { PIIX3State *piix3 = opaque; - piix3_set_irq_level(piix3, pirq, level, true); + piix3_set_irq_level(piix3, pirq, level); } /* irq routing is changed. so rebuild bitmap */ @@ -314,8 +311,7 @@ static void piix3_update_irq_levels(PIIX3State *piix3) piix3->pic_levels = 0; for (pirq = 0; pirq < PIIX_NUM_PIRQS; pirq++) { piix3_set_irq_level(piix3, pirq, - pci_bus_get_irq_level(piix3->dev.bus, pirq), - false); + pci_bus_get_irq_level(piix3->dev.bus, pirq)); } }