[libvirt] [PATCH 1/2] qemu: reserve PCI addresses for implicit i440fx devices

Andrea Bolognani abologna at redhat.com
Wed Oct 11 11:14:58 UTC 2017


On Tue, 2017-09-26 at 13:05 +0200, Ján Tomko wrote:
> @@ -1429,15 +1429,24 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
>                  cont->info.addr.pci.slot = 1;
>                  cont->info.addr.pci.function = 2;
>              }
> +        } else {
> +            /* this controller is not skipped in qemuDomainCollectPCIAddress */
> +            continue;
>          }
> +        if (addrs->nbuses &&
> +            virDomainPCIAddressReserveAddr(addrs, &cont->info.addr.pci, flags, 0) < 0)
> +            goto cleanup;

I think it would make more sense to reserve the address for these
devices in qemuDomainCollectPCIAddress() directly, along with the
other ones, eg. squash in the following diff:

---------- 8< ---------- 8< ---------- 8< ---------- 8< ----------
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index f35e01e5a..ecb91c565 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -1265,13 +1265,12 @@ qemuDomainCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
                                _("Bus 0 must be PCI for integrated PIIX3 "
                                  "USB or IDE controllers"));
                 return -1;
-            } else {
-                return 0;
             }
         }
     }
 
-    if (virDomainPCIAddressReserveAddr(addrs, addr,
+    if (addrs->nbuses &&
+        virDomainPCIAddressReserveAddr(addrs, addr,
                                        info->pciConnectFlags,
                                        info->isolationGroup) < 0) {
         goto cleanup;
@@ -1429,13 +1428,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
                 cont->info.addr.pci.slot = 1;
                 cont->info.addr.pci.function = 2;
             }
-        } else {
-            /* this controller is not skipped in qemuDomainCollectPCIAddress */
-            continue;
         }
-        if (addrs->nbuses &&
-            virDomainPCIAddressReserveAddr(addrs, &cont->info.addr.pci, flags, 0) < 0)
-            goto cleanup;
     }
 
     /* Implicit PIIX3 devices living on slot 1 not handled above */
---------- >8 ---------- >8 ---------- >8 ---------- >8 ----------

What do you think about it?

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list