[PATCH libvirt v2 5/5] tests: add test with PCI and CCW device

Shalini Chellathurai Saroja shalini at linux.ibm.com
Thu Jun 18 08:25:18 UTC 2020


Add test with a ZPCI host device and a CCW memballoon device to ensure
that CCW address remains the default address assigned.

Signed-off-by: Boris Fiuczynski <fiuczy at linux.ibm.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini at linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk at linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy at linux.ibm.com>
---
 .../hostdev-vfio-zpci-ccw-memballoon.args     | 28 ++++++++++++++++
 .../hostdev-vfio-zpci-ccw-memballoon.xml      | 17 ++++++++++
 tests/qemuxml2argvtest.c                      |  4 +++
 .../hostdev-vfio-zpci-ccw-memballoon.xml      | 32 +++++++++++++++++++
 tests/qemuxml2xmltest.c                       |  4 +++
 5 files changed, 85 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon.args
 create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon.xml
 create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci-ccw-memballoon.xml

diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon.args b/tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon.args
new file mode 100644
index 00000000..103c4f72
--- /dev/null
+++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon.args
@@ -0,0 +1,28 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-KVMGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-KVMGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-KVMGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-KVMGuest1/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x \
+-name KVMGuest1 \
+-S \
+-machine s390-ccw-virtio,accel=kvm,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-KVMGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-device zpci,uid=1,fid=0,target=hostdev0,id=zpci1 \
+-device vfio-pci,host=0000:00:00.0,id=hostdev0,bus=pci.0,addr=0x1 \
+-device virtio-balloon-ccw,id=balloon0,devno=fe.0.0000
diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon.xml b/tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon.xml
new file mode 100644
index 00000000..ef5e97fc
--- /dev/null
+++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon.xml
@@ -0,0 +1,17 @@
+<domain type='kvm'>
+  <name>KVMGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219100</memory>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <hostdev mode='subsystem' type='pci'>
+      <driver name='vfio'/>
+      <source>
+        <address domain='0x0000' bus='0x00' slot='0x00' function='0x0'/>
+      </source>
+    </hostdev>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1aa12693..6f5c52b0 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1776,6 +1776,10 @@ mymain(void)
     DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-set-zero",
                         QEMU_CAPS_DEVICE_VFIO_PCI,
                         QEMU_CAPS_DEVICE_ZPCI);
+    DO_TEST("hostdev-vfio-zpci-ccw-memballoon",
+            QEMU_CAPS_CCW,
+            QEMU_CAPS_DEVICE_VFIO_PCI,
+            QEMU_CAPS_DEVICE_ZPCI);
 
     DO_TEST("pci-rom", QEMU_CAPS_DEVICE_VFIO_PCI);
     DO_TEST("pci-rom-disabled", NONE);
diff --git a/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-ccw-memballoon.xml b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-ccw-memballoon.xml
new file mode 100644
index 00000000..0d18e2d6
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-ccw-memballoon.xml
@@ -0,0 +1,32 @@
+<domain type='kvm'>
+  <name>KVMGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <controller type='pci' index='0' model='pci-root'/>
+    <hostdev mode='subsystem' type='pci' managed='no'>
+      <driver name='vfio'/>
+      <source>
+        <address domain='0x0000' bus='0x00' slot='0x00' function='0x0'/>
+      </source>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'>
+        <zpci uid='0x0001' fid='0x00000000'/>
+      </address>
+    </hostdev>
+    <memballoon model='virtio'>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+    </memballoon>
+    <panic model='s390'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 20243a97..c2644a18 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -529,6 +529,10 @@ mymain(void)
             QEMU_CAPS_DEVICE_VFIO_PCI,
             QEMU_CAPS_DEVICE_PCI_BRIDGE,
             QEMU_CAPS_DEVICE_ZPCI);
+    DO_TEST("hostdev-vfio-zpci-ccw-memballoon",
+            QEMU_CAPS_CCW,
+            QEMU_CAPS_DEVICE_VFIO_PCI,
+            QEMU_CAPS_DEVICE_ZPCI);
     DO_TEST("hostdev-mdev-precreated", QEMU_CAPS_DEVICE_VFIO_PCI);
     DO_TEST("hostdev-mdev-display",
             QEMU_CAPS_DEVICE_QXL,
-- 
2.25.4




More information about the libvir-list mailing list