From patchwork Mon Dec 17 16:24:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 206933 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 2C2392C007D for ; Tue, 18 Dec 2012 04:30:20 +1100 (EST) Received: from localhost ([::1]:46954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkdVn-00019d-Qu for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2012 11:25:51 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkdVE-0008JT-Jw for qemu-devel@nongnu.org; Mon, 17 Dec 2012 11:25:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkdVA-0008Fc-0I for qemu-devel@nongnu.org; Mon, 17 Dec 2012 11:25:16 -0500 Received: from mail-ia0-f173.google.com ([209.85.210.173]:53575) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkdV9-0008FX-O9 for qemu-devel@nongnu.org; Mon, 17 Dec 2012 11:25:11 -0500 Received: by mail-ia0-f173.google.com with SMTP id w21so5709644iac.4 for ; Mon, 17 Dec 2012 08:25:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=oU0cJvsTTPSWxV/Bl+ZHMkkxaGBwDf2VcCGXzsp2eEw=; b=WkWabsU1F1ZC0EGY/6zLphh8vvaPKua6TTaTLUtHVz79Cdqcj47tmnZIEa2HRzouvZ KSTmO5pOrsbS2uTvTWJrWUODY4S+C0nycrv3MhKAjPjZTNg/19DZsbJWLD01IrdjI5Lm G2hwQrmrlSZcYsA48TFDcODCfuE0NWS6JjYJmtIITZbfNluoMFGaX2isHIvYuZKJ+Xf3 B7S7C1neopsWw+QLNx0i4YnjvFyURprCSuIKy1BT8jCjVGntQ3g/VRsK2NqhTh3jgRNW iaPPLHUToEeMBvmFQC6cxsfJmtOXLZFuzCjH7heBJXdtVCz+L7TpYC3HPsUil3NB2PaR ehTQ== Received: by 10.50.0.168 with SMTP id 8mr9735433igf.36.1355761511248; Mon, 17 Dec 2012 08:25:11 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-219-150.ip51.fastwebnet.it. [93.34.219.150]) by mx.google.com with ESMTPS id bh3sm5950327igc.0.2012.12.17.08.25.07 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Dec 2012 08:25:10 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 17 Dec 2012 17:24:38 +0100 Message-Id: <1355761490-10073-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.0.2 In-Reply-To: <1355761490-10073-1-git-send-email-pbonzini@redhat.com> References: <1355761490-10073-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.210.173 Cc: aliguori@us.ibm.com, mst@redhat.com Subject: [Qemu-devel] [PATCH 03/15] 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.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 97a0cd7..ace9368 100644 --- a/hw/pci.c +++ b/hw/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)