render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
503330
From bbdbfbfc03494f5cbba4ee869149cca37c1fd53c Mon Sep 17 00:00:00 2001
0a6408
From: Cole Robinson <crobinso@redhat.com>
0a6408
Date: Tue, 23 Sep 2014 13:07:09 -0400
0a6408
Subject: [PATCH] qemu: Don't compare CPU against host for TCG
0a6408
0a6408
Right now when building the qemu command line, we try to do various
0a6408
unconditional validations of the guest CPU against the host CPU. However
0a6408
this checks are overly applied. The only time we should use the checks
0a6408
are:
0a6408
0a6408
- The user requests host-model/host-passthrough, or
0a6408
0a6408
- When KVM is requsted. CPU features requested in TCG mode are always
0a6408
  emulated by qemu and are independent of the host CPU, so no host CPU
0a6408
  checks should be performed.
0a6408
0a6408
Right now if trying to specify a CPU for arm on an x86 host, it attempts
0a6408
to do non-sensical validation and falls over.
0a6408
0a6408
Switch all the test cases that were intending to test CPU validation to
0a6408
use KVM, so they continue to test the intended code.
0a6408
0a6408
Amend some aarch64 XML tests with a CPU model, to ensure things work
0a6408
correctly.
0a6408
0a6408
(cherry picked from commit cf7fce8f2fd1c930f357fd4ff93ac35f38eb30c6)
0a6408
---
0a6408
 src/qemu/qemu_command.c                            | 68 +++++++++++++---------
0a6408
 .../qemuxml2argv-aarch64-virt-default-nic.args     |  3 +-
0a6408
 .../qemuxml2argv-aarch64-virt-default-nic.xml      |  3 +
0a6408
 .../qemuxml2argv-aarch64-virt-virtio.args          |  3 +-
0a6408
 .../qemuxml2argv-aarch64-virt-virtio.xml           |  3 +
0a6408
 .../qemuxml2argvdata/qemuxml2argv-cpu-exact1.args  |  2 +-
0a6408
 tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml |  4 +-
0a6408
 .../qemuxml2argv-cpu-exact2-nofallback.args        |  2 +-
0a6408
 .../qemuxml2argv-cpu-exact2-nofallback.xml         |  4 +-
0a6408
 .../qemuxml2argvdata/qemuxml2argv-cpu-exact2.args  |  2 +-
0a6408
 tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml |  4 +-
0a6408
 .../qemuxml2argv-cpu-fallback.args                 |  2 +-
0a6408
 .../qemuxml2argvdata/qemuxml2argv-cpu-fallback.xml |  4 +-
0a6408
 .../qemuxml2argv-cpu-minimum1.args                 |  2 +-
0a6408
 .../qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml |  4 +-
0a6408
 .../qemuxml2argv-cpu-minimum2.args                 |  2 +-
0a6408
 .../qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml |  4 +-
0a6408
 .../qemuxml2argv-cpu-nofallback.xml                |  2 +-
0a6408
 .../qemuxml2argvdata/qemuxml2argv-cpu-strict1.args |  2 +-
0a6408
 .../qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml  |  4 +-
0a6408
 .../qemuxml2argv-graphics-spice-timeout.args       |  2 +-
0a6408
 .../qemuxml2argv-graphics-spice-timeout.xml        |  4 +-
0a6408
 .../qemuxml2argv-pseries-cpu-exact.args            |  4 +-
0a6408
 tests/qemuxml2argvtest.c                           | 21 +++----
0a6408
 .../qemuxml2xmlout-graphics-spice-timeout.xml      |  4 +-
0a6408
 25 files changed, 90 insertions(+), 69 deletions(-)
0a6408
0a6408
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
503330
index db5ea35..cd34445 100644
0a6408
--- a/src/qemu/qemu_command.c
0a6408
+++ b/src/qemu/qemu_command.c
503330
@@ -6160,6 +6160,8 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
0a6408
     virCPUCompareResult cmp;
0a6408
     const char *preferred;
0a6408
     virCapsPtr caps = NULL;
0a6408
+    bool compareAgainstHost = (def->virtType == VIR_DOMAIN_VIRT_KVM ||
0a6408
+        def->cpu->mode != VIR_CPU_MODE_CUSTOM);
0a6408
 
0a6408
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
0a6408
         goto cleanup;
503330
@@ -6182,30 +6184,33 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
0a6408
         cpuUpdate(cpu, host) < 0)
0a6408
         goto cleanup;
0a6408
 
0a6408
-    cmp = cpuGuestData(host, cpu, &data, &compare_msg);
0a6408
-    switch (cmp) {
0a6408
-    case VIR_CPU_COMPARE_INCOMPATIBLE:
0a6408
-        if (compare_msg) {
0a6408
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
0a6408
-                           _("guest and host CPU are not compatible: %s"),
0a6408
-                           compare_msg);
0a6408
-        } else {
0a6408
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
0a6408
-                           _("guest CPU is not compatible with host CPU"));
0a6408
-        }
0a6408
-        /* fall through */
0a6408
-    case VIR_CPU_COMPARE_ERROR:
0a6408
-        goto cleanup;
0a6408
+    /* For non-KVM, CPU features are emulated, so host compat doesn't matter */
0a6408
+    if (compareAgainstHost) {
0a6408
+        cmp = cpuGuestData(host, cpu, &data, &compare_msg);
0a6408
+        switch (cmp) {
0a6408
+        case VIR_CPU_COMPARE_INCOMPATIBLE:
0a6408
+            if (compare_msg) {
0a6408
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
0a6408
+                               _("guest and host CPU are not compatible: %s"),
0a6408
+                               compare_msg);
0a6408
+            } else {
0a6408
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
0a6408
+                               _("guest CPU is not compatible with host CPU"));
0a6408
+            }
0a6408
+            /* fall through */
0a6408
+        case VIR_CPU_COMPARE_ERROR:
0a6408
+            goto cleanup;
0a6408
 
0a6408
-    default:
0a6408
-        break;
0a6408
+        default:
0a6408
+            break;
0a6408
+        }
0a6408
     }
0a6408
 
0a6408
     /* Only 'svm' requires --enable-nesting. The nested
0a6408
      * 'vmx' patches now simply hook off the CPU features
0a6408
      */
0a6408
-    if (def->os.arch == VIR_ARCH_X86_64 ||
0a6408
-        def->os.arch == VIR_ARCH_I686) {
0a6408
+    if ((def->os.arch == VIR_ARCH_X86_64 || def->os.arch == VIR_ARCH_I686) &&
0a6408
+         compareAgainstHost) {
0a6408
         int hasSVM = cpuHasFeature(data, "svm");
0a6408
         if (hasSVM < 0)
0a6408
             goto cleanup;
503330
@@ -6233,16 +6238,23 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
0a6408
         if (VIR_STRDUP(guest->vendor_id, cpu->vendor_id) < 0)
0a6408
             goto cleanup;
0a6408
 
0a6408
-        guest->arch = host->arch;
0a6408
-        if (cpu->match == VIR_CPU_MATCH_MINIMUM)
0a6408
-            preferred = host->model;
0a6408
-        else
0a6408
-            preferred = cpu->model;
0a6408
+        if (compareAgainstHost) {
0a6408
+            guest->arch = host->arch;
0a6408
+            if (cpu->match == VIR_CPU_MATCH_MINIMUM)
0a6408
+                preferred = host->model;
0a6408
+            else
0a6408
+                preferred = cpu->model;
0a6408
 
0a6408
-        guest->type = VIR_CPU_TYPE_GUEST;
0a6408
-        guest->fallback = cpu->fallback;
0a6408
-        if (cpuDecode(guest, data, (const char **)cpus, ncpus, preferred) < 0)
0a6408
-            goto cleanup;
0a6408
+            guest->type = VIR_CPU_TYPE_GUEST;
0a6408
+            guest->fallback = cpu->fallback;
0a6408
+            if (cpuDecode(guest, data,
0a6408
+                          (const char **)cpus, ncpus, preferred) < 0)
0a6408
+                goto cleanup;
0a6408
+        } else {
0a6408
+            guest->arch = def->os.arch;
0a6408
+            if (VIR_STRDUP(guest->model, cpu->model) < 0)
0a6408
+                goto cleanup;
0a6408
+        }
0a6408
 
0a6408
         virBufferAdd(buf, guest->model, -1);
0a6408
         if (guest->vendor_id)
503330
@@ -6259,7 +6271,7 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
0a6408
     }
0a6408
 
0a6408
     ret = 0;
0a6408
-cleanup:
0a6408
+ cleanup:
0a6408
     virObjectUnref(caps);
0a6408
     VIR_FREE(compare_msg);
0a6408
     cpuDataFree(data);
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
0a6408
index d4d403b..8cb57c5 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
0a6408
@@ -1,5 +1,6 @@
0a6408
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
0a6408
-/usr/bin/qemu-system-aarch64 -S -M virt -m 1024 -smp 1 -nographic \
0a6408
+/usr/bin/qemu-system-aarch64 -S -M virt -cpu cortex-a53 \
0a6408
+-m 1024 -smp 1 -nographic \
0a6408
 -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
0a6408
 -boot c -kernel /aarch64.kernel -initrd /aarch64.initrd -append console=ttyAMA0 \
0a6408
 -usb -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
0a6408
index 868de94..3a6f098 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
0a6408
@@ -7,6 +7,9 @@
0a6408
   <features>
0a6408
     <acpi/>
0a6408
   </features>
0a6408
+  <cpu match='exact'>
0a6408
+    <model>cortex-a53</model>
0a6408
+  </cpu>
0a6408
   <os>
0a6408
     <type arch="aarch64" machine="virt">hvm</type>
0a6408
     <kernel>/aarch64.kernel</kernel>
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args
0a6408
index afd6e41..05f3629 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args
0a6408
@@ -1,5 +1,6 @@
0a6408
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
0a6408
-/usr/bin/qemu-system-aarch64 -S -M virt -m 1024 -smp 1 -nographic \
0a6408
+/usr/bin/qemu-system-aarch64 -S -M virt -cpu cortex-a53 \
0a6408
+-m 1024 -smp 1 -nographic \
0a6408
 -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
0a6408
 -boot c -kernel /aarch64.kernel -initrd /aarch64.initrd -append \
0a6408
 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml
0a6408
index 184b62c..ad34615 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml
0a6408
@@ -16,6 +16,9 @@
0a6408
     <apic/>
0a6408
     <pae/>
0a6408
   </features>
0a6408
+  <cpu match='exact'>
0a6408
+    <model>cortex-a53</model>
0a6408
+  </cpu>
0a6408
   <clock offset="utc"/>
0a6408
   <on_poweroff>destroy</on_poweroff>
0a6408
   <on_reboot>restart</on_reboot>
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.args
0a6408
index 76c2c48..0a58616 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.args
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.args
0a6408
@@ -1,5 +1,5 @@
0a6408
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
0a6408
-/usr/bin/qemu -S -M pc \
0a6408
+/usr/bin/qemu-kvm -S -M pc \
0a6408
 -cpu qemu64,-svm,-lm,-nx,-syscall,-clflush,-pse36,-mca -m 214 -smp 6 \
0a6408
 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -usb -net \
0a6408
 none -serial none -parallel none
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml
0a6408
index ddd9d5a..1d1e815 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml
0a6408
@@ -1,4 +1,4 @@
0a6408
-<domain type='qemu'>
0a6408
+<domain type='kvm'>
0a6408
   <name>QEMUGuest1</name>
0a6408
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
0a6408
   <memory unit='KiB'>219100</memory>
0a6408
@@ -23,6 +23,6 @@
0a6408
   <on_reboot>restart</on_reboot>
0a6408
   <on_crash>destroy</on_crash>
0a6408
   <devices>
0a6408
-      <emulator>/usr/bin/qemu</emulator>
0a6408
+      <emulator>/usr/bin/qemu-kvm</emulator>
0a6408
   </devices>
0a6408
 </domain>
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.args
0a6408
index 0e37379..e46527b 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.args
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.args
0a6408
@@ -1,5 +1,5 @@
0a6408
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
0a6408
-/usr/bin/qemu -S -M pc \
0a6408
+/usr/bin/qemu-kvm -S -M pc \
0a6408
 -cpu core2duo,+lahf_lm,+3dnowext,+xtpr,+ds_cpl,+tm,+ht,+ds,-nx -m 214 -smp 6 \
0a6408
 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -usb -net \
0a6408
 none -serial none -parallel none
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.xml
0a6408
index de4c8d2..6b9b7d4 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.xml
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.xml
0a6408
@@ -1,4 +1,4 @@
0a6408
-<domain type='qemu'>
0a6408
+<domain type='kvm'>
0a6408
   <name>QEMUGuest1</name>
0a6408
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
0a6408
   <memory unit='KiB'>219100</memory>
0a6408
@@ -30,6 +30,6 @@
0a6408
   <on_reboot>restart</on_reboot>
0a6408
   <on_crash>destroy</on_crash>
0a6408
   <devices>
0a6408
-      <emulator>/usr/bin/qemu</emulator>
0a6408
+      <emulator>/usr/bin/qemu-kvm</emulator>
0a6408
   </devices>
0a6408
 </domain>
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.args
0a6408
index 0e37379..e46527b 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.args
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.args
0a6408
@@ -1,5 +1,5 @@
0a6408
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
0a6408
-/usr/bin/qemu -S -M pc \
0a6408
+/usr/bin/qemu-kvm -S -M pc \
0a6408
 -cpu core2duo,+lahf_lm,+3dnowext,+xtpr,+ds_cpl,+tm,+ht,+ds,-nx -m 214 -smp 6 \
0a6408
 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -usb -net \
0a6408
 none -serial none -parallel none
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml
0a6408
index e027e6f..eaea564 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml
0a6408
@@ -1,4 +1,4 @@
0a6408
-<domain type='qemu'>
0a6408
+<domain type='kvm'>
0a6408
   <name>QEMUGuest1</name>
0a6408
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
0a6408
   <memory unit='KiB'>219100</memory>
0a6408
@@ -30,6 +30,6 @@
0a6408
   <on_reboot>restart</on_reboot>
0a6408
   <on_crash>destroy</on_crash>
0a6408
   <devices>
0a6408
-      <emulator>/usr/bin/qemu</emulator>
0a6408
+      <emulator>/usr/bin/qemu-kvm</emulator>
0a6408
   </devices>
0a6408
 </domain>
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.args
0a6408
index 4ee8391..ead561f 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.args
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.args
0a6408
@@ -3,7 +3,7 @@ PATH=/bin \
0a6408
 HOME=/home/test \
0a6408
 USER=test \
0a6408
 LOGNAME=test QEMU_AUDIO_DRV=none \
0a6408
-/usr/bin/qemu \
0a6408
+/usr/bin/qemu-kvm \
0a6408
 -S \
0a6408
 -M pc \
0a6408
 -cpu Penryn,-sse4.1 \
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.xml
0a6408
index 6125f41..85642e9 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.xml
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.xml
0a6408
@@ -1,4 +1,4 @@
0a6408
-<domain type='qemu'>
0a6408
+<domain type='kvm'>
0a6408
   <name>QEMUGuest1</name>
0a6408
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
0a6408
   <memory unit='KiB'>219100</memory>
0a6408
@@ -20,6 +20,6 @@
0a6408
   <on_reboot>restart</on_reboot>
0a6408
   <on_crash>destroy</on_crash>
0a6408
   <devices>
0a6408
-      <emulator>/usr/bin/qemu</emulator>
0a6408
+      <emulator>/usr/bin/qemu-kvm</emulator>
0a6408
   </devices>
0a6408
 </domain>
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.args
0a6408
index 0630ef4..d8207e7 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.args
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.args
0a6408
@@ -1,5 +1,5 @@
0a6408
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
0a6408
-/usr/bin/qemu -S -M pc \
0a6408
+/usr/bin/qemu-kvm -S -M pc \
0a6408
 -cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,\
0a6408
 +acpi,+ds -m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,\
0a6408
 nowait -no-acpi -boot n -usb -net none -serial none -parallel none
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml
0a6408
index 4ba5d0b..5879d35 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml
0a6408
@@ -1,4 +1,4 @@
0a6408
-<domain type='qemu'>
0a6408
+<domain type='kvm'>
0a6408
   <name>QEMUGuest1</name>
0a6408
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
0a6408
   <memory unit='KiB'>219100</memory>
0a6408
@@ -16,6 +16,6 @@
0a6408
   <on_reboot>restart</on_reboot>
0a6408
   <on_crash>destroy</on_crash>
0a6408
   <devices>
0a6408
-      <emulator>/usr/bin/qemu</emulator>
0a6408
+      <emulator>/usr/bin/qemu-kvm</emulator>
0a6408
   </devices>
0a6408
 </domain>
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.args
0a6408
index 830994f..17ba256 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.args
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.args
0a6408
@@ -1,5 +1,5 @@
0a6408
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
0a6408
-/usr/bin/qemu -S -M pc \
0a6408
+/usr/bin/qemu-kvm -S -M pc \
0a6408
 -cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,\
0a6408
 +acpi,+ds,-lm,-nx,-syscall -m 214 -smp 6 -nographic -monitor \
0a6408
 unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -usb -net none -serial none \
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml
0a6408
index c43bf4f..b8bbf25 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml
0a6408
@@ -1,4 +1,4 @@
0a6408
-<domain type='qemu'>
0a6408
+<domain type='kvm'>
0a6408
   <name>QEMUGuest1</name>
0a6408
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
0a6408
   <memory unit='KiB'>219100</memory>
0a6408
@@ -20,6 +20,6 @@
0a6408
   <on_reboot>restart</on_reboot>
0a6408
   <on_crash>destroy</on_crash>
0a6408
   <devices>
0a6408
-      <emulator>/usr/bin/qemu</emulator>
0a6408
+      <emulator>/usr/bin/qemu-kvm</emulator>
0a6408
   </devices>
0a6408
 </domain>
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-nofallback.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-nofallback.xml
0a6408
index 4ae0be8..abb0e9c 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-nofallback.xml
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-nofallback.xml
0a6408
@@ -1,4 +1,4 @@
0a6408
-<domain type='qemu'>
0a6408
+<domain type='kvm'>
0a6408
   <name>QEMUGuest1</name>
0a6408
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
0a6408
   <memory unit='KiB'>219100</memory>
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.args
0a6408
index 8b545a7..c500ef7 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.args
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.args
0a6408
@@ -1,5 +1,5 @@
0a6408
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
0a6408
-/usr/bin/qemu -S -M pc \
0a6408
+/usr/bin/qemu-kvm -S -M pc \
0a6408
 -cpu core2duo,+lahf_lm,+3dnowext,+xtpr,+est,+vmx,+ds_cpl,+tm,+ht,+acpi,+ds,-nx \
0a6408
 -m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
0a6408
 -no-acpi -boot n -usb -net none -serial none -parallel none
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml
0a6408
index 935f46f..a9fc9c5 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml
0a6408
@@ -1,4 +1,4 @@
0a6408
-<domain type='qemu'>
0a6408
+<domain type='kvm'>
0a6408
   <name>QEMUGuest1</name>
0a6408
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
0a6408
   <memory unit='KiB'>219100</memory>
0a6408
@@ -33,6 +33,6 @@
0a6408
   <on_reboot>restart</on_reboot>
0a6408
   <on_crash>destroy</on_crash>
0a6408
   <devices>
0a6408
-      <emulator>/usr/bin/qemu</emulator>
0a6408
+      <emulator>/usr/bin/qemu-kvm</emulator>
0a6408
   </devices>
0a6408
 </domain>
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
0a6408
index 48744b2..8b5d9ee 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
0a6408
@@ -1,5 +1,5 @@
0a6408
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \
0a6408
-/usr/bin/qemu -S -M pc -cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,\
0a6408
+/usr/bin/qemu-kvm -S -M pc -cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,\
0a6408
 +est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds \
0a6408
 -m 1024 -smp 2 -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
0a6408
 -boot dc -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 \
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
0a6408
index e6ecbed..3ed864c 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
0a6408
@@ -1,4 +1,4 @@
0a6408
-<domain type='qemu'>
0a6408
+<domain type='kvm'>
0a6408
   <name>f14</name>
0a6408
   <uuid>553effab-b5e1-2d80-dfe3-da4344826c43</uuid>
0a6408
   <memory unit='KiB'>1048576</memory>
0a6408
@@ -38,7 +38,7 @@
0a6408
   <on_reboot>restart</on_reboot>
0a6408
   <on_crash>restart</on_crash>
0a6408
   <devices>
0a6408
-    <emulator>/usr/bin/qemu</emulator>
0a6408
+    <emulator>/usr/bin/qemu-kvm</emulator>
0a6408
     <disk type='file' device='disk'>
0a6408
       <driver name='qemu' type='qcow2'/>
0a6408
       <source file='/var/lib/libvirt/images/f14.img'/>
0a6408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args
0a6408
index 1e09680..9927294 100644
0a6408
--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args
0a6408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args
0a6408
@@ -1,6 +1,6 @@
0a6408
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
0a6408
-/usr/bin/qemu-system-ppc64 -S -M pseries -cpu POWER7_v2.3 -m 512 -smp 1 -nographic \
0a6408
--nodefconfig -nodefaults \
0a6408
+QEMU_AUDIO_DRV=none /usr/bin/qemu-system-ppc64 -S -M pseries -cpu POWER7_v2.3 \
0a6408
+-m 512 -smp 1 -nographic -nodefconfig -nodefaults \
0a6408
 -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
0a6408
 -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb \
0a6408
 -chardev pty,id=charserial0 \
0a6408
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
503330
index b380fd8..483ca90 100644
0a6408
--- a/tests/qemuxml2argvtest.c
0a6408
+++ b/tests/qemuxml2argvtest.c
503330
@@ -933,7 +933,7 @@ mymain(void)
0a6408
             QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
0a6408
             QEMU_CAPS_DEVICE_QXL);
0a6408
     DO_TEST("graphics-spice-timeout",
0a6408
-            QEMU_CAPS_DRIVE,
0a6408
+            QEMU_CAPS_KVM, QEMU_CAPS_DRIVE,
0a6408
             QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
0a6408
             QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
0a6408
             QEMU_CAPS_DEVICE_QXL_VGA);
503330
@@ -1208,14 +1208,14 @@ mymain(void)
0a6408
     DO_TEST("cpu-topology1", QEMU_CAPS_SMP_TOPOLOGY);
0a6408
     DO_TEST("cpu-topology2", QEMU_CAPS_SMP_TOPOLOGY);
0a6408
     DO_TEST("cpu-topology3", NONE);
0a6408
-    DO_TEST("cpu-minimum1", NONE);
0a6408
-    DO_TEST("cpu-minimum2", NONE);
0a6408
-    DO_TEST("cpu-exact1", NONE);
0a6408
-    DO_TEST("cpu-exact2", NONE);
0a6408
-    DO_TEST("cpu-exact2-nofallback", NONE);
0a6408
-    DO_TEST("cpu-fallback", NONE);
0a6408
-    DO_TEST_FAILURE("cpu-nofallback", NONE);
0a6408
-    DO_TEST("cpu-strict1", NONE);
0a6408
+    DO_TEST("cpu-minimum1", QEMU_CAPS_KVM);
0a6408
+    DO_TEST("cpu-minimum2", QEMU_CAPS_KVM);
0a6408
+    DO_TEST("cpu-exact1", QEMU_CAPS_KVM);
0a6408
+    DO_TEST("cpu-exact2", QEMU_CAPS_KVM);
0a6408
+    DO_TEST("cpu-exact2-nofallback", QEMU_CAPS_KVM);
0a6408
+    DO_TEST("cpu-fallback", QEMU_CAPS_KVM);
0a6408
+    DO_TEST_FAILURE("cpu-nofallback", QEMU_CAPS_KVM);
0a6408
+    DO_TEST("cpu-strict1", QEMU_CAPS_KVM);
0a6408
     DO_TEST("cpu-numa1", NONE);
0a6408
     DO_TEST("cpu-numa2", QEMU_CAPS_SMP_TOPOLOGY);
0a6408
     DO_TEST_PARSE_ERROR("cpu-numa3", NONE);
503330
@@ -1303,7 +1303,8 @@ mymain(void)
0a6408
     DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI,
0a6408
             QEMU_CAPS_DEVICE_USB_KBD, QEMU_CAPS_CHARDEV,
0a6408
             QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
0a6408
-    DO_TEST_FAILURE("pseries-cpu-exact", QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
0a6408
+    DO_TEST("pseries-cpu-exact", QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
0a6408
+            QEMU_CAPS_NODEFCONFIG);
0a6408
     DO_TEST("disk-ide-drive-split",
0a6408
             QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
0a6408
             QEMU_CAPS_IDE_CD);
0a6408
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
0a6408
index 44c4cf7..73ebcab 100644
0a6408
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
0a6408
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
0a6408
@@ -1,4 +1,4 @@
0a6408
-<domain type='qemu'>
0a6408
+<domain type='kvm'>
0a6408
   <name>f14</name>
0a6408
   <uuid>553effab-b5e1-2d80-dfe3-da4344826c43</uuid>
0a6408
   <memory unit='KiB'>1048576</memory>
0a6408
@@ -38,7 +38,7 @@
0a6408
   <on_reboot>restart</on_reboot>
0a6408
   <on_crash>restart</on_crash>
0a6408
   <devices>
0a6408
-    <emulator>/usr/bin/qemu</emulator>
0a6408
+    <emulator>/usr/bin/qemu-kvm</emulator>
0a6408
     <disk type='file' device='disk'>
0a6408
       <driver name='qemu' type='qcow2'/>
0a6408
       <source file='/var/lib/libvirt/images/f14.img'/>