]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Require PCIe Root Port for PCI by default on ARM virt
authorAndrea Bolognani <abologna@redhat.com>
Thu, 21 Mar 2019 15:50:18 +0000 (16:50 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 4 Apr 2019 07:52:14 +0000 (09:52 +0200)
Our PCIe topology depends on the availability of PCIe Root Ports,
so if none of the suitable devices (pcie-root-port, ioh3420) is
compiled into QEMU we should fall back to virtio-mmio rather than
trying to use PCI addresses only to fail immediately afterwards
when we realize we can't use the necessary controllers.

Note that this additional check is basically moot for ARM virt
guests, because PCIe Root Ports were enabled in QEMU builds for
the architecture well before guest OS support had been widely
available; however, the opposite is true for RISC-V, and tweaking
the code this way will allow us to share it between architectures.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
src/qemu/qemu_domain_address.c

index 28e79af7b18c7c629170893f5ce442446256337c..9592dbfa60a79d5c152cab98fe78e6dfa57103e9 100644 (file)
@@ -473,9 +473,12 @@ qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
         return;
 
     /* We use virtio-mmio by default on mach-virt guests only if they already
-     * have at least one virtio-mmio device: in all other cases, we prefer
-     * virtio-pci */
+     * have at least one virtio-mmio device: in all other cases, assuming
+     * the QEMU binary supports all necessary capabilities (PCIe Root plus
+     * some kind of PCIe Root Port), we prefer virtio-pci */
     if (qemuDomainHasPCIeRoot(def) &&
+        (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCIE_ROOT_PORT) ||
+         virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IOH3420)) &&
         !qemuDomainHasVirtioMMIODevices(def)) {
         qemuDomainPrimeVirtioDeviceAddresses(def,
                                              VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI);