qemu: don't be as insistent about adding dmi-to-pci-bridge or pci-bridge

Previously there was no way to have a Q35 domain that didn't have
these two controllers. This patch skips their creation as long as
there are some other kinds of pci controllers at index 1 and 2
(e.g. some pcie-root-port controllers).

I'm hoping that soon we won't add them at all, plugging all devices
into auto-added pcie-*-port ports instead, but in the meantime this
makes it easier to experiment with alternative bus hierarchies.
This commit is contained in:
Laine Stump 2016-04-19 17:37:51 -04:00
parent e9df53052e
commit 97b215a450

View File

@ -1951,14 +1951,18 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT)) { VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT)) {
goto cleanup; goto cleanup;
} }
if (virDomainDefMaybeAddController( /* add a dmi-to-pci-bridge and a pci-bridge if there are no pci controllers
def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 1, * other than the pcie-root. This is so that there will be hot-pluggable
VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE) < 0 || * PCI slots available
virDomainDefMaybeAddController( */
def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 2, if (virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 1) < 0 &&
VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE) < 0) { !virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 1,
VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE))
goto cleanup;
if (virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 2) < 0 &&
!virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 2,
VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE))
goto cleanup; goto cleanup;
}
} }
if (addDefaultMemballoon && !def->memballoon) { if (addDefaultMemballoon && !def->memballoon) {