[PATCH] Allow PCI virtio on ARM "virt" machine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Virt machine in qemu has PCI generic host controller, and can use PCI devices. This
provides performance improvement as well as vhost-net with irqfd support for  virtio-net.
However libvirt still insists on virtio devices attached to Virt machine to have MMIO
bindings.
 This patch allows to use both. If the user doesn't specify <address type='virtio-mmio'>,
PCI will be used by default.
 "virt-" prefix is intentionally ignored in third chunk because it is a temporary thing
and qemu developers agreed to use "gic version" option, for which there is already support
in libvirt.

---
 src/qemu/qemu_command.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 81e89fc..0580a37 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -457,7 +457,7 @@ qemuDomainSupportsNicdev(virDomainDefPtr def,
     /* non-virtio ARM nics require legacy -net nic */
     if (((def->os.arch == VIR_ARCH_ARMV7L) ||
         (def->os.arch == VIR_ARCH_AARCH64)) &&
-        net->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
+        strcmp(net->model, "virtio"))
         return false;
 
     return true;
@@ -1374,9 +1374,7 @@ qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
 {
     if (((def->os.arch == VIR_ARCH_ARMV7L) ||
         (def->os.arch == VIR_ARCH_AARCH64)) &&
-        (STRPREFIX(def->os.machine, "vexpress-") ||
-            STREQ(def->os.machine, "virt") ||
-            STRPREFIX(def->os.machine, "virt-")) &&
+        STRPREFIX(def->os.machine, "vexpress-") &&
         virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO)) {
         qemuDomainPrimeVirtioDeviceAddresses(
             def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO);
@@ -2501,6 +2499,12 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
             VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)
             continue;
 
+	if (((def->os.arch == VIR_ARCH_ARMV7L) ||
+	    (def->os.arch == VIR_ARCH_AARCH64)) &&
+	    STREQ(def->os.machine, "virt") &&
+	    def->disks[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
+	    continue;
+
         if (def->disks[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("virtio disk cannot have an address of type '%s'"),
-- 
1.9.5.msysgit.0


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]