[libvirt] [PATCH] Add support for virt machine with virtio-mmio devices

Clark Laughlin clark.laughlin at linaro.org
Tue Nov 12 03:59:02 UTC 2013


These changes allow the correct virtio-blk-device and virtio-net-device
devices to be used for the 'virt' machine type rather than the PCI virtio
devices.
---
 src/qemu/qemu_command.c | 4 +++-
 src/qemu/qemu_domain.c  | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 63e235d..901120e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1335,12 +1335,14 @@ cleanup:
 
     return ret;
 }
+
 static int
 qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
                                        virQEMUCapsPtr qemuCaps)
 {
     if (def->os.arch == VIR_ARCH_ARMV7L &&
-        STRPREFIX(def->os.machine, "vexpress-") &&
+        (STRPREFIX(def->os.machine, "vexpress-") ||
+            STREQ(def->os.machine, "virt")) &&
         virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO)) {
         qemuDomainPrimeVirtioDeviceAddresses(
             def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 81d0ba9..346fec3 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -797,6 +797,9 @@ qemuDomainDefaultNetModel(const virDomainDef *def)
         if (STREQ(def->os.machine, "versatilepb"))
             return "smc91c111";
 
+        if (STREQ(def->os.machine, "virt"))
+            return "virtio";
+
         /* Incomplete. vexpress (and a few others) use this, but not all
          * arm boards */
         return "lan9118";
-- 
1.8.3.2




More information about the libvir-list mailing list