qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: "Hong-Hua . Yin @ freescale . com" <Hong-Hua.Yin@freescale.com>,
	"Alexey Kardashevskiy" <aik@ozlabs.ru>,
	"Alexander Graf" <agraf@suse.de>,
	qemu-ppc@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH] spapr-pci: change the default PCI bus naming
Date: Thu,  6 Mar 2014 14:11:00 +1100	[thread overview]
Message-ID: <1394075460-17400-1-git-send-email-aik@ozlabs.ru> (raw)

Previously libvirt required the first/default PCI bus to have name "pci".
Since QEMU can support multiple buses now, libvirt wants "pci.0" now.

This removes custom busname and lets QEMU make up default names.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---

I tested this with:
  -netdev tap,id=id0,ifname=tapqemu-tap-00,script=ifup.sh,downscript=ifdown.sh \
  -device e1000,id=id1,netdev=id0,mac=C0:41:49:4b:00:00 \
  -device \
  spapr-pci-host-bridge,index=5,id=aikbus \
  -netdev tap,id=id2,ifname=tap-1,script=ifup.sh,downscript=ifdown.sh \
  -device rtl8139,id=id3,netdev=id2,bus=aikbus.0,mac=C0:41:49:4b:00:01 \
  -device spapr-pci-vfio-host-bridge,id=id4,index=10,iommu=4 \

This creates a default PCI, an additional emulated PCI bus (named aikbus,
if I omit the name, it is pci.1 which is also fine) and VFIO bus (which is
not in upstream yet but still), this all works fine and I cannot see any flaw.


---
 hw/ppc/spapr_pci.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 66ddf10..7ecb3df 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -499,7 +499,6 @@ static int spapr_phb_init(SysBusDevice *s)
     DeviceState *dev = DEVICE(s);
     sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s);
     PCIHostState *phb = PCI_HOST_BRIDGE(s);
-    const char *busname;
     char *namebuf;
     int i;
     PCIBus *bus;
@@ -583,26 +582,8 @@ static int spapr_phb_init(SysBusDevice *s)
                              get_system_io(), 0, SPAPR_PCI_IO_WIN_SIZE);
     memory_region_add_subregion(get_system_memory(), sphb->io_win_addr,
                                 &sphb->iowindow);
-    /*
-     * Selecting a busname is more complex than you'd think, due to
-     * interacting constraints.  If the user has specified an id
-     * explicitly for the phb , then we want to use the qdev default
-     * of naming the bus based on the bridge device (so the user can
-     * then assign devices to it in the way they expect).  For the
-     * first / default PCI bus (index=0) we want to use just "pci"
-     * because libvirt expects there to be a bus called, simply,
-     * "pci".  Otherwise, we use the same name as in the device tree,
-     * since it's unique by construction, and makes the guest visible
-     * BUID clear.
-     */
-    if (dev->id) {
-        busname = NULL;
-    } else if (sphb->index == 0) {
-        busname = "pci";
-    } else {
-        busname = sphb->dtbusname;
-    }
-    bus = pci_register_bus(dev, busname,
+
+    bus = pci_register_bus(dev, NULL,
                            pci_spapr_set_irq, pci_spapr_map_irq, sphb,
                            &sphb->memspace, &sphb->iospace,
                            PCI_DEVFN(0, 0), PCI_NUM_PINS, TYPE_PCI_BUS);
-- 
1.8.4.rc4

             reply	other threads:[~2014-03-06  3:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06  3:11 Alexey Kardashevskiy [this message]
2014-03-06 11:47 ` [Qemu-devel] [PATCH] spapr-pci: change the default PCI bus naming Paolo Bonzini
2014-03-06 11:50   ` Daniel P. Berrange
2014-03-06 11:51     ` Paolo Bonzini
2014-03-06 16:18 ` Andreas Färber
2014-04-03  8:44   ` Alexey Kardashevskiy
2014-04-03 11:09     ` Paolo Bonzini
2014-04-03 12:31       ` Alexey Kardashevskiy
2014-04-04  1:59       ` Hong-Hua.Yin

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=1394075460-17400-1-git-send-email-aik@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=Hong-Hua.Yin@freescale.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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).