From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=51850 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLDEB-0004MF-J9 for qemu-devel@nongnu.org; Wed, 24 Nov 2010 06:09:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PLDEA-0004zR-Dm for qemu-devel@nongnu.org; Wed, 24 Nov 2010 06:09:31 -0500 Received: from mail.valinux.co.jp ([210.128.90.3]:47946) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PLDE9-0004yR-Vh for qemu-devel@nongnu.org; Wed, 24 Nov 2010 06:09:30 -0500 Date: Wed, 24 Nov 2010 20:09:27 +0900 From: Isaku Yamahata Message-ID: <20101124110927.GC5118@valinux.co.jp> References: <20101122075402.GA6892@redhat.com> <20101122104337.GB24265@valinux.co.jp> <20101122225312.GA1359@redhat.com> <20101123181026.GA2752@redhat.com> <20101124023725.GC9591@valinux.co.jp> <20101124052758.GA19320@redhat.com> <20101124071514.GA5118@valinux.co.jp> <20101124105943.GD23493@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101124105943.GD23493@redhat.com> Subject: [Qemu-devel] Re: [PATCH v2 0/6] qdev reset refactoring and pci bus reset List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: skandasa@cisco.com, etmartin@cisco.com, wexu2@cisco.com, qemu-devel@nongnu.org, kraxel@redhat.com, pbonzini@redhat.com On Wed, Nov 24, 2010 at 12:59:43PM +0200, Michael S. Tsirkin wrote: > > > @@ -1552,20 +1562,21 @@ PCIBus *pci_find_bus(PCIBus *bus, int bus_num) > > > return bus; > > > } > > > > > > + /* Consider all bus numbers in range for the host pci bridge. */ > > > + if (bus->parent_dev && > > > + !pci_secondary_bus_in_range(bus->parent_dev, bus_num)) { > > > + return NULL; > > > + } > > > + > > > /* try child bus */ > > > - if (!bus->parent_dev /* host pci bridge */ || > > > - (bus->parent_dev->config[PCI_SECONDARY_BUS] < bus_num && > > > - bus_num <= bus->parent_dev->config[PCI_SUBORDINATE_BUS])) { > > > - for (; bus; bus = sec) { > > > - QLIST_FOREACH(sec, &bus->child, sibling) { > > > - assert(sec->parent_dev); > > > - if (sec->parent_dev->config[PCI_SECONDARY_BUS] == bus_num) { > > > - return sec; > > > - } > > > - if (sec->parent_dev->config[PCI_SECONDARY_BUS] < bus_num && > > > - bus_num <= sec->parent_dev->config[PCI_SUBORDINATE_BUS]) { > > > - break; > > > - } > > > + for (; bus; bus = sec) { > > > + QLIST_FOREACH(sec, &bus->child, sibling) { > > > + assert(sec->parent_dev); > > > + if (sec->parent_dev->config[PCI_SECONDARY_BUS] == bus_num) { > > > + return sec; > > > + } > > > + if (pci_secondary_bus_in_range(sec->parent_dev, bus_num)) { > > > > This condition should be "if (!pci_...)" > > Why? We are looking for a device on the given bus that claims the given > bus_num. If we find one, break out of the inner loop and walk down to > the child. You're right. Sorry for noise. -- yamahata