qemu-system-$ARCH incompatible with qemu-kvm and bus=pci.0 parameter
cover qemu-system-$ARCH incompatible with qemu-kvm and bus=pci.0 parameter
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(-)
Signature · 1 line
1.7.3.5
PATCH 1/1 Use "pci.0" as bus->name for PCI-busses like qemu-kvm does already
From: Niels de Vos <[email protected]>
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
--- 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(-)
hw/apb_pci.c +1 -1
@@ -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);
hw/bonito.c +1 -1
@@ -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);
hw/grackle_pci.c +1 -1
@@ -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 );
hw/gt64xxx.c +1 -1
@@ -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,
hw/ppc4xx_pci.c +1 -1
@@ -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 );
hw/ppce500_pci.c +1 -1
@@ -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),
hw/prep_pci.c +1 -1
@@ -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);
hw/realview.c +1 -1
@@ -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 ); }
hw/sh_pci.c +1 -1
@@ -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,
hw/unin_pci.c +2 -2
@@ -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 );
hw/versatile_pci.c +1 -1
@@ -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 );
hw/versatilepb.c +1 -1
@@ -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. */
Signature · 1 line
1.7.3.5
Blue Swirl
NAKRe: [Qemu-devel] [PATCH 1/1] Use "pci.0" as bus->name for PCI-busses like qemu-kvm does already
Quoted 4 lines · Niels de Vos
From: Niels de Vos <[email protected]>
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.
Re: [Qemu-devel] [PATCH 1/1] Use "pci.0" as bus->name for PCI-busses like qemu-kvm does already
Quoted 8 lines · Blue Swirl
Quoted 4 lines · Niels de Vos
From: Niels de Vos <[email protected]>
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
Quoted 29 lines · 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.
Quoted 6 lines
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
Quoted 45 lines · Daniel P. Berrange
Quoted 29 lines · 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.
Quoted 6 lines
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.
Quoted 2 lines
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