[libvirt] [PATCH 5/9] qemu: Don't try to allocate PCI addresses for ARM

Laine Stump laine at laine.org
Thu Aug 1 06:51:26 UTC 2013


On 07/31/2013 10:14 PM, Cole Robinson wrote:
> ---
>  src/qemu/qemu_command.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 4209e5e..6da35d0 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1692,6 +1692,16 @@ cleanup:
>      return ret;
>  }
>  
> +static bool
> +qemuDomainSupportsPCI(virDomainDefPtr def) {
> +    if (def->os.arch != VIR_ARCH_ARMV7L)
> +        return true;
> +
> +    if (STREQ(def->os.machine, "versatilepb"))
> +        return true;
> +
> +    return false;
> +}
>  
>  int
>  qemuDomainAssignPCIAddresses(virDomainDefPtr def,
> @@ -1757,8 +1767,10 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
>          if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, false)))
>              goto cleanup;
>  
> -        if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
> -            goto cleanup;
> +        if (qemuDomainSupportsPCI(def)) {
> +            if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)

(Just combine those in the same if using &&)

> +                goto cleanup;
> +        }

I think what may be a more general solution would be to note for each
device what kind of bus it needs to be attached for each machine type
(if any). Still, as long as completely skipping the attempt to add PCI
addresses to various devices will still result in a reasonable error
message when someone tries to add a device that wouldn't work on this
arch due to it requiring a PCI address, this patch seems to be a good
"whack it off at the roots" type of solution.

ACK (but it would be nice to flesh out the list of machines with no PCI
bus, e.g. I believe the s390 has no PCI bus. yet we even have a unit
test for the s390 that includes a PCI address in the XML !)


>      }
>  
>      if (obj && obj->privateData) {




More information about the libvir-list mailing list