diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4a430ddfbac059e69047afed1981f638340f183a..373ebd6d1a9244f83c0c0b6d34f780fe78f83d79 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5375,6 +5375,7 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
return virBufferContentAndReset(&buf);
}
+
char *
qemuBuildHostdevMediatedDevStr(const virDomainDef *def,
virDomainHostdevDefPtr dev,
@@ -5403,6 +5404,9 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def,
if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0)
return NULL;
+ if (dev->info->bootIndex)
+ virBufferAsprintf(&buf, ",bootindex=%u", dev->info->bootIndex);
+
if (virBufferCheckError(&buf) < 0)
return NULL;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 581b48bcf741425f9ada720a8b4f20467891fd0e..4998474dc91a955bb06ebc5a1d611d642a2c181a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5196,6 +5196,15 @@ qemuDomainMdevDefVFIOPCIValidate(const virDomainHostdevDef *hostdev,
{
const virDomainHostdevSubsysMediatedDev *dev;
+ /* VFIO-PCI does not support boot */
+ if (hostdev->info->bootIndex) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("booting from assigned devices is not "
+ "supported by mediated devices of "
+ "model vfio-pci"));
+ return -1;
+ }
+
dev = &hostdev->source.subsys.u.mdev;
if (dev->display == VIR_TRISTATE_SWITCH_ABSENT)
return 0;
@@ -5229,12 +5238,21 @@ qemuDomainMdevDefVFIOPCIValidate(const virDomainHostdevDef *hostdev,
static int
-qemuDomainMdevDefVFIOAPValidate(const virDomainHostdevDef *hostdev ATTRIBUTE_UNUSED,
+qemuDomainMdevDefVFIOAPValidate(const virDomainHostdevDef *hostdev,
const virDomainDef *def)
{
size_t i;
bool vfioap_found = false;
+ /* VFIO-AP does not support boot */
+ if (hostdev->info->bootIndex) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("booting from assigned devices is not "
+ "supported by mediated devices of "
+ "model vfio-ap"));
+ return -1;
+ }
+
/* VFIO-AP is restricted to a single mediated device only */
for (i = 0; i < def->nhostdevs; i++) {
virDomainHostdevDefPtr hdev = def->hostdevs[i];
@@ -5310,12 +5328,6 @@ qemuDomainDeviceDefValidateHostdev(const virDomainHostdevDef *hostdev,
}
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
- if (hostdev->info->bootIndex) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("booting from assigned devices is not "
- "supported by mediated devices"));
- return -1;
- }
return qemuDomainMdevDefValidate(hostdev, def, qemuCaps);
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
default:
diff --git a/tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boot.s390x-latest.args b/tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boot.s390x-latest.args
new file mode 100644
index 0000000000000000000000000000000000000000..aef2eb37fc9466a8c0665c753cc5aff80122b7dd
--- /dev/null
+++ b/tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boot.s390x-latest.args
@@ -0,0 +1,34 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine s390-ccw-virtio,accel=tcg,usb=off,dump-guest-core=off \
+-m 512 \
+-overcommit mem-lock=off \
+-smp 2,sockets=2,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-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 \
+-boot strict=on \
+-device vfio-ccw,id=hostdev0,\
+sysfsdev=/sys/bus/mdev/devices/90c6c135-ad44-41d0-b1b7-bae47de48627,\
+devno=fe.0.0000,bootindex=1 \
+-device virtio-balloon-ccw,id=balloon0,devno=fe.0.0001 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boot.xml b/tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boot.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6cca13c33f85c5f8484e0bcc6e69e12419362ff4
--- /dev/null
+++ b/tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boot.xml
@@ -0,0 +1,23 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 524288
+ 524288
+ 2
+
+ hvm
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-s390x
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 59be85613e13d96738f4c7032a0301ced2eacc11..9395cc19a2a553c2d6ac28dfeecd2f83c1cd1245 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1625,6 +1625,8 @@ mymain(void)
QEMU_CAPS_CCW,
QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
QEMU_CAPS_DEVICE_VFIO_CCW);
+ DO_TEST_CAPS_ARCH_LATEST("hostdev-subsys-mdev-vfio-ccw-boot",
+ "s390x");
DO_TEST_FAILURE("hostdev-subsys-mdev-vfio-ccw",
QEMU_CAPS_CCW,
QEMU_CAPS_CCW_CSSID_UNRESTRICTED);
diff --git a/tests/qemuxml2xmloutdata/hostdev-subsys-mdev-vfio-ccw-boot.s390x-latest.xml b/tests/qemuxml2xmloutdata/hostdev-subsys-mdev-vfio-ccw-boot.s390x-latest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..68defea44cece873d007cebdebdb250e4216e08c
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/hostdev-subsys-mdev-vfio-ccw-boot.s390x-latest.xml
@@ -0,0 +1,29 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 524288
+ 524288
+ 2
+
+ hvm
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-s390x
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 93ead52d9a4931a636461e7342f29d46f3d0ca5d..5f6a3618cdd91131f999a8e6bf9eb3aaa20743b4 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -959,6 +959,8 @@ mymain(void)
QEMU_CAPS_CCW,
QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
QEMU_CAPS_DEVICE_VFIO_CCW);
+ DO_TEST_CAPS_ARCH_LATEST("hostdev-subsys-mdev-vfio-ccw-boot",
+ "s390x");
DO_TEST("hostdev-subsys-mdev-vfio-ap",
QEMU_CAPS_CCW,
QEMU_CAPS_CCW_CSSID_UNRESTRICTED,