[libvirt] [PATCH] qemu: fix qemuDomainSupportsPCI() for ARM machines of "virt" machinetype

John Ferlan jferlan at redhat.com
Tue Aug 11 19:57:03 UTC 2015



On 08/11/2015 03:03 PM, Laine Stump wrote:
> Commit e8d5517 updated the domain post-parse to automatically add
> pcie-root et al for certain ARM "virt" machinetypes, but didn't update
> the function qemuDomainSupportsPCI() which is called later on when we
> are auto-assigning PCI addresses and default settings for the PCI
> controller <model> and <target> attributes. The result was that PCI
> addresses weren't assigned, and the controllers didn't have their
> attribute default values set, leading to an error when the domain was
> started, e.g.:
> 
>   internal error: autogenerated dmi-to-pci-bridge options not set
> 
> This patch duplicates the check made in the earlier patch, so that PCI
> address auto-assignment and target/model default values will be set.
> ---
> 
> The example Cole gave in his email reporting this bug is fixed by this
> patch.
> 
>  src/qemu/qemu_command.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 

ACK

John

It's very tangled web... Perhaps an additional comment to point at
qemuDomainSupportsPCI in qemu_domain.c just before the "if
(addPCIeRoot)" may help future changes that could trip into the same
rabbit hole...

> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index ae03618..84cbfe1 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1742,7 +1742,7 @@ qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
>  }
>  
>  static bool
> -qemuDomainSupportsPCI(virDomainDefPtr def)
> +qemuDomainSupportsPCI(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
>  {
>      if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64))
>          return true;
> @@ -1750,6 +1750,11 @@ qemuDomainSupportsPCI(virDomainDefPtr def)
>      if (STREQ(def->os.machine, "versatilepb"))
>          return true;
>  
> +    if ((STREQ(def->os.machine, "virt") ||
> +         STRPREFIX(def->os.machine, "virt-")) &&
> +        virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX))
> +        return true;
> +
>      return false;
>  }
>  
> @@ -2267,7 +2272,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
>          if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, false)))
>              goto cleanup;
>  
> -        if (qemuDomainSupportsPCI(def)) {
> +        if (qemuDomainSupportsPCI(def, qemuCaps)) {
>              if (qemuValidateDevicePCISlotsChipsets(def, qemuCaps, addrs) < 0)
>                  goto cleanup;
>  
> 




More information about the libvir-list mailing list