Patchwork [1/1] Use "pci.0" as bus->name for PCI-busses like qemu-kvm does already

login
register
mail settings
Submitter Niels de Vos
Date Jan. 28, 2011, 3:54 p.m.
Message ID <1296230042-26336-2-git-send-email-devos@fedoraproject.org>
Download mbox | patch
Permalink /patch/80868/
State New
Headers show

Comments

Niels de Vos - Jan. 28, 2011, 3:54 p.m.
From: Niels de Vos <niels@nixpanic.net>

This should fix issues with qemu-system-{arm,ppc} and possibly others
where libvirt passes bus=pci.0 in the -device options.

Reference:
- https://bugzilla.redhat.com/show_bug.cgi?id=667345

Signed-off-by: Niels de Vos <devos@fedoraproject.org>
---
 hw/apb_pci.c       |    2 +-
 hw/bonito.c        |    2 +-
 hw/grackle_pci.c   |    2 +-
 hw/gt64xxx.c       |    2 +-
 hw/ppc4xx_pci.c    |    2 +-
 hw/ppce500_pci.c   |    2 +-
 hw/prep_pci.c      |    2 +-
 hw/realview.c      |    2 +-
 hw/sh_pci.c        |    2 +-
 hw/unin_pci.c      |    4 ++--
 hw/versatile_pci.c |    2 +-
 hw/versatilepb.c   |    2 +-
 12 files changed, 13 insertions(+), 13 deletions(-)
Blue Swirl - Jan. 29, 2011, 9:44 p.m.
On Fri, Jan 28, 2011 at 3:54 PM, Niels de Vos <devos@fedoraproject.org> wrote:
> From: Niels de Vos <niels@nixpanic.net>
>
> This should fix issues with qemu-system-{arm,ppc} and possibly others
> where libvirt passes bus=pci.0 in the -device options.

Nack, please see the list archives for discussion.
Niels de Vos - Jan. 30, 2011, 5:40 p.m.
On Sat, Jan 29, 2011 at 9:44 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
> On Fri, Jan 28, 2011 at 3:54 PM, Niels de Vos <devos@fedoraproject.org> wrote:
>> From: Niels de Vos <niels@nixpanic.net>
>>
>> This should fix issues with qemu-system-{arm,ppc} and possibly others
>> where libvirt passes bus=pci.0 in the -device options.
>
> Nack, please see the list archives for discussion.
>

Thanks for the reply. Daniel Berrange posted something similar on the
[PATCH 0/1] message.

Pointer to the archives in case someone else is interested:
- http://comments.gmane.org/gmane.comp.emulators.qemu/70783

Cheers,
Niels

Patch

diff --git a/hw/apb_pci.c b/hw/apb_pci.c
index 84e9af7..da8df91 100644
--- a/hw/apb_pci.c
+++ b/hw/apb_pci.c
@@ -348,7 +348,7 @@  PCIBus *pci_apb_init(target_phys_addr_t special_base,
     sysbus_mmio_map(s, 2, special_base + 0x2000000ULL);
     d = FROM_SYSBUS(APBState, s);
 
-    d->bus = pci_register_bus(&d->busdev.qdev, "pci",
+    d->bus = pci_register_bus(&d->busdev.qdev, "pci.0",
                                          pci_apb_set_irq, pci_pbm_map_irq, d,
                                          0, 32);
     pci_bus_set_mem_base(d->bus, mem_base);
diff --git a/hw/bonito.c b/hw/bonito.c
index 65a4a63..dc15db5 100644
--- a/hw/bonito.c
+++ b/hw/bonito.c
@@ -776,7 +776,7 @@  PCIBus *bonito_init(qemu_irq *pic)
 
     dev = qdev_create(NULL, "Bonito-pcihost");
     pcihost = FROM_SYSBUS(BonitoState, sysbus_from_qdev(dev));
-    b = pci_register_bus(&pcihost->busdev.qdev, "pci", pci_bonito_set_irq,
+    b = pci_register_bus(&pcihost->busdev.qdev, "pci.0", pci_bonito_set_irq,
                          pci_bonito_map_irq, pic, 0x28, 32);
     pcihost->bus = b;
     qdev_init_nofail(dev);
diff --git a/hw/grackle_pci.c b/hw/grackle_pci.c
index bd3d6b0..7ac5684 100644
--- a/hw/grackle_pci.c
+++ b/hw/grackle_pci.c
@@ -88,7 +88,7 @@  PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic)
     qdev_init_nofail(dev);
     s = sysbus_from_qdev(dev);
     d = FROM_SYSBUS(GrackleState, s);
-    d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci",
+    d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci.0",
                                          pci_grackle_set_irq,
                                          pci_grackle_map_irq,
                                          pic, 0, 4);
diff --git a/hw/gt64xxx.c b/hw/gt64xxx.c
index 923073b..b437f24 100644
--- a/hw/gt64xxx.c
+++ b/hw/gt64xxx.c
@@ -1109,7 +1109,7 @@  PCIBus *gt64120_register(qemu_irq *pic)
     qdev_init_nofail(dev);
     s = sysbus_from_qdev(dev);
     d = FROM_SYSBUS(GT64120State, s);
-    d->pci.bus = pci_register_bus(&d->busdev.qdev, "pci",
+    d->pci.bus = pci_register_bus(&d->busdev.qdev, "pci.0",
                                   gt64120_pci_set_irq, gt64120_pci_map_irq,
                                   pic, PCI_DEVFN(18, 0), 4);
     d->ISD_handle = cpu_register_io_memory(gt64120_read, gt64120_write, d,
diff --git a/hw/ppc4xx_pci.c b/hw/ppc4xx_pci.c
index f62f1f9..b45bb31 100644
--- a/hw/ppc4xx_pci.c
+++ b/hw/ppc4xx_pci.c
@@ -344,7 +344,7 @@  PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],
 
     controller = qemu_mallocz(sizeof(PPC4xxPCIState));
 
-    controller->pci_state.bus = pci_register_bus(NULL, "pci",
+    controller->pci_state.bus = pci_register_bus(NULL, "pci.0",
                                                  ppc4xx_pci_set_irq,
                                                  ppc4xx_pci_map_irq,
                                                  pci_irqs, 0, 4);
diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c
index 11edd03..a40d6d6 100644
--- a/hw/ppce500_pci.c
+++ b/hw/ppce500_pci.c
@@ -276,7 +276,7 @@  PCIBus *ppce500_pci_init(qemu_irq pci_irqs[4], target_phys_addr_t registers)
 
     controller = qemu_mallocz(sizeof(PPCE500PCIState));
 
-    controller->pci_state.bus = pci_register_bus(NULL, "pci",
+    controller->pci_state.bus = pci_register_bus(NULL, "pci.0",
                                                  mpc85xx_pci_set_irq,
                                                  mpc85xx_pci_map_irq,
                                                  pci_irqs, PCI_DEVFN(0x11, 0),
diff --git a/hw/prep_pci.c b/hw/prep_pci.c
index f88b825..c61c446 100644
--- a/hw/prep_pci.c
+++ b/hw/prep_pci.c
@@ -117,7 +117,7 @@  PCIBus *pci_prep_init(qemu_irq *pic)
     int PPC_io_memory;
 
     s = qemu_mallocz(sizeof(PREPPCIState));
-    s->bus = pci_register_bus(NULL, "pci",
+    s->bus = pci_register_bus(NULL, "pci.0",
                               prep_set_irq, prep_map_irq, pic, 0, 4);
 
     pci_host_conf_register_ioport(0xcf8, s);
diff --git a/hw/realview.c b/hw/realview.c
index 6eb6c6a..bddedaa 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -266,7 +266,7 @@  static void realview_init(ram_addr_t ram_size,
     if (!is_pb) {
         dev = sysbus_create_varargs("realview_pci", 0x60000000,
                                     pic[48], pic[49], pic[50], pic[51], NULL);
-        pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci");
+        pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
         if (usb_enabled) {
             usb_ohci_init_pci(pci_bus, -1);
         }
diff --git a/hw/sh_pci.c b/hw/sh_pci.c
index e99d8db..8c7e3bd 100644
--- a/hw/sh_pci.c
+++ b/hw/sh_pci.c
@@ -125,7 +125,7 @@  static int sh_pci_init_device(SysBusDevice *dev)
     for (i = 0; i < 4; i++) {
         sysbus_init_irq(dev, &s->irq[i]);
     }
-    s->bus = pci_register_bus(&s->busdev.qdev, "pci",
+    s->bus = pci_register_bus(&s->busdev.qdev, "pci.0",
                               sh_pci_set_irq, sh_pci_map_irq,
                               s->irq, PCI_DEVFN(0, 0), 4);
     s->memconfig = cpu_register_io_memory(sh_pci_reg.r, sh_pci_reg.w,
diff --git a/hw/unin_pci.c b/hw/unin_pci.c
index 5f15058..4aabf37 100644
--- a/hw/unin_pci.c
+++ b/hw/unin_pci.c
@@ -234,7 +234,7 @@  PCIBus *pci_pmac_init(qemu_irq *pic)
     qdev_init_nofail(dev);
     s = sysbus_from_qdev(dev);
     d = FROM_SYSBUS(UNINState, s);
-    d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci",
+    d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci.0",
                                          pci_unin_set_irq, pci_unin_map_irq,
                                          pic, PCI_DEVFN(11, 0), 4);
 
@@ -286,7 +286,7 @@  PCIBus *pci_pmac_u3_init(qemu_irq *pic)
     s = sysbus_from_qdev(dev);
     d = FROM_SYSBUS(UNINState, s);
 
-    d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci",
+    d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci.0",
                                          pci_unin_set_irq, pci_unin_map_irq,
                                          pic, PCI_DEVFN(11, 0), 4);
 
diff --git a/hw/versatile_pci.c b/hw/versatile_pci.c
index 2fed8a0..177e368 100644
--- a/hw/versatile_pci.c
+++ b/hw/versatile_pci.c
@@ -109,7 +109,7 @@  static int pci_vpb_init(SysBusDevice *dev)
     for (i = 0; i < 4; i++) {
         sysbus_init_irq(dev, &s->irq[i]);
     }
-    bus = pci_register_bus(&dev->qdev, "pci",
+    bus = pci_register_bus(&dev->qdev, "pci.0",
                            pci_vpb_set_irq, pci_vpb_map_irq, s->irq,
                            PCI_DEVFN(11, 0), 4);
 
diff --git a/hw/versatilepb.c b/hw/versatilepb.c
index 9f1bfcf..8407876 100644
--- a/hw/versatilepb.c
+++ b/hw/versatilepb.c
@@ -216,7 +216,7 @@  static void versatile_init(ram_addr_t ram_size,
 
     dev = sysbus_create_varargs("versatile_pci", 0x40000000,
                                 sic[27], sic[28], sic[29], sic[30], NULL);
-    pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci");
+    pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
 
     /* The Versatile PCI bridge does not provide access to PCI IO space,
        so many of the qemu PCI devices are not useable.  */