qemu: Use generic PCIe Root Ports by default when available

ioh3420 is emulated Intel hardware, so it always looked
quite out of place in aarch64/virt guests. Even for x86/q35
guests, the recently-introduced pcie-root-port is a better
choice because, unlike ioh3420, it doesn't require IO space
(a fairly constrained resource) to work.

If pcie-root-port is available in QEMU, use it; ioh3420 is
still used as fallback for when pcie-root-port is not
available.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1408808
This commit is contained in:
Andrea Bolognani 2017-03-14 14:42:51 +01:00
parent c51090fc99
commit befd1c674b

View File

@ -1846,13 +1846,15 @@ qemuDomainSupportsPCI(virDomainDefPtr def,
static void static void
qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDefPtr cont) qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDefPtr cont,
virQEMUCapsPtr qemuCaps)
{ {
int *modelName = &cont->opts.pciopts.modelName; int *modelName = &cont->opts.pciopts.modelName;
/* make sure it's not already set */ /* make sure it's not already set */
if (*modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE) if (*modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE)
return; return;
switch ((virDomainControllerModelPCI)cont->model) { switch ((virDomainControllerModelPCI)cont->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
*modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCI_BRIDGE; *modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCI_BRIDGE;
@ -1861,6 +1863,11 @@ qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDefPtr cont)
*modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_I82801B11_BRIDGE; *modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_I82801B11_BRIDGE;
break; break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
/* Use generic PCIe Root Ports if available, falling back to
* ioh3420 otherwise */
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCIE_ROOT_PORT))
*modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_ROOT_PORT;
else
*modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420; *modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420;
break; break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT:
@ -2143,7 +2150,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
* device in qemu) for any controller that doesn't yet * device in qemu) for any controller that doesn't yet
* have it set. * have it set.
*/ */
qemuDomainPCIControllerSetDefaultModelName(cont); qemuDomainPCIControllerSetDefaultModelName(cont, qemuCaps);
/* set defaults for any other auto-generated config /* set defaults for any other auto-generated config
* options for this controller that haven't been * options for this controller that haven't been