1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 07:59:00 +00:00

qemu: Require PCIe Root Port for PCI by default on ARM virt

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>
This commit is contained in:
Andrea Bolognani 2019-03-21 16:50:18 +01:00
parent 29f2b5248c
commit 20011d01d9

View 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);