forked from rpms/libvirt
575 lines
19 KiB
Diff
575 lines
19 KiB
Diff
|
From fddd43e717869d56e481c3fde2d5ee6b5513a1f5 Mon Sep 17 00:00:00 2001
|
||
|
Message-Id: <fddd43e717869d56e481c3fde2d5ee6b5513a1f5@dist-git>
|
||
|
From: Yi Min Zhao <zyimin@linux.ibm.com>
|
||
|
Date: Mon, 8 Apr 2019 10:57:25 +0200
|
||
|
Subject: [PATCH] conf: Introduce parser, formatter for uid and fid
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
This patch introduces new XML parser/formatter functions. Uid is
|
||
|
16-bit and non-zero. Fid is 32-bit. They are the two attributes of zpci
|
||
|
which is introduced as PCI address element. Zpci element is parsed and
|
||
|
formatted along with PCI address. And add the related test cases.
|
||
|
|
||
|
Signed-off-by: Yi Min Zhao <zyimin@linux.ibm.com>
|
||
|
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||
|
Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com>
|
||
|
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
|
||
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||
|
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||
|
|
||
|
(cherry picked from commit b4833b2c2f7be8a68eb6495ed57ed61918e3ecd8)
|
||
|
|
||
|
https://bugzilla.redhat.com/show_bug.cgi?id=1508149
|
||
|
|
||
|
Conflicts:
|
||
|
|
||
|
* src/conf/device_conf.c
|
||
|
+ context
|
||
|
- missing edeef779585
|
||
|
|
||
|
* tests/qemuxml2argvtest.c
|
||
|
+ context
|
||
|
- missing a0ff9fbe5cad, 0bdb704383f7
|
||
|
|
||
|
Changed:
|
||
|
|
||
|
* tests/qemuxml2argvdata/disk-virtio-s390-zpci.args
|
||
|
tests/qemuxml2argvdata/hostdev-vfio-zpci.args
|
||
|
+ no -boot in output
|
||
|
- missing caccbba64aa9
|
||
|
|
||
|
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||
|
Message-Id: <20190408085732.28684-9-abologna@redhat.com>
|
||
|
Reviewed-by: Laine Stump <laine@redhat.com>
|
||
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||
|
---
|
||
|
docs/schemas/basictypes.rng | 27 ++++++++++
|
||
|
docs/schemas/domaincommon.rng | 1 +
|
||
|
src/conf/device_conf.c | 53 +++++++++++++++++++
|
||
|
src/conf/domain_addr.c | 3 ++
|
||
|
src/conf/domain_conf.c | 12 ++++-
|
||
|
src/libvirt_private.syms | 2 +
|
||
|
src/util/virpci.c | 26 +++++++++
|
||
|
src/util/virpci.h | 6 +++
|
||
|
.../disk-virtio-s390-zpci.args | 26 +++++++++
|
||
|
.../disk-virtio-s390-zpci.xml | 19 +++++++
|
||
|
tests/qemuxml2argvdata/hostdev-vfio-zpci.args | 24 +++++++++
|
||
|
tests/qemuxml2argvdata/hostdev-vfio-zpci.xml | 21 ++++++++
|
||
|
tests/qemuxml2argvtest.c | 7 +++
|
||
|
.../disk-virtio-s390-zpci.xml | 31 +++++++++++
|
||
|
.../qemuxml2xmloutdata/hostdev-vfio-zpci.xml | 32 +++++++++++
|
||
|
tests/qemuxml2xmltest.c | 6 +++
|
||
|
16 files changed, 295 insertions(+), 1 deletion(-)
|
||
|
create mode 100644 tests/qemuxml2argvdata/disk-virtio-s390-zpci.args
|
||
|
create mode 100644 tests/qemuxml2argvdata/disk-virtio-s390-zpci.xml
|
||
|
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci.args
|
||
|
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci.xml
|
||
|
create mode 100644 tests/qemuxml2xmloutdata/disk-virtio-s390-zpci.xml
|
||
|
create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci.xml
|
||
|
|
||
|
diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
|
||
|
index b45a7fcdc8..97e14d7ca8 100644
|
||
|
--- a/docs/schemas/basictypes.rng
|
||
|
+++ b/docs/schemas/basictypes.rng
|
||
|
@@ -65,6 +65,17 @@
|
||
|
</data>
|
||
|
</choice>
|
||
|
</define>
|
||
|
+ <define name="uint32">
|
||
|
+ <choice>
|
||
|
+ <data type="string">
|
||
|
+ <param name="pattern">(0x)?[0-9a-fA-F]{1,8}</param>
|
||
|
+ </data>
|
||
|
+ <data type="unsignedInt">
|
||
|
+ <param name="minInclusive">0</param>
|
||
|
+ <param name="maxInclusive">4294967295</param>
|
||
|
+ </data>
|
||
|
+ </choice>
|
||
|
+ </define>
|
||
|
|
||
|
<define name="UUID">
|
||
|
<choice>
|
||
|
@@ -111,6 +122,22 @@
|
||
|
</attribute>
|
||
|
</optional>
|
||
|
</define>
|
||
|
+ <define name="zpciaddress">
|
||
|
+ <optional>
|
||
|
+ <element name="zpci">
|
||
|
+ <optional>
|
||
|
+ <attribute name="uid">
|
||
|
+ <ref name="uint16"/>
|
||
|
+ </attribute>
|
||
|
+ </optional>
|
||
|
+ <optional>
|
||
|
+ <attribute name="fid">
|
||
|
+ <ref name="uint32"/>
|
||
|
+ </attribute>
|
||
|
+ </optional>
|
||
|
+ </element>
|
||
|
+ </optional>
|
||
|
+ </define>
|
||
|
|
||
|
<!-- a 6 byte MAC address in ASCII-hex format, eg "12:34:56:78:9A:BC" -->
|
||
|
<!-- The lowest bit of the 1st byte is the "multicast" bit. a -->
|
||
|
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||
|
index 70a7767d9c..2b6d4dced6 100644
|
||
|
--- a/docs/schemas/domaincommon.rng
|
||
|
+++ b/docs/schemas/domaincommon.rng
|
||
|
@@ -5186,6 +5186,7 @@
|
||
|
<value>pci</value>
|
||
|
</attribute>
|
||
|
<ref name="pciaddress"/>
|
||
|
+ <ref name="zpciaddress"/>
|
||
|
</group>
|
||
|
<group>
|
||
|
<attribute name="type">
|
||
|
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
|
||
|
index d69f94fadf..cadac32603 100644
|
||
|
--- a/src/conf/device_conf.c
|
||
|
+++ b/src/conf/device_conf.c
|
||
|
@@ -32,6 +32,45 @@
|
||
|
|
||
|
#define VIR_FROM_THIS VIR_FROM_DEVICE
|
||
|
|
||
|
+static int
|
||
|
+virZPCIDeviceAddressParseXML(xmlNodePtr node,
|
||
|
+ virPCIDeviceAddressPtr addr)
|
||
|
+{
|
||
|
+ virZPCIDeviceAddress def = { 0 };
|
||
|
+ char *uid;
|
||
|
+ char *fid;
|
||
|
+ int ret = -1;
|
||
|
+
|
||
|
+ uid = virXMLPropString(node, "uid");
|
||
|
+ fid = virXMLPropString(node, "fid");
|
||
|
+
|
||
|
+ if (uid &&
|
||
|
+ virStrToLong_uip(uid, NULL, 0, &def.uid) < 0) {
|
||
|
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||
|
+ _("Cannot parse <address> 'uid' attribute"));
|
||
|
+ goto cleanup;
|
||
|
+ }
|
||
|
+
|
||
|
+ if (fid &&
|
||
|
+ virStrToLong_uip(fid, NULL, 0, &def.fid) < 0) {
|
||
|
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||
|
+ _("Cannot parse <address> 'fid' attribute"));
|
||
|
+ goto cleanup;
|
||
|
+ }
|
||
|
+
|
||
|
+ if (!virZPCIDeviceAddressIsEmpty(&def) &&
|
||
|
+ !virZPCIDeviceAddressIsValid(&def))
|
||
|
+ goto cleanup;
|
||
|
+
|
||
|
+ addr->zpci = def;
|
||
|
+ ret = 0;
|
||
|
+
|
||
|
+ cleanup:
|
||
|
+ VIR_FREE(uid);
|
||
|
+ VIR_FREE(fid);
|
||
|
+ return ret;
|
||
|
+}
|
||
|
+
|
||
|
int
|
||
|
virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
|
||
|
virDomainDeviceInfoPtr src)
|
||
|
@@ -196,6 +235,8 @@ virPCIDeviceAddressParseXML(xmlNodePtr node,
|
||
|
virPCIDeviceAddressPtr addr)
|
||
|
{
|
||
|
char *domain, *slot, *bus, *function, *multi;
|
||
|
+ xmlNodePtr cur;
|
||
|
+ xmlNodePtr zpci = NULL;
|
||
|
int ret = -1;
|
||
|
|
||
|
memset(addr, 0, sizeof(*addr));
|
||
|
@@ -245,6 +286,18 @@ virPCIDeviceAddressParseXML(xmlNodePtr node,
|
||
|
if (!virPCIDeviceAddressIsEmpty(addr) && !virPCIDeviceAddressIsValid(addr, true))
|
||
|
goto cleanup;
|
||
|
|
||
|
+ cur = node->children;
|
||
|
+ while (cur) {
|
||
|
+ if (cur->type == XML_ELEMENT_NODE &&
|
||
|
+ virXMLNodeNameEqual(cur, "zpci")) {
|
||
|
+ zpci = cur;
|
||
|
+ }
|
||
|
+ cur = cur->next;
|
||
|
+ }
|
||
|
+
|
||
|
+ if (zpci && virZPCIDeviceAddressParseXML(zpci, addr) < 0)
|
||
|
+ goto cleanup;
|
||
|
+
|
||
|
ret = 0;
|
||
|
|
||
|
cleanup:
|
||
|
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
|
||
|
index 3e33549c3d..9e0a0fdf95 100644
|
||
|
--- a/src/conf/domain_addr.c
|
||
|
+++ b/src/conf/domain_addr.c
|
||
|
@@ -1054,6 +1054,9 @@ virDomainPCIAddressReserveNextAddr(virDomainPCIAddressSetPtr addrs,
|
||
|
dev->isolationGroup, false) < 0)
|
||
|
return -1;
|
||
|
|
||
|
+ addr.extFlags = dev->addr.pci.extFlags;
|
||
|
+ addr.zpci = dev->addr.pci.zpci;
|
||
|
+
|
||
|
if (!addrs->dryRun) {
|
||
|
dev->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||
|
dev->addr.pci = addr;
|
||
|
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||
|
index bcb0558bc3..29ebf0a930 100644
|
||
|
--- a/src/conf/domain_conf.c
|
||
|
+++ b/src/conf/domain_conf.c
|
||
|
@@ -6448,6 +6448,7 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||
|
unsigned int flags)
|
||
|
{
|
||
|
virBuffer attrBuf = VIR_BUFFER_INITIALIZER;
|
||
|
+ virBuffer childBuf = VIR_BUFFER_INITIALIZER;
|
||
|
|
||
|
if ((flags & VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) && info->bootIndex) {
|
||
|
virBufferAsprintf(buf, "<boot order='%u'", info->bootIndex);
|
||
|
@@ -6510,6 +6511,14 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||
|
virBufferAsprintf(&attrBuf, " multifunction='%s'",
|
||
|
virTristateSwitchTypeToString(info->addr.pci.multi));
|
||
|
}
|
||
|
+
|
||
|
+ if (!virZPCIDeviceAddressIsEmpty(&info->addr.pci.zpci)) {
|
||
|
+ virBufferSetChildIndent(&childBuf, buf);
|
||
|
+ virBufferAsprintf(&childBuf,
|
||
|
+ "<zpci uid='0x%.4x' fid='0x%.8x'/>\n",
|
||
|
+ info->addr.pci.zpci.uid,
|
||
|
+ info->addr.pci.zpci.fid);
|
||
|
+ }
|
||
|
break;
|
||
|
|
||
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE:
|
||
|
@@ -6577,9 +6586,10 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
- virXMLFormatElement(buf, "address", &attrBuf, NULL);
|
||
|
+ virXMLFormatElement(buf, "address", &attrBuf, &childBuf);
|
||
|
|
||
|
virBufferFreeAndReset(&attrBuf);
|
||
|
+ virBufferFreeAndReset(&childBuf);
|
||
|
}
|
||
|
|
||
|
static int
|
||
|
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||
|
index df27ac4b3a..b2a2a1f265 100644
|
||
|
--- a/src/libvirt_private.syms
|
||
|
+++ b/src/libvirt_private.syms
|
||
|
@@ -2569,6 +2569,8 @@ virPCIHeaderTypeToString;
|
||
|
virPCIIsVirtualFunction;
|
||
|
virPCIStubDriverTypeFromString;
|
||
|
virPCIStubDriverTypeToString;
|
||
|
+virZPCIDeviceAddressIsEmpty;
|
||
|
+virZPCIDeviceAddressIsValid;
|
||
|
|
||
|
|
||
|
# util/virperf.h
|
||
|
diff --git a/src/util/virpci.c b/src/util/virpci.c
|
||
|
index 8d02366664..3a1e49a7a7 100644
|
||
|
--- a/src/util/virpci.c
|
||
|
+++ b/src/util/virpci.c
|
||
|
@@ -2597,6 +2597,32 @@ virPCIDeviceAddressParse(char *address,
|
||
|
|
||
|
#ifdef __linux__
|
||
|
|
||
|
+bool
|
||
|
+virZPCIDeviceAddressIsValid(virZPCIDeviceAddressPtr zpci)
|
||
|
+{
|
||
|
+ /* We don't need to check fid because fid covers
|
||
|
+ * all range of uint32 type.
|
||
|
+ */
|
||
|
+ if (zpci->uid > VIR_DOMAIN_DEVICE_ZPCI_MAX_UID ||
|
||
|
+ zpci->uid == 0) {
|
||
|
+ virReportError(VIR_ERR_XML_ERROR,
|
||
|
+ _("Invalid PCI address uid='0x%.4x', "
|
||
|
+ "must be > 0x0000 and <= 0x%.4x"),
|
||
|
+ zpci->uid,
|
||
|
+ VIR_DOMAIN_DEVICE_ZPCI_MAX_UID);
|
||
|
+ return false;
|
||
|
+ }
|
||
|
+
|
||
|
+ return true;
|
||
|
+}
|
||
|
+
|
||
|
+bool
|
||
|
+virZPCIDeviceAddressIsEmpty(const virZPCIDeviceAddress *addr)
|
||
|
+{
|
||
|
+ return !(addr->uid || addr->fid);
|
||
|
+}
|
||
|
+
|
||
|
+
|
||
|
/*
|
||
|
* returns true if equal
|
||
|
*/
|
||
|
diff --git a/src/util/virpci.h b/src/util/virpci.h
|
||
|
index b366d7d9c3..1ed9e2381e 100644
|
||
|
--- a/src/util/virpci.h
|
||
|
+++ b/src/util/virpci.h
|
||
|
@@ -36,6 +36,9 @@ typedef virPCIDeviceAddress *virPCIDeviceAddressPtr;
|
||
|
typedef struct _virPCIDeviceList virPCIDeviceList;
|
||
|
typedef virPCIDeviceList *virPCIDeviceListPtr;
|
||
|
|
||
|
+# define VIR_DOMAIN_DEVICE_ZPCI_MAX_UID UINT16_MAX
|
||
|
+# define VIR_DOMAIN_DEVICE_ZPCI_MAX_FID UINT32_MAX
|
||
|
+
|
||
|
typedef struct _virZPCIDeviceAddress virZPCIDeviceAddress;
|
||
|
typedef virZPCIDeviceAddress *virZPCIDeviceAddressPtr;
|
||
|
struct _virZPCIDeviceAddress {
|
||
|
@@ -235,6 +238,9 @@ int virPCIGetAddrString(unsigned int domain,
|
||
|
|
||
|
int virPCIDeviceAddressParse(char *address, virPCIDeviceAddressPtr bdf);
|
||
|
|
||
|
+bool virZPCIDeviceAddressIsValid(virZPCIDeviceAddressPtr zpci);
|
||
|
+bool virZPCIDeviceAddressIsEmpty(const virZPCIDeviceAddress *addr);
|
||
|
+
|
||
|
int virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
|
||
|
int pfNetDevIdx,
|
||
|
char **pfname,
|
||
|
diff --git a/tests/qemuxml2argvdata/disk-virtio-s390-zpci.args b/tests/qemuxml2argvdata/disk-virtio-s390-zpci.args
|
||
|
new file mode 100644
|
||
|
index 0000000000..20e63a15b5
|
||
|
--- /dev/null
|
||
|
+++ b/tests/qemuxml2argvdata/disk-virtio-s390-zpci.args
|
||
|
@@ -0,0 +1,26 @@
|
||
|
+LC_ALL=C \
|
||
|
+PATH=/bin \
|
||
|
+HOME=/home/test \
|
||
|
+USER=test \
|
||
|
+LOGNAME=test \
|
||
|
+QEMU_AUDIO_DRV=none \
|
||
|
+/usr/bin/qemu-system-s390x \
|
||
|
+-name QEMUGuest1 \
|
||
|
+-S \
|
||
|
+-machine s390-ccw-virtio,accel=tcg,usb=off,dump-guest-core=off \
|
||
|
+-m 214 \
|
||
|
+-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-QEMUGuest1/monitor.sock,\
|
||
|
+server,nowait \
|
||
|
+-mon chardev=charmonitor,id=monitor,mode=control \
|
||
|
+-rtc base=utc \
|
||
|
+-no-shutdown \
|
||
|
+-boot c \
|
||
|
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
|
||
|
+-device virtio-blk-pci,bus=pci.0,addr=0x8,drive=drive-virtio-disk0,\
|
||
|
+id=virtio-disk0 \
|
||
|
+-device virtio-balloon-ccw,id=balloon0,devno=fe.0.0000
|
||
|
diff --git a/tests/qemuxml2argvdata/disk-virtio-s390-zpci.xml b/tests/qemuxml2argvdata/disk-virtio-s390-zpci.xml
|
||
|
new file mode 100644
|
||
|
index 0000000000..8bf4a23670
|
||
|
--- /dev/null
|
||
|
+++ b/tests/qemuxml2argvdata/disk-virtio-s390-zpci.xml
|
||
|
@@ -0,0 +1,19 @@
|
||
|
+<domain type='qemu'>
|
||
|
+ <name>QEMUGuest1</name>
|
||
|
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||
|
+ <memory>219136</memory>
|
||
|
+ <vcpu>1</vcpu>
|
||
|
+ <os>
|
||
|
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
|
||
|
+ </os>
|
||
|
+ <devices>
|
||
|
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
|
||
|
+ <disk type='block' device='disk'>
|
||
|
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
||
|
+ <target dev='hda' bus='virtio'/>
|
||
|
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'>
|
||
|
+ <zpci uid='0x0019' fid='0x0000001f'/>
|
||
|
+ </address>
|
||
|
+ </disk>
|
||
|
+ </devices>
|
||
|
+</domain>
|
||
|
diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci.args b/tests/qemuxml2argvdata/hostdev-vfio-zpci.args
|
||
|
new file mode 100644
|
||
|
index 0000000000..622c504da0
|
||
|
--- /dev/null
|
||
|
+++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci.args
|
||
|
@@ -0,0 +1,24 @@
|
||
|
+LC_ALL=C \
|
||
|
+PATH=/bin \
|
||
|
+HOME=/home/test \
|
||
|
+USER=test \
|
||
|
+LOGNAME=test \
|
||
|
+QEMU_AUDIO_DRV=none \
|
||
|
+/usr/bin/qemu-system-s390x \
|
||
|
+-name QEMUGuest1 \
|
||
|
+-S \
|
||
|
+-machine s390-ccw-virtio,accel=tcg,usb=off,dump-guest-core=off \
|
||
|
+-m 214 \
|
||
|
+-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-QEMUGuest1/monitor.sock,\
|
||
|
+server,nowait \
|
||
|
+-mon chardev=charmonitor,id=monitor,mode=control \
|
||
|
+-rtc base=utc \
|
||
|
+-no-shutdown \
|
||
|
+-boot c \
|
||
|
+-device vfio-pci,host=00:00.0,id=hostdev0,bus=pci.0,addr=0x8 \
|
||
|
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x1
|
||
|
diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci.xml b/tests/qemuxml2argvdata/hostdev-vfio-zpci.xml
|
||
|
new file mode 100644
|
||
|
index 0000000000..002b99c52d
|
||
|
--- /dev/null
|
||
|
+++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci.xml
|
||
|
@@ -0,0 +1,21 @@
|
||
|
+<domain type='qemu'>
|
||
|
+ <name>QEMUGuest1</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>
|
||
|
+ <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='0x08' function='0x0'>
|
||
|
+ <zpci uid='0x0019' fid='0x0000001f'/>
|
||
|
+ </address>
|
||
|
+ </hostdev>
|
||
|
+ </devices>
|
||
|
+</domain>
|
||
|
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||
|
index 7f25cccf9d..2eb2505971 100644
|
||
|
--- a/tests/qemuxml2argvtest.c
|
||
|
+++ b/tests/qemuxml2argvtest.c
|
||
|
@@ -1038,6 +1038,10 @@ mymain(void)
|
||
|
QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
|
||
|
DO_TEST("disk-virtio-scsi-ccw", QEMU_CAPS_VIRTIO_SCSI,
|
||
|
QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
|
||
|
+ DO_TEST("disk-virtio-s390-zpci",
|
||
|
+ QEMU_CAPS_DEVICE_ZPCI,
|
||
|
+ QEMU_CAPS_CCW,
|
||
|
+ QEMU_CAPS_VIRTIO_S390);
|
||
|
DO_TEST("disk-order",
|
||
|
QEMU_CAPS_DRIVE_BOOT, QEMU_CAPS_VIRTIO_BLK_SCSI);
|
||
|
DO_TEST("disk-virtio-drive-queues",
|
||
|
@@ -1628,6 +1632,9 @@ mymain(void)
|
||
|
DO_TEST_PARSE_ERROR("hostdev-mdev-display-missing-graphics",
|
||
|
QEMU_CAPS_DEVICE_VFIO_PCI,
|
||
|
QEMU_CAPS_VFIO_PCI_DISPLAY);
|
||
|
+ DO_TEST("hostdev-vfio-zpci",
|
||
|
+ QEMU_CAPS_DEVICE_VFIO_PCI,
|
||
|
+ QEMU_CAPS_DEVICE_ZPCI);
|
||
|
DO_TEST("pci-rom", NONE);
|
||
|
DO_TEST("pci-rom-disabled", NONE);
|
||
|
DO_TEST("pci-rom-disabled-invalid", NONE);
|
||
|
diff --git a/tests/qemuxml2xmloutdata/disk-virtio-s390-zpci.xml b/tests/qemuxml2xmloutdata/disk-virtio-s390-zpci.xml
|
||
|
new file mode 100644
|
||
|
index 0000000000..37684c82b1
|
||
|
--- /dev/null
|
||
|
+++ b/tests/qemuxml2xmloutdata/disk-virtio-s390-zpci.xml
|
||
|
@@ -0,0 +1,31 @@
|
||
|
+<domain type='qemu'>
|
||
|
+ <name>QEMUGuest1</name>
|
||
|
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||
|
+ <memory unit='KiB'>219136</memory>
|
||
|
+ <currentMemory unit='KiB'>219136</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>
|
||
|
+ <disk type='block' device='disk'>
|
||
|
+ <driver name='qemu' type='raw'/>
|
||
|
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
||
|
+ <target dev='hda' bus='virtio'/>
|
||
|
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'>
|
||
|
+ <zpci uid='0x0019' fid='0x0000001f'/>
|
||
|
+ </address>
|
||
|
+ </disk>
|
||
|
+ <controller type='pci' index='0' model='pci-root'/>
|
||
|
+ <memballoon model='virtio'>
|
||
|
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
|
||
|
+ </memballoon>
|
||
|
+ <panic model='s390'/>
|
||
|
+ </devices>
|
||
|
+</domain>
|
||
|
diff --git a/tests/qemuxml2xmloutdata/hostdev-vfio-zpci.xml b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci.xml
|
||
|
new file mode 100644
|
||
|
index 0000000000..fc8c38ab66
|
||
|
--- /dev/null
|
||
|
+++ b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci.xml
|
||
|
@@ -0,0 +1,32 @@
|
||
|
+<domain type='qemu'>
|
||
|
+ <name>QEMUGuest1</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='0x08' function='0x0'>
|
||
|
+ <zpci uid='0x0019' fid='0x0000001f'/>
|
||
|
+ </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 2a2bf01ffa..a787f4f4a3 100644
|
||
|
--- a/tests/qemuxml2xmltest.c
|
||
|
+++ b/tests/qemuxml2xmltest.c
|
||
|
@@ -400,6 +400,9 @@ mymain(void)
|
||
|
QEMU_CAPS_VIRTIO_SCSI);
|
||
|
DO_TEST("disk-virtio-scsi-ioeventfd",
|
||
|
QEMU_CAPS_VIRTIO_SCSI);
|
||
|
+ DO_TEST("disk-virtio-s390-zpci",
|
||
|
+ QEMU_CAPS_DEVICE_ZPCI,
|
||
|
+ QEMU_CAPS_CCW);
|
||
|
DO_TEST("disk-scsi-megasas",
|
||
|
QEMU_CAPS_SCSI_MEGASAS);
|
||
|
DO_TEST("disk-scsi-mptsas1068",
|
||
|
@@ -482,6 +485,9 @@ mymain(void)
|
||
|
DO_TEST("hostdev-usb-address", NONE);
|
||
|
DO_TEST("hostdev-pci-address", NONE);
|
||
|
DO_TEST("hostdev-vfio", NONE);
|
||
|
+ DO_TEST("hostdev-vfio-zpci",
|
||
|
+ QEMU_CAPS_DEVICE_ZPCI,
|
||
|
+ QEMU_CAPS_CCW);
|
||
|
DO_TEST("hostdev-mdev-precreated", NONE);
|
||
|
DO_TEST("hostdev-mdev-display", QEMU_CAPS_VFIO_PCI_DISPLAY);
|
||
|
DO_TEST("pci-rom", NONE);
|
||
|
--
|
||
|
2.22.0
|
||
|
|