]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Introduce tests for ARM CPU features
authorAndrea Bolognani <abologna@redhat.com>
Mon, 24 Jun 2019 13:22:24 +0000 (15:22 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 7 Nov 2019 15:09:22 +0000 (16:09 +0100)
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/qemuxml2argvdata/aarch64-features-sve-disabled.xml [new file with mode: 0644]
tests/qemuxml2argvdata/aarch64-features-sve.aarch64-latest.args [new file with mode: 0644]
tests/qemuxml2argvdata/aarch64-features-sve.xml [new file with mode: 0644]
tests/qemuxml2argvdata/aarch64-features-wrong.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c
tests/qemuxml2xmloutdata/aarch64-features-sve.aarch64-latest.xml [new file with mode: 0644]
tests/qemuxml2xmltest.c

diff --git a/tests/qemuxml2argvdata/aarch64-features-sve-disabled.xml b/tests/qemuxml2argvdata/aarch64-features-sve-disabled.xml
new file mode 100644 (file)
index 0000000..0fa8b13
--- /dev/null
@@ -0,0 +1,18 @@
+<domain type='kvm'>
+  <name>guest</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+  </os>
+  <cpu mode='host-passthrough'>
+    <feature policy='disable' name='sve'/>
+    <feature policy='require' name='sve128'/>
+  </cpu>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <controller type='usb' model='none'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/aarch64-features-sve.aarch64-latest.args b/tests/qemuxml2argvdata/aarch64-features-sve.aarch64-latest.args
new file mode 100644 (file)
index 0000000..6852f5d
--- /dev/null
@@ -0,0 +1,32 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-guest \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-guest/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-guest/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-aarch64 \
+-name guest=guest,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-guest/master-key.aes \
+-machine virt,accel=kvm,usb=off,dump-guest-core=off,gic-version=3 \
+-cpu host,sve512=on,sve384=off,sve256=on,sve128=on,sve=on \
+-m 1024 \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot strict=on \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/aarch64-features-sve.xml b/tests/qemuxml2argvdata/aarch64-features-sve.xml
new file mode 100644 (file)
index 0000000..0147a9b
--- /dev/null
@@ -0,0 +1,20 @@
+<domain type='kvm'>
+  <name>guest</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+  </os>
+  <cpu mode='host-passthrough'>
+    <feature policy='require' name='sve512'/>
+    <feature policy='disable' name='sve384'/>
+    <feature policy='require' name='sve256'/>
+    <feature policy='require' name='sve128'/>
+  </cpu>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <controller type='usb' model='none'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/aarch64-features-wrong.xml b/tests/qemuxml2argvdata/aarch64-features-wrong.xml
new file mode 100644 (file)
index 0000000..f4a883c
--- /dev/null
@@ -0,0 +1,17 @@
+<domain type='kvm'>
+  <name>guest</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+  </os>
+  <cpu mode='host-passthrough'>
+    <feature policy='disable' name='vmx'/>
+  </cpu>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <controller type='usb' model='none'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
index fd330df3e0b0ddea34915e584ef88e7826175e56..8c8743abc1369a681d26c404a29be4897ef1f4c3 100644 (file)
@@ -2669,6 +2669,15 @@ mymain(void)
     DO_TEST("aarch64-noacpi-nouefi", NONE);
     DO_TEST_PARSE_ERROR("aarch64-acpi-nouefi", NONE);
 
+    /* QEMU 4.0.0 didn't have support for aarch64 CPU features */
+    DO_TEST_CAPS_ARCH_VER_FAILURE("aarch64-features-sve", "aarch64", "4.0.0");
+    /* aarch64 doesn't support the same CPU features as x86 */
+    DO_TEST_CAPS_ARCH_LATEST_FAILURE("aarch64-features-wrong", "aarch64");
+    /* Can't enable vector lengths when SVE is overall disabled */
+    DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("aarch64-features-sve-disabled", "aarch64");
+    /* SVE aarch64 CPU features work on modern QEMU */
+    DO_TEST_CAPS_ARCH_LATEST("aarch64-features-sve", "aarch64");
+
     qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);
 
     DO_TEST("kvm-pit-delay", QEMU_CAPS_KVM_PIT_TICK_POLICY);
diff --git a/tests/qemuxml2xmloutdata/aarch64-features-sve.aarch64-latest.xml b/tests/qemuxml2xmloutdata/aarch64-features-sve.aarch64-latest.xml
new file mode 100644 (file)
index 0000000..914cc79
--- /dev/null
@@ -0,0 +1,31 @@
+<domain type='kvm'>
+  <name>guest</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <gic version='3'/>
+  </features>
+  <cpu mode='host-passthrough' check='none'>
+    <feature policy='require' name='sve512'/>
+    <feature policy='disable' name='sve384'/>
+    <feature policy='require' name='sve256'/>
+    <feature policy='require' name='sve128'/>
+    <feature policy='require' name='sve'/>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
index 89c9494e6cbaed64a47d4b4b530a73016bbf4f6e..a6c6c20ac123a290b5680d80222ddbcc771bee89 100644 (file)
@@ -1142,6 +1142,9 @@ mymain(void)
                  ARG_GIC, GIC_BOTH,
                  ARG_QEMU_CAPS, NONE);
 
+    /* SVE aarch64 CPU features work on modern QEMU */
+    DO_TEST_CAPS_ARCH_LATEST("aarch64-features-sve", "aarch64");
+
     DO_TEST("memory-hotplug", NONE);
     DO_TEST("memory-hotplug-nonuma", NONE);
     DO_TEST("memory-hotplug-dimm", NONE);