+/**
+ * qemuDomainAddressFindNewTargetIndex:
+ * @def: domain definition
+ *
+ * Find a target index that can be used for a PCI controller.
+ *
+ * Returns: an unused target index, or -1 if all available target
+ * indexes are already taken.
+ */
+static int
+qemuDomainAddressFindNewTargetIndex(virDomainDefPtr def)
May be rename to qemuDomainAddressFindNewPCIRootTargetIndex ?
+{
+ int idx;
+ int ret = -1;
+
+ /* Try all indexes between 1 and 31 - QEMU only supports 32
+ * PHBs, and 0 is reserved for the default, implicit one */
+ for (idx = 1; idx <= 31; idx++) {
+ bool found = false;
+ size_t i;