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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux