* [Qemu-devel] [PATCH 0/1] qemu-system-$ARCH incompatible with qemu-kvm and bus=pci.0 parameter @ 2011-01-28 15:54 Niels de Vos 2011-01-28 15:54 ` [Qemu-devel] [PATCH 1/1] Use "pci.0" as bus->name for PCI-busses like qemu-kvm does already Niels de Vos 2011-01-28 16:12 ` [Qemu-devel] [PATCH 0/1] qemu-system-$ARCH incompatible with qemu-kvm and bus=pci.0 parameter Daniel P. Berrange 0 siblings, 2 replies; 6+ messages in thread From: Niels de Vos @ 2011-01-28 15:54 UTC (permalink / raw) To: qemu-devel; +Cc: Niels de Vos Hi there, obviously qemu-system-$ARCH, qemu-kvm and libvirt disagree about the most suitable name for the PCI-bus. qemu-kvm and libvirt work nicely together by using "pci.0" as name. Unfortunately libvirt seems to assume that also for qemu-system-$ARCH the name "pci.0" should be passed on the command line. When doing so, errors like "Bus 'pci.0' not found" get logged and qemu aborts. This seems to be a very common case, googling for this seems to reveal that loads of users have similar experiences. A common workaround seems to be to write a little loader script that replaces parameters passed on to qemu-system-$ARCH by valid ones (here: s/bus=pci.0/bus=pci/). As a user, I would really like to be able to start any type of emulated machine, without needing to know the internal hardware layout. Passing bus=pci seems sane to me, but unfortunately qemu-kvm does not accept this. (At least on my standard configuration.) I guess that qemu-kvm is behaving as intended, and qemu-system-$ARCH missed a hardware upgrade. In order to make libvirt, qemu-kvm and qemu-system-$ARCH work together, I have changed the default name "pci" for emulated machines by "pci.0". The tests I have done so far are succesful. However changing the name is only one possible solution, and there is a major drawback... Any old scripts that pass bus=pci on the command line, will not work anymore and result in a "Bus 'pci' not found" error. Therefor I do not know if this is the correct route to succes. An alternative solution would be to match any bus-names from the command line appended with ".0" to their non-numbered equivalent. I'm looking for thoughts and guidance on this issue. It can well be that qemu is not the right place to fix this, and I should look into libvirt instead. Many thanks, Niels -- Niels de Vos (1): Use "pci.0" as bus->name for PCI-busses like qemu-kvm does already 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/sh_pci.c | 2 +- hw/unin_pci.c | 4 ++-- hw/versatile_pci.c | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) -- 1.7.3.5 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 1/1] Use "pci.0" as bus->name for PCI-busses like qemu-kvm does already 2011-01-28 15:54 [Qemu-devel] [PATCH 0/1] qemu-system-$ARCH incompatible with qemu-kvm and bus=pci.0 parameter Niels de Vos @ 2011-01-28 15:54 ` Niels de Vos 2011-01-29 21:44 ` Blue Swirl 2011-01-28 16:12 ` [Qemu-devel] [PATCH 0/1] qemu-system-$ARCH incompatible with qemu-kvm and bus=pci.0 parameter Daniel P. Berrange 1 sibling, 1 reply; 6+ messages in thread From: Niels de Vos @ 2011-01-28 15:54 UTC (permalink / raw) To: qemu-devel; +Cc: Niels de Vos, Niels de Vos 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(-) 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. */ -- 1.7.3.5 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] Use "pci.0" as bus->name for PCI-busses like qemu-kvm does already 2011-01-28 15:54 ` [Qemu-devel] [PATCH 1/1] Use "pci.0" as bus->name for PCI-busses like qemu-kvm does already Niels de Vos @ 2011-01-29 21:44 ` Blue Swirl 2011-01-30 17:40 ` Niels de Vos 0 siblings, 1 reply; 6+ messages in thread From: Blue Swirl @ 2011-01-29 21:44 UTC (permalink / raw) To: Niels de Vos; +Cc: qemu-devel, Niels de Vos 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. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] Use "pci.0" as bus->name for PCI-busses like qemu-kvm does already 2011-01-29 21:44 ` Blue Swirl @ 2011-01-30 17:40 ` Niels de Vos 0 siblings, 0 replies; 6+ messages in thread From: Niels de Vos @ 2011-01-30 17:40 UTC (permalink / raw) To: Blue Swirl; +Cc: qemu-devel 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/1] qemu-system-$ARCH incompatible with qemu-kvm and bus=pci.0 parameter 2011-01-28 15:54 [Qemu-devel] [PATCH 0/1] qemu-system-$ARCH incompatible with qemu-kvm and bus=pci.0 parameter Niels de Vos 2011-01-28 15:54 ` [Qemu-devel] [PATCH 1/1] Use "pci.0" as bus->name for PCI-busses like qemu-kvm does already Niels de Vos @ 2011-01-28 16:12 ` Daniel P. Berrange 2011-01-30 17:42 ` Niels de Vos 1 sibling, 1 reply; 6+ messages in thread From: Daniel P. Berrange @ 2011-01-28 16:12 UTC (permalink / raw) To: Niels de Vos; +Cc: qemu-devel On Fri, Jan 28, 2011 at 03:54:01PM +0000, Niels de Vos wrote: > Hi there, > > obviously qemu-system-$ARCH, qemu-kvm and libvirt disagree about the most > suitable name for the PCI-bus. qemu-kvm and libvirt work nicely together by > using "pci.0" as name. Unfortunately libvirt seems to assume that also for > qemu-system-$ARCH the name "pci.0" should be passed on the command line. > When doing so, errors like "Bus 'pci.0' not found" get logged and qemu > aborts. > > This seems to be a very common case, googling for this seems to reveal that > loads of users have similar experiences. A common workaround seems to be to > write a little loader script that replaces parameters passed on to > qemu-system-$ARCH by valid ones (here: s/bus=pci.0/bus=pci/). > > As a user, I would really like to be able to start any type of emulated > machine, without needing to know the internal hardware layout. Passing > bus=pci seems sane to me, but unfortunately qemu-kvm does not accept this. > (At least on my standard configuration.) I guess that qemu-kvm is behaving > as intended, and qemu-system-$ARCH missed a hardware upgrade. > > In order to make libvirt, qemu-kvm and qemu-system-$ARCH work together, I > have changed the default name "pci" for emulated machines by "pci.0". The > tests I have done so far are succesful. > > However changing the name is only one possible solution, and there is a > major drawback... Any old scripts that pass bus=pci on the command line, > will not work anymore and result in a "Bus 'pci' not found" error. > Therefor I do not know if this is the correct route to succes. > > An alternative solution would be to match any bus-names from the command > line appended with ".0" to their non-numbered equivalent. > > I'm looking for thoughts and guidance on this issue. It can well be that > qemu is not the right place to fix this, and I should look into libvirt > instead. Personally I think it would have been nice if QEMU used a consistent name across all arches when we first introduced qdev, and indeed I did proposed this exact change in the past. There was no clear agreement to it before though, and if anything there was a slight preference to use 'pci.0' everywhere. We've now had several QEMU releases with this mix of naming, so changing it at this stage would cause even more pain for mgmt apps. So it is probably best to teach libvirt to use either 'pci' or 'pci.0' as appropropriate for the arch in question. Regards, Daniel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/1] qemu-system-$ARCH incompatible with qemu-kvm and bus=pci.0 parameter 2011-01-28 16:12 ` [Qemu-devel] [PATCH 0/1] qemu-system-$ARCH incompatible with qemu-kvm and bus=pci.0 parameter Daniel P. Berrange @ 2011-01-30 17:42 ` Niels de Vos 0 siblings, 0 replies; 6+ messages in thread From: Niels de Vos @ 2011-01-30 17:42 UTC (permalink / raw) To: Daniel P. Berrange; +Cc: qemu-devel On Fri, Jan 28, 2011 at 4:12 PM, Daniel P. Berrange <berrange@redhat.com> wrote: > On Fri, Jan 28, 2011 at 03:54:01PM +0000, Niels de Vos wrote: >> Hi there, >> >> obviously qemu-system-$ARCH, qemu-kvm and libvirt disagree about the most >> suitable name for the PCI-bus. qemu-kvm and libvirt work nicely together by >> using "pci.0" as name. Unfortunately libvirt seems to assume that also for >> qemu-system-$ARCH the name "pci.0" should be passed on the command line. >> When doing so, errors like "Bus 'pci.0' not found" get logged and qemu >> aborts. >> >> This seems to be a very common case, googling for this seems to reveal that >> loads of users have similar experiences. A common workaround seems to be to >> write a little loader script that replaces parameters passed on to >> qemu-system-$ARCH by valid ones (here: s/bus=pci.0/bus=pci/). >> >> As a user, I would really like to be able to start any type of emulated >> machine, without needing to know the internal hardware layout. Passing >> bus=pci seems sane to me, but unfortunately qemu-kvm does not accept this. >> (At least on my standard configuration.) I guess that qemu-kvm is behaving >> as intended, and qemu-system-$ARCH missed a hardware upgrade. >> >> In order to make libvirt, qemu-kvm and qemu-system-$ARCH work together, I >> have changed the default name "pci" for emulated machines by "pci.0". The >> tests I have done so far are succesful. >> >> However changing the name is only one possible solution, and there is a >> major drawback... Any old scripts that pass bus=pci on the command line, >> will not work anymore and result in a "Bus 'pci' not found" error. >> Therefor I do not know if this is the correct route to succes. >> >> An alternative solution would be to match any bus-names from the command >> line appended with ".0" to their non-numbered equivalent. >> >> I'm looking for thoughts and guidance on this issue. It can well be that >> qemu is not the right place to fix this, and I should look into libvirt >> instead. > > Personally I think it would have been nice if QEMU used a consistent > name across all arches when we first introduced qdev, and indeed I > did proposed this exact change in the past. There was no clear agreement > to it before though, and if anything there was a slight preference to > use 'pci.0' everywhere. We've now had several QEMU releases with this > mix of naming, so changing it at this stage would cause even more > pain for mgmt apps. > > So it is probably best to teach libvirt to use either 'pci' or 'pci.0' > as appropropriate for the arch in question. Thanks Daniel! I found your patche(s) and the discussion now too: - http://comments.gmane.org/gmane.comp.emulators.qemu/70783 I'll check the libvirt alternative and will post a patch there. Cheers, Niels ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-01-30 17:42 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-01-28 15:54 [Qemu-devel] [PATCH 0/1] qemu-system-$ARCH incompatible with qemu-kvm and bus=pci.0 parameter Niels de Vos 2011-01-28 15:54 ` [Qemu-devel] [PATCH 1/1] Use "pci.0" as bus->name for PCI-busses like qemu-kvm does already Niels de Vos 2011-01-29 21:44 ` Blue Swirl 2011-01-30 17:40 ` Niels de Vos 2011-01-28 16:12 ` [Qemu-devel] [PATCH 0/1] qemu-system-$ARCH incompatible with qemu-kvm and bus=pci.0 parameter Daniel P. Berrange 2011-01-30 17:42 ` Niels de Vos
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).