6ae9ed
From db94d82338e66a7f238e5f19c317fede75186ad4 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <db94d82338e66a7f238e5f19c317fede75186ad4@dist-git>
6ae9ed
From: Jiri Denemark <jdenemar@redhat.com>
6ae9ed
Date: Tue, 9 Aug 2016 15:03:20 +0200
6ae9ed
Subject: [PATCH] tests: Add a test for host-model CPU with CMT feature
6ae9ed
6ae9ed
The generated command line wouldn't work since QEMU doesn't know what
6ae9ed
'cmt' is. The following patch will fix this issue.
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1355857
6ae9ed
6ae9ed
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6ae9ed
(cherry picked from commit 58ba240df89a7dd7bff16ebb65d9aadd49fb8bbb)
6ae9ed
6ae9ed
RHEL changes:
6ae9ed
    - since commit v2.0.0-8-g0c8ec3b libvirt in RHEL always passes
6ae9ed
      +rtm,+hle options to Haswell and Broadwell CPUs
6ae9ed
    - downstream does not assume QEMU_CAPS_SMP_TOPOLOGY
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1365500
6ae9ed
6ae9ed
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6ae9ed
---
6ae9ed
 .../qemuxml2argv-cpu-host-model-cmt.args           | 22 ++++++++++++++++++++++
6ae9ed
 .../qemuxml2argv-cpu-host-model-cmt.xml            | 19 +++++++++++++++++++
6ae9ed
 tests/qemuxml2argvtest.c                           |  1 +
6ae9ed
 tests/testutilsqemu.c                              |  1 +
6ae9ed
 4 files changed, 43 insertions(+)
6ae9ed
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.args
6ae9ed
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.xml
6ae9ed
6ae9ed
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.args
6ae9ed
new file mode 100644
6ae9ed
index 0000000..884ca57
6ae9ed
--- /dev/null
6ae9ed
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.args
6ae9ed
@@ -0,0 +1,22 @@
6ae9ed
+LC_ALL=C \
6ae9ed
+PATH=/bin \
6ae9ed
+HOME=/home/test \
6ae9ed
+USER=test \
6ae9ed
+LOGNAME=test \
6ae9ed
+QEMU_AUDIO_DRV=none \
6ae9ed
+/usr/bin/qemu \
6ae9ed
+-name QEMUGuest1 \
6ae9ed
+-S \
6ae9ed
+-M pc \
6ae9ed
+-cpu Haswell,+vme,+ds,+acpi,+ss,+ht,+tm,+pbe,+dtes64,+monitor,+ds_cpl,+vmx,\
6ae9ed
++smx,+est,+tm2,+xtpr,+pdcm,+osxsave,+f16c,+rdrand,+cmt,+pdpe1gb,+abm,+rtm,+hle \
6ae9ed
+-m 214 \
6ae9ed
+-smp 6 \
6ae9ed
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
6ae9ed
+-nographic \
6ae9ed
+-nodefaults \
6ae9ed
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
6ae9ed
+-no-acpi \
6ae9ed
+-boot n \
6ae9ed
+-usb \
6ae9ed
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
6ae9ed
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.xml
6ae9ed
new file mode 100644
6ae9ed
index 0000000..7e3f617
6ae9ed
--- /dev/null
6ae9ed
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-host-model-cmt.xml
6ae9ed
@@ -0,0 +1,19 @@
6ae9ed
+<domain type='qemu'>
6ae9ed
+  <name>QEMUGuest1</name>
6ae9ed
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
6ae9ed
+  <memory unit='KiB'>219100</memory>
6ae9ed
+  <currentMemory unit='KiB'>219100</currentMemory>
6ae9ed
+  <vcpu placement='static'>6</vcpu>
6ae9ed
+  <os>
6ae9ed
+    <type arch='x86_64' machine='pc'>hvm</type>
6ae9ed
+    <boot dev='network'/>
6ae9ed
+  </os>
6ae9ed
+  <cpu mode='host-model'/>
6ae9ed
+  <clock offset='utc'/>
6ae9ed
+  <on_poweroff>destroy</on_poweroff>
6ae9ed
+  <on_reboot>restart</on_reboot>
6ae9ed
+  <on_crash>destroy</on_crash>
6ae9ed
+  <devices>
6ae9ed
+      <emulator>/usr/bin/qemu</emulator>
6ae9ed
+  </devices>
6ae9ed
+</domain>
6ae9ed
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
6ae9ed
index 95474e8..927728e 100644
6ae9ed
--- a/tests/qemuxml2argvtest.c
6ae9ed
+++ b/tests/qemuxml2argvtest.c
6ae9ed
@@ -1391,6 +1391,7 @@ mymain(void)
6ae9ed
     DO_TEST("cpu-Haswell2", QEMU_CAPS_KVM);
6ae9ed
     DO_TEST("cpu-Haswell3", QEMU_CAPS_KVM);
6ae9ed
     DO_TEST("cpu-Haswell-noTSX", QEMU_CAPS_KVM);
6ae9ed
+    DO_TEST("cpu-host-model-cmt", NONE);
6ae9ed
     driver.caps->host.cpu = cpuDefault;
6ae9ed
 
6ae9ed
     DO_TEST("encrypted-disk", NONE);
6ae9ed
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
6ae9ed
index 1cf72a9..f41b0b6 100644
6ae9ed
--- a/tests/testutilsqemu.c
6ae9ed
+++ b/tests/testutilsqemu.c
6ae9ed
@@ -54,6 +54,7 @@ static virCPUFeatureDef cpuHaswellFeatures[] = {
6ae9ed
     { (char *) "invtsc",    -1 },
6ae9ed
     { (char *) "abm",       -1 },
6ae9ed
     { (char *) "pdpe1gb",   -1 },
6ae9ed
+    { (char *) "cmt",       -1 },
6ae9ed
     { (char *) "rdrand",    -1 },
6ae9ed
     { (char *) "f16c",      -1 },
6ae9ed
     { (char *) "osxsave",   -1 },
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed