From patchwork Fri Dec 6 16:54:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 298209 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 233272C00A8 for ; Sat, 7 Dec 2013 06:13:27 +1100 (EST) Received: from localhost ([::1]:60281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Voyo5-0000Ql-Ex for incoming@patchwork.ozlabs.org; Fri, 06 Dec 2013 12:03:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Voyg1-0005x8-5O for qemu-devel@nongnu.org; Fri, 06 Dec 2013 11:55:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Voyfs-0000cK-B1 for qemu-devel@nongnu.org; Fri, 06 Dec 2013 11:54:53 -0500 Received: from mail-ea0-x22b.google.com ([2a00:1450:4013:c01::22b]:32794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Voyfs-0000cB-0h for qemu-devel@nongnu.org; Fri, 06 Dec 2013 11:54:44 -0500 Received: by mail-ea0-f171.google.com with SMTP id h10so422790eak.16 for ; Fri, 06 Dec 2013 08:54:43 -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:in-reply-to:references; bh=sb+BUCmpxkJKMM/ddxGmcDohtIFhTZaH9HvyZB6B7OM=; b=lQEYFLeTRRroQNErFmr/nEf0NzDB2fuXuxdOCTZUkABpXRCOj1IXAuANEQh31tmr8h j9N4OvcsmJZOeR/P98zBEl4wlWTwQnh/V7a4kVXR1rqAltGyHjpcTIsDS/mv1H463kVG qI+N2c8mOeQGaFrqTOBwgQ5Z1ajABbG/bPoenF737ZM75bRddvbYWcfusrB0OGv56h5I e7LRJdBDTQ4Ia5H0VdICaoPTcagSFqgs+OlDKTqSorBqOWLLP4mCjbE6FZ5yWxhejSvA ammNlSd0+RB0e3WIAjWcp2dB0twQkRAISNMI/XK0gtpehPsE+OFy2CO2KSPo4215o6eQ RwKQ== X-Received: by 10.15.26.200 with SMTP id n48mr3360056eeu.46.1386348883055; Fri, 06 Dec 2013 08:54:43 -0800 (PST) Received: from localhost.localdomain (net-2-35-202-54.cust.dsl.vodafone.it. [2.35.202.54]) by mx.google.com with ESMTPSA id z42sm47261952eeo.17.2013.12.06.08.54.40 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 06 Dec 2013 08:54:42 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Dec 2013 17:54:25 +0100 Message-Id: <1386348867-25038-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1386348867-25038-1-git-send-email-pbonzini@redhat.com> References: <1386348867-25038-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::22b Cc: mst@redhat.com Subject: [Qemu-devel] [PATCH 2/4] 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 pci_device_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 | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index ac3244b..0efc544 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -215,15 +215,16 @@ static int pcibus_reset(BusState *qbus) PCIBus *bus = DO_UPCAST(PCIBus, qbus, qbus); 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); + } + /* topology traverse is done by pci_bus_reset(). Tell qbus/qdev walker not to traverse the tree */ return 1;