From patchwork Thu Oct 3 13:46:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 280333 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 86FC42C0090 for ; Thu, 3 Oct 2013 23:47:05 +1000 (EST) Received: from localhost ([::1]:43421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRjF9-0000yY-1o for incoming@patchwork.ozlabs.org; Thu, 03 Oct 2013 09:47:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRjEd-0000sW-38 for qemu-devel@nongnu.org; Thu, 03 Oct 2013 09:46:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRjEW-0000yf-WA for qemu-devel@nongnu.org; Thu, 03 Oct 2013 09:46:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRjEW-0000xC-O3 for qemu-devel@nongnu.org; Thu, 03 Oct 2013 09:46:24 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r93DkNql005000 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 3 Oct 2013 09:46:23 -0400 Received: from playground.com (ovpn-112-65.ams2.redhat.com [10.36.112.65]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r93DkGUU004038; Thu, 3 Oct 2013 09:46:21 -0400 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 3 Oct 2013 15:46:13 +0200 Message-Id: <1380807975-13266-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1380807975-13266-1-git-send-email-pbonzini@redhat.com> References: <1380807975-13266-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 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;