qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org, kvm@vger.kernel.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Isaku Yamahata <yamahata@valinux.co.jp>,
	Avi Kivity <avi@redhat.com>,
	kraxel@redhat.com
Subject: [Qemu-devel] [PATCHv3 1/4] pci_bridge: user-friendly default bus name
Date: Tue, 21 Feb 2012 00:52:55 +0200	[thread overview]
Message-ID: <57300b99e60a939c6b9c5c27066a4970f167dfc0.1329778092.git.mst@redhat.com> (raw)
In-Reply-To: <cover.1329778092.git.mst@redhat.com>

For a pci bridge device, if we don't override
the name with custom code, the bus will be addressed as
<id>.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 <mst@redhat.com>
---
 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 <id>.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;
-- 
1.7.9.111.gf3fb0

  reply	other threads:[~2012-02-20 22:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20 22:52 [Qemu-devel] [PATCHv3 0/4] standard pci bridge device Michael S. Tsirkin
2012-02-20 22:52 ` Michael S. Tsirkin [this message]
2012-02-22 18:59   ` [Qemu-devel] [PATCHv3 1/4] pci_bridge: user-friendly default bus name Anthony Liguori
2012-02-20 22:53 ` [Qemu-devel] [PATCHv3 2/4] shpc: standard hot plug controller Michael S. Tsirkin
2012-02-20 22:53 ` [Qemu-devel] [PATCHv3 3/4] slotid: add slot id capability Michael S. Tsirkin
2012-02-20 22:53 ` [Qemu-devel] [PATCHv3 4/4] pci: add standard bridge device Michael S. Tsirkin
2012-02-27 14:38 ` [Qemu-devel] [PATCHv3 0/4] standard pci " Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57300b99e60a939c6b9c5c27066a4970f167dfc0.1329778092.git.mst@redhat.com \
    --to=mst@redhat.com \
    --cc=avi@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yamahata@valinux.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).