From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=49313 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWrnS-0007x4-7P for qemu-devel@nongnu.org; Thu, 08 Jul 2010 10:09:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWrnR-0006gu-0g for qemu-devel@nongnu.org; Thu, 08 Jul 2010 10:09:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11847) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWrnQ-0006gm-Nd for qemu-devel@nongnu.org; Thu, 08 Jul 2010 10:09:48 -0400 Date: Thu, 8 Jul 2010 17:04:32 +0300 From: "Michael S. Tsirkin" Message-ID: <20100708140432.GB31905@redhat.com> References: <8ab6e42be20518d6491e0cd0d5985f7df6912c01.1278037560.git.yamahata@valinux.co.jp> <20100706121852.GA20208@redhat.com> <20100707023858.GB30653@valinux.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100707023858.GB30653@valinux.co.jp> Subject: [Qemu-devel] Re: [PATCH 1/2] pci/bridge: allocate PCIBus dynamically for PCIBridge. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Isaku Yamahata Cc: blauwirbel@gmail.com, qemu-devel@nongnu.org, Gerd Hoffmann On Wed, Jul 07, 2010 at 11:38:58AM +0900, Isaku Yamahata wrote: > But you claim it's only for root bus, not for secondary bus. It is currently, isn't it? > Now I realized why you've rejected such patches so far. > Then, you also mean the current pci_register_secondary_bus() is broken. Sorry about being dense, what is broken? > I also think it's broken. So how do we want to fix it? > My idea is as follows. > > - introduce something like pci_secondary_bus_new() > (pci_sec_bus_new() for short?) for secondary bus. > fix pci_register_secondary_bus() with it. > > - introduce something like pci_host_bus_new() (or pci_root_bus_new()?) > for pci host bus which is more generic than pci_bus_new(). > It's for > - to avoid confusion. IMHO the confusion comes from the fact we have too many functions that do almost, but not quite, the same thing, and the function names do not say anything. We have a ton of 5 line functions with names like _allocate_inplace, _new, _register, _simple > - to eliminate assumption of pci_bus_new(). > pci_bus_new() assumes that its pci segment is 0. > keep pci_bus_new() as a convenience wrapper of > pci_host_bus_new(segment = 0). Thus we can avoid fixing up > all the caller. We have a single caller, right? I think you mean pci_register_bus? So IIUC, you propose that we add pci_register_host_bus, and make pci_register_bus a compatibility wrapper? Sure, let's just add a comment this is deprecated. I am not sure why do we need an API to deal with secondary bus: it is always a part of the bridge, so all users can and should call pci_bridge_init? -- MST