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