Blob Blame History Raw
From bbdbfbfc03494f5cbba4ee869149cca37c1fd53c Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Tue, 23 Sep 2014 13:07:09 -0400
Subject: [PATCH] qemu: Don't compare CPU against host for TCG

Right now when building the qemu command line, we try to do various
unconditional validations of the guest CPU against the host CPU. However
this checks are overly applied. The only time we should use the checks
are:

- The user requests host-model/host-passthrough, or

- When KVM is requsted. CPU features requested in TCG mode are always
  emulated by qemu and are independent of the host CPU, so no host CPU
  checks should be performed.

Right now if trying to specify a CPU for arm on an x86 host, it attempts
to do non-sensical validation and falls over.

Switch all the test cases that were intending to test CPU validation to
use KVM, so they continue to test the intended code.

Amend some aarch64 XML tests with a CPU model, to ensure things work
correctly.

(cherry picked from commit cf7fce8f2fd1c930f357fd4ff93ac35f38eb30c6)
---
 src/qemu/qemu_command.c                            | 68 +++++++++++++---------
 .../qemuxml2argv-aarch64-virt-default-nic.args     |  3 +-
 .../qemuxml2argv-aarch64-virt-default-nic.xml      |  3 +
 .../qemuxml2argv-aarch64-virt-virtio.args          |  3 +-
 .../qemuxml2argv-aarch64-virt-virtio.xml           |  3 +
 .../qemuxml2argvdata/qemuxml2argv-cpu-exact1.args  |  2 +-
 tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml |  4 +-
 .../qemuxml2argv-cpu-exact2-nofallback.args        |  2 +-
 .../qemuxml2argv-cpu-exact2-nofallback.xml         |  4 +-
 .../qemuxml2argvdata/qemuxml2argv-cpu-exact2.args  |  2 +-
 tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml |  4 +-
 .../qemuxml2argv-cpu-fallback.args                 |  2 +-
 .../qemuxml2argvdata/qemuxml2argv-cpu-fallback.xml |  4 +-
 .../qemuxml2argv-cpu-minimum1.args                 |  2 +-
 .../qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml |  4 +-
 .../qemuxml2argv-cpu-minimum2.args                 |  2 +-
 .../qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml |  4 +-
 .../qemuxml2argv-cpu-nofallback.xml                |  2 +-
 .../qemuxml2argvdata/qemuxml2argv-cpu-strict1.args |  2 +-
 .../qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml  |  4 +-
 .../qemuxml2argv-graphics-spice-timeout.args       |  2 +-
 .../qemuxml2argv-graphics-spice-timeout.xml        |  4 +-
 .../qemuxml2argv-pseries-cpu-exact.args            |  4 +-
 tests/qemuxml2argvtest.c                           | 21 +++----
 .../qemuxml2xmlout-graphics-spice-timeout.xml      |  4 +-
 25 files changed, 90 insertions(+), 69 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index db5ea35..cd34445 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6160,6 +6160,8 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
     virCPUCompareResult cmp;
     const char *preferred;
     virCapsPtr caps = NULL;
+    bool compareAgainstHost = (def->virtType == VIR_DOMAIN_VIRT_KVM ||
+        def->cpu->mode != VIR_CPU_MODE_CUSTOM);
 
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
         goto cleanup;
@@ -6182,30 +6184,33 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
         cpuUpdate(cpu, host) < 0)
         goto cleanup;
 
-    cmp = cpuGuestData(host, cpu, &data, &compare_msg);
-    switch (cmp) {
-    case VIR_CPU_COMPARE_INCOMPATIBLE:
-        if (compare_msg) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("guest and host CPU are not compatible: %s"),
-                           compare_msg);
-        } else {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("guest CPU is not compatible with host CPU"));
-        }
-        /* fall through */
-    case VIR_CPU_COMPARE_ERROR:
-        goto cleanup;
+    /* For non-KVM, CPU features are emulated, so host compat doesn't matter */
+    if (compareAgainstHost) {
+        cmp = cpuGuestData(host, cpu, &data, &compare_msg);
+        switch (cmp) {
+        case VIR_CPU_COMPARE_INCOMPATIBLE:
+            if (compare_msg) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("guest and host CPU are not compatible: %s"),
+                               compare_msg);
+            } else {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("guest CPU is not compatible with host CPU"));
+            }
+            /* fall through */
+        case VIR_CPU_COMPARE_ERROR:
+            goto cleanup;
 
-    default:
-        break;
+        default:
+            break;
+        }
     }
 
     /* Only 'svm' requires --enable-nesting. The nested
      * 'vmx' patches now simply hook off the CPU features
      */
-    if (def->os.arch == VIR_ARCH_X86_64 ||
-        def->os.arch == VIR_ARCH_I686) {
+    if ((def->os.arch == VIR_ARCH_X86_64 || def->os.arch == VIR_ARCH_I686) &&
+         compareAgainstHost) {
         int hasSVM = cpuHasFeature(data, "svm");
         if (hasSVM < 0)
             goto cleanup;
@@ -6233,16 +6238,23 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
         if (VIR_STRDUP(guest->vendor_id, cpu->vendor_id) < 0)
             goto cleanup;
 
-        guest->arch = host->arch;
-        if (cpu->match == VIR_CPU_MATCH_MINIMUM)
-            preferred = host->model;
-        else
-            preferred = cpu->model;
+        if (compareAgainstHost) {
+            guest->arch = host->arch;
+            if (cpu->match == VIR_CPU_MATCH_MINIMUM)
+                preferred = host->model;
+            else
+                preferred = cpu->model;
 
-        guest->type = VIR_CPU_TYPE_GUEST;
-        guest->fallback = cpu->fallback;
-        if (cpuDecode(guest, data, (const char **)cpus, ncpus, preferred) < 0)
-            goto cleanup;
+            guest->type = VIR_CPU_TYPE_GUEST;
+            guest->fallback = cpu->fallback;
+            if (cpuDecode(guest, data,
+                          (const char **)cpus, ncpus, preferred) < 0)
+                goto cleanup;
+        } else {
+            guest->arch = def->os.arch;
+            if (VIR_STRDUP(guest->model, cpu->model) < 0)
+                goto cleanup;
+        }
 
         virBufferAdd(buf, guest->model, -1);
         if (guest->vendor_id)
@@ -6259,7 +6271,7 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
     }
 
     ret = 0;
-cleanup:
+ cleanup:
     virObjectUnref(caps);
     VIR_FREE(compare_msg);
     cpuDataFree(data);
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
index d4d403b..8cb57c5 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args
@@ -1,5 +1,6 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu-system-aarch64 -S -M virt -m 1024 -smp 1 -nographic \
+/usr/bin/qemu-system-aarch64 -S -M virt -cpu cortex-a53 \
+-m 1024 -smp 1 -nographic \
 -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
 -boot c -kernel /aarch64.kernel -initrd /aarch64.initrd -append console=ttyAMA0 \
 -usb -device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
index 868de94..3a6f098 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml
@@ -7,6 +7,9 @@
   <features>
     <acpi/>
   </features>
+  <cpu match='exact'>
+    <model>cortex-a53</model>
+  </cpu>
   <os>
     <type arch="aarch64" machine="virt">hvm</type>
     <kernel>/aarch64.kernel</kernel>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args
index afd6e41..05f3629 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args
@@ -1,5 +1,6 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu-system-aarch64 -S -M virt -m 1024 -smp 1 -nographic \
+/usr/bin/qemu-system-aarch64 -S -M virt -cpu cortex-a53 \
+-m 1024 -smp 1 -nographic \
 -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
 -boot c -kernel /aarch64.kernel -initrd /aarch64.initrd -append \
 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml
index 184b62c..ad34615 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml
@@ -16,6 +16,9 @@
     <apic/>
     <pae/>
   </features>
+  <cpu match='exact'>
+    <model>cortex-a53</model>
+  </cpu>
   <clock offset="utc"/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.args
index 76c2c48..0a58616 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.args
@@ -1,5 +1,5 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu -S -M pc \
+/usr/bin/qemu-kvm -S -M pc \
 -cpu qemu64,-svm,-lm,-nx,-syscall,-clflush,-pse36,-mca -m 214 -smp 6 \
 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -usb -net \
 none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml
index ddd9d5a..1d1e815 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact1.xml
@@ -1,4 +1,4 @@
-<domain type='qemu'>
+<domain type='kvm'>
   <name>QEMUGuest1</name>
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
   <memory unit='KiB'>219100</memory>
@@ -23,6 +23,6 @@
   <on_reboot>restart</on_reboot>
   <on_crash>destroy</on_crash>
   <devices>
-      <emulator>/usr/bin/qemu</emulator>
+      <emulator>/usr/bin/qemu-kvm</emulator>
   </devices>
 </domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.args
index 0e37379..e46527b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.args
@@ -1,5 +1,5 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu -S -M pc \
+/usr/bin/qemu-kvm -S -M pc \
 -cpu core2duo,+lahf_lm,+3dnowext,+xtpr,+ds_cpl,+tm,+ht,+ds,-nx -m 214 -smp 6 \
 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -usb -net \
 none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.xml
index de4c8d2..6b9b7d4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2-nofallback.xml
@@ -1,4 +1,4 @@
-<domain type='qemu'>
+<domain type='kvm'>
   <name>QEMUGuest1</name>
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
   <memory unit='KiB'>219100</memory>
@@ -30,6 +30,6 @@
   <on_reboot>restart</on_reboot>
   <on_crash>destroy</on_crash>
   <devices>
-      <emulator>/usr/bin/qemu</emulator>
+      <emulator>/usr/bin/qemu-kvm</emulator>
   </devices>
 </domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.args
index 0e37379..e46527b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.args
@@ -1,5 +1,5 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu -S -M pc \
+/usr/bin/qemu-kvm -S -M pc \
 -cpu core2duo,+lahf_lm,+3dnowext,+xtpr,+ds_cpl,+tm,+ht,+ds,-nx -m 214 -smp 6 \
 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -usb -net \
 none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml
index e027e6f..eaea564 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-exact2.xml
@@ -1,4 +1,4 @@
-<domain type='qemu'>
+<domain type='kvm'>
   <name>QEMUGuest1</name>
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
   <memory unit='KiB'>219100</memory>
@@ -30,6 +30,6 @@
   <on_reboot>restart</on_reboot>
   <on_crash>destroy</on_crash>
   <devices>
-      <emulator>/usr/bin/qemu</emulator>
+      <emulator>/usr/bin/qemu-kvm</emulator>
   </devices>
 </domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.args
index 4ee8391..ead561f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.args
@@ -3,7 +3,7 @@ PATH=/bin \
 HOME=/home/test \
 USER=test \
 LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu \
+/usr/bin/qemu-kvm \
 -S \
 -M pc \
 -cpu Penryn,-sse4.1 \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.xml
index 6125f41..85642e9 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-fallback.xml
@@ -1,4 +1,4 @@
-<domain type='qemu'>
+<domain type='kvm'>
   <name>QEMUGuest1</name>
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
   <memory unit='KiB'>219100</memory>
@@ -20,6 +20,6 @@
   <on_reboot>restart</on_reboot>
   <on_crash>destroy</on_crash>
   <devices>
-      <emulator>/usr/bin/qemu</emulator>
+      <emulator>/usr/bin/qemu-kvm</emulator>
   </devices>
 </domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.args
index 0630ef4..d8207e7 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.args
@@ -1,5 +1,5 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu -S -M pc \
+/usr/bin/qemu-kvm -S -M pc \
 -cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,\
 +acpi,+ds -m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,\
 nowait -no-acpi -boot n -usb -net none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml
index 4ba5d0b..5879d35 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum1.xml
@@ -1,4 +1,4 @@
-<domain type='qemu'>
+<domain type='kvm'>
   <name>QEMUGuest1</name>
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
   <memory unit='KiB'>219100</memory>
@@ -16,6 +16,6 @@
   <on_reboot>restart</on_reboot>
   <on_crash>destroy</on_crash>
   <devices>
-      <emulator>/usr/bin/qemu</emulator>
+      <emulator>/usr/bin/qemu-kvm</emulator>
   </devices>
 </domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.args
index 830994f..17ba256 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.args
@@ -1,5 +1,5 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu -S -M pc \
+/usr/bin/qemu-kvm -S -M pc \
 -cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,\
 +acpi,+ds,-lm,-nx,-syscall -m 214 -smp 6 -nographic -monitor \
 unix:/tmp/test-monitor,server,nowait -no-acpi -boot n -usb -net none -serial none \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml
index c43bf4f..b8bbf25 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-minimum2.xml
@@ -1,4 +1,4 @@
-<domain type='qemu'>
+<domain type='kvm'>
   <name>QEMUGuest1</name>
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
   <memory unit='KiB'>219100</memory>
@@ -20,6 +20,6 @@
   <on_reboot>restart</on_reboot>
   <on_crash>destroy</on_crash>
   <devices>
-      <emulator>/usr/bin/qemu</emulator>
+      <emulator>/usr/bin/qemu-kvm</emulator>
   </devices>
 </domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-nofallback.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-nofallback.xml
index 4ae0be8..abb0e9c 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-nofallback.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-nofallback.xml
@@ -1,4 +1,4 @@
-<domain type='qemu'>
+<domain type='kvm'>
   <name>QEMUGuest1</name>
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
   <memory unit='KiB'>219100</memory>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.args
index 8b545a7..c500ef7 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.args
@@ -1,5 +1,5 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu -S -M pc \
+/usr/bin/qemu-kvm -S -M pc \
 -cpu core2duo,+lahf_lm,+3dnowext,+xtpr,+est,+vmx,+ds_cpl,+tm,+ht,+acpi,+ds,-nx \
 -m 214 -smp 6 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
 -no-acpi -boot n -usb -net none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml
index 935f46f..a9fc9c5 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-strict1.xml
@@ -1,4 +1,4 @@
-<domain type='qemu'>
+<domain type='kvm'>
   <name>QEMUGuest1</name>
   <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
   <memory unit='KiB'>219100</memory>
@@ -33,6 +33,6 @@
   <on_reboot>restart</on_reboot>
   <on_crash>destroy</on_crash>
   <devices>
-      <emulator>/usr/bin/qemu</emulator>
+      <emulator>/usr/bin/qemu-kvm</emulator>
   </devices>
 </domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
index 48744b2..8b5d9ee 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.args
@@ -1,5 +1,5 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \
-/usr/bin/qemu -S -M pc -cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,\
+/usr/bin/qemu-kvm -S -M pc -cpu core2duo,+lahf_lm,+xtpr,+cx16,+tm2,\
 +est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds \
 -m 1024 -smp 2 -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
 -boot dc -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
index e6ecbed..3ed864c 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
@@ -1,4 +1,4 @@
-<domain type='qemu'>
+<domain type='kvm'>
   <name>f14</name>
   <uuid>553effab-b5e1-2d80-dfe3-da4344826c43</uuid>
   <memory unit='KiB'>1048576</memory>
@@ -38,7 +38,7 @@
   <on_reboot>restart</on_reboot>
   <on_crash>restart</on_crash>
   <devices>
-    <emulator>/usr/bin/qemu</emulator>
+    <emulator>/usr/bin/qemu-kvm</emulator>
     <disk type='file' device='disk'>
       <driver name='qemu' type='qcow2'/>
       <source file='/var/lib/libvirt/images/f14.img'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args
index 1e09680..9927294 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args
@@ -1,6 +1,6 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
-/usr/bin/qemu-system-ppc64 -S -M pseries -cpu POWER7_v2.3 -m 512 -smp 1 -nographic \
--nodefconfig -nodefaults \
+QEMU_AUDIO_DRV=none /usr/bin/qemu-system-ppc64 -S -M pseries -cpu POWER7_v2.3 \
+-m 512 -smp 1 -nographic -nodefconfig -nodefaults \
 -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
 -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb \
 -chardev pty,id=charserial0 \
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index b380fd8..483ca90 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -933,7 +933,7 @@ mymain(void)
             QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
             QEMU_CAPS_DEVICE_QXL);
     DO_TEST("graphics-spice-timeout",
-            QEMU_CAPS_DRIVE,
+            QEMU_CAPS_KVM, QEMU_CAPS_DRIVE,
             QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
             QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
             QEMU_CAPS_DEVICE_QXL_VGA);
@@ -1208,14 +1208,14 @@ mymain(void)
     DO_TEST("cpu-topology1", QEMU_CAPS_SMP_TOPOLOGY);
     DO_TEST("cpu-topology2", QEMU_CAPS_SMP_TOPOLOGY);
     DO_TEST("cpu-topology3", NONE);
-    DO_TEST("cpu-minimum1", NONE);
-    DO_TEST("cpu-minimum2", NONE);
-    DO_TEST("cpu-exact1", NONE);
-    DO_TEST("cpu-exact2", NONE);
-    DO_TEST("cpu-exact2-nofallback", NONE);
-    DO_TEST("cpu-fallback", NONE);
-    DO_TEST_FAILURE("cpu-nofallback", NONE);
-    DO_TEST("cpu-strict1", NONE);
+    DO_TEST("cpu-minimum1", QEMU_CAPS_KVM);
+    DO_TEST("cpu-minimum2", QEMU_CAPS_KVM);
+    DO_TEST("cpu-exact1", QEMU_CAPS_KVM);
+    DO_TEST("cpu-exact2", QEMU_CAPS_KVM);
+    DO_TEST("cpu-exact2-nofallback", QEMU_CAPS_KVM);
+    DO_TEST("cpu-fallback", QEMU_CAPS_KVM);
+    DO_TEST_FAILURE("cpu-nofallback", QEMU_CAPS_KVM);
+    DO_TEST("cpu-strict1", QEMU_CAPS_KVM);
     DO_TEST("cpu-numa1", NONE);
     DO_TEST("cpu-numa2", QEMU_CAPS_SMP_TOPOLOGY);
     DO_TEST_PARSE_ERROR("cpu-numa3", NONE);
@@ -1303,7 +1303,8 @@ mymain(void)
     DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI,
             QEMU_CAPS_DEVICE_USB_KBD, QEMU_CAPS_CHARDEV,
             QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
-    DO_TEST_FAILURE("pseries-cpu-exact", QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
+    DO_TEST("pseries-cpu-exact", QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
+            QEMU_CAPS_NODEFCONFIG);
     DO_TEST("disk-ide-drive-split",
             QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_IDE_CD);
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
index 44c4cf7..73ebcab 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
@@ -1,4 +1,4 @@
-<domain type='qemu'>
+<domain type='kvm'>
   <name>f14</name>
   <uuid>553effab-b5e1-2d80-dfe3-da4344826c43</uuid>
   <memory unit='KiB'>1048576</memory>
@@ -38,7 +38,7 @@
   <on_reboot>restart</on_reboot>
   <on_crash>restart</on_crash>
   <devices>
-    <emulator>/usr/bin/qemu</emulator>
+    <emulator>/usr/bin/qemu-kvm</emulator>
     <disk type='file' device='disk'>
       <driver name='qemu' type='qcow2'/>
       <source file='/var/lib/libvirt/images/f14.img'/>