From patchwork Thu Jan 10 14:41:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 211025 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 3E20A2C0095 for ; Fri, 11 Jan 2013 01:42:00 +1100 (EST) Received: from localhost ([::1]:56266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtJKQ-0006WR-C8 for incoming@patchwork.ozlabs.org; Thu, 10 Jan 2013 09:41:58 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtJKF-0006WM-HX for qemu-devel@nongnu.org; Thu, 10 Jan 2013 09:41:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtJKE-0004tG-Bo for qemu-devel@nongnu.org; Thu, 10 Jan 2013 09:41:47 -0500 Received: from mail-vc0-f169.google.com ([209.85.220.169]:53166) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtJKE-0004tB-7W for qemu-devel@nongnu.org; Thu, 10 Jan 2013 09:41:46 -0500 Received: by mail-vc0-f169.google.com with SMTP id gb23so467396vcb.14 for ; Thu, 10 Jan 2013 06:41:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer; bh=yVu8buRauE61jOIxjRJZTbOQ7I/BbVI7/+y6Q64MLQU=; b=Qa/tejm4WXxBcaF5e3hpVWHaN2bVQ8wJDwufovKe4FwlknlZymrpsy6OfFIZ74eSoe RV03pQ62bbuTT1keppLHCZ8cLQFyZMkxQh3MZpscugi3cJ3hZT9ocG4pJXuZ/JyXYjX7 gJpDr7hIUrCU/+n1VGRNJdq14j8Pfe62XBbnzsvy0gzTW0hA/mqAHKmh8uQU5zdA9cy3 GIHbic/OWH23sdENA0g8UunV2D0MVpag1OE6KTIpnZrIvG0yp6DwjeYsBnPK0ZkWiyaD E85kzOenUCVpXSFCh1jgE0BVbSSfVaWzmMA9FipaD4Fx0Pu8fpPnuuIho25PIxG8NQK2 pvZA== X-Received: by 10.58.31.200 with SMTP id c8mr10703003vei.23.1357828905639; Thu, 10 Jan 2013 06:41:45 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-179-137.ip50.fastwebnet.it. [93.34.179.137]) by mx.google.com with ESMTPS id j5sm472611vdi.19.2013.01.10.06.41.43 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 10 Jan 2013 06:41:45 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 10 Jan 2013 15:41:38 +0100 Message-Id: <1357828898-2545-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.169 Cc: mst@redhat.com Subject: [Qemu-devel] [PATCH] pci: clean up resetting of IRQs 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 A PCI bus reset will deassert the INTX pins, and this will make the irq_count array all-zeroes. Check that this is the case, and remove the existing loop which might even unsync irq_count and irq_state. Signed-off-by: Paolo Bonzini --- hw/pci/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 94840c4..d6c63ff 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -213,14 +213,14 @@ void pci_bus_reset(PCIBus *bus) { int i; - for (i = 0; i < bus->nirq; i++) { - bus->irq_count[i] = 0; - } for (i = 0; i < ARRAY_SIZE(bus->devices); ++i) { if (bus->devices[i]) { pci_device_reset(bus->devices[i]); } } + for (i = 0; i < bus->nirq; i++) { + assert(bus->irq_count[i] == 0); + } } static int pcibus_reset(BusState *qbus)