From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0HPt-0003m2-2U for qemu-devel@nongnu.org; Wed, 22 Feb 2012 13:59:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0HPr-0003Ac-Km for qemu-devel@nongnu.org; Wed, 22 Feb 2012 13:59:52 -0500 Received: from mail-pw0-f45.google.com ([209.85.160.45]:57600) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0HPr-0003AW-DM for qemu-devel@nongnu.org; Wed, 22 Feb 2012 13:59:51 -0500 Received: by pbbro12 with SMTP id ro12so573066pbb.4 for ; Wed, 22 Feb 2012 10:59:50 -0800 (PST) Message-ID: <4F453B22.1000200@codemonkey.ws> Date: Wed, 22 Feb 2012 12:59:46 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <57300b99e60a939c6b9c5c27066a4970f167dfc0.1329778092.git.mst@redhat.com> In-Reply-To: <57300b99e60a939c6b9c5c27066a4970f167dfc0.1329778092.git.mst@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCHv3 1/4] pci_bridge: user-friendly default bus name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Kevin Wolf , kvm@vger.kernel.org, qemu-devel@nongnu.org, Isaku Yamahata , kraxel@redhat.com, Avi Kivity On 02/20/2012 04:52 PM, Michael S. Tsirkin wrote: > For a pci bridge device, if we don't override > the name with custom code, the bus will be addressed as > .0, where id is the id specified by the user. > > Since PCI Bridge devices have a single bus each, we don't need > the index: address the bus using the parent device name. > This is better since this way users don't care about > our internal bus/device distinctions. > > As far as I could see, we only have built-in > bridges at this point which always override the > name. So this change will only affect ioh3420.c. > > Signed-off-by: Michael S. Tsirkin Reviewed-by: Anthony Liguori I think we're safe here from a compatibility perspective. Regards, Anthony Liguori > --- > hw/pci_bridge.c | 10 ++++++++++ > 1 files changed, 10 insertions(+), 0 deletions(-) > > diff --git a/hw/pci_bridge.c b/hw/pci_bridge.c > index fea3873..eeee8a6 100644 > --- a/hw/pci_bridge.c > +++ b/hw/pci_bridge.c > @@ -314,6 +314,16 @@ int pci_bridge_initfn(PCIDevice *dev) > pci_set_word(dev->config + PCI_SEC_STATUS, > PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK); > > + /* > + * If we don't specify the name, the bus will be addressed as.0, where > + * id is the device id. > + * Since PCI Bridge devices have a single bus each, we don't need the index: > + * let users address the bus using the device name. > + */ > + if (!br->bus_name&& dev->qdev.id&& *dev->qdev.id) { > + br->bus_name = dev->qdev.id; > + } > + > qbus_create_inplace(&sec_bus->qbus,&pci_bus_info,&dev->qdev, > br->bus_name); > sec_bus->parent_dev = dev;