On Wed, Oct 11, 2017 at 01:14:58PM +0200, Andrea Bolognani wrote:
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?
I think I cannot possibly reserve the address before setting it.
Jan