|
|
edecca |
From 680d10a61dfab864b5e1bca9e1f197ae06e62d87 Mon Sep 17 00:00:00 2001
|
|
|
edecca |
Message-Id: <680d10a61dfab864b5e1bca9e1f197ae06e62d87@dist-git>
|
|
|
edecca |
From: Erik Skultety <eskultet@redhat.com>
|
|
|
edecca |
Date: Fri, 30 Nov 2018 15:49:26 +0100
|
|
|
edecca |
Subject: [PATCH] conf: Move VFIO AP validation from post parse to QEMU
|
|
|
edecca |
validation code
|
|
|
edecca |
|
|
|
edecca |
VFIO AP has a limitation on a single device per domain, however, when
|
|
|
edecca |
commit 11708641 added the support for vfio-ap, check for this limitation
|
|
|
edecca |
was performed as part of the post parse code. Generally, checks like that
|
|
|
edecca |
should be performed within the driver's validation callback to eliminate
|
|
|
edecca |
any slight chance of failing in post parse, which could potentially
|
|
|
edecca |
result in the domain XML config vanishing.
|
|
|
edecca |
|
|
|
edecca |
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
|
|
edecca |
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
|
|
edecca |
(cherry picked from commit 25dde373730545894f60ce5b1497f19d61714c69)
|
|
|
edecca |
|
|
|
edecca |
https://bugzilla.redhat.com/show_bug.cgi?id=1508146
|
|
|
edecca |
|
|
|
edecca |
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
|
|
|
edecca |
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
edecca |
---
|
|
|
edecca |
src/conf/domain_conf.c | 28 ----------------------------
|
|
|
edecca |
src/qemu/qemu_domain.c | 28 +++++++++++++++++++++++++++-
|
|
|
edecca |
2 files changed, 27 insertions(+), 29 deletions(-)
|
|
|
edecca |
|
|
|
edecca |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
edecca |
index ea7152eb94..e013e9f0c5 100644
|
|
|
edecca |
--- a/src/conf/domain_conf.c
|
|
|
edecca |
+++ b/src/conf/domain_conf.c
|
|
|
edecca |
@@ -4325,31 +4325,6 @@ virDomainDefPostParseGraphics(virDomainDef *def)
|
|
|
edecca |
}
|
|
|
edecca |
|
|
|
edecca |
|
|
|
edecca |
-static int
|
|
|
edecca |
-virDomainDefPostParseHostdev(virDomainDefPtr def)
|
|
|
edecca |
-{
|
|
|
edecca |
- size_t i;
|
|
|
edecca |
- bool vfioap_found = false;
|
|
|
edecca |
-
|
|
|
edecca |
- /* verify settings of hostdevs vfio-ap */
|
|
|
edecca |
- for (i = 0; i < def->nhostdevs; i++) {
|
|
|
edecca |
- virDomainHostdevDefPtr hostdev = def->hostdevs[i];
|
|
|
edecca |
-
|
|
|
edecca |
- if (virHostdevIsMdevDevice(hostdev) &&
|
|
|
edecca |
- hostdev->source.subsys.u.mdev.model == VIR_MDEV_MODEL_TYPE_VFIO_AP) {
|
|
|
edecca |
- if (vfioap_found) {
|
|
|
edecca |
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
edecca |
- _("Only one hostdev of model vfio-ap is "
|
|
|
edecca |
- "supported"));
|
|
|
edecca |
- return -1;
|
|
|
edecca |
- }
|
|
|
edecca |
- vfioap_found = true;
|
|
|
edecca |
- }
|
|
|
edecca |
- }
|
|
|
edecca |
- return 0;
|
|
|
edecca |
-}
|
|
|
edecca |
-
|
|
|
edecca |
-
|
|
|
edecca |
/**
|
|
|
edecca |
* virDomainDriveAddressIsUsedByDisk:
|
|
|
edecca |
* @def: domain definition containing the disks to check
|
|
|
edecca |
@@ -5262,9 +5237,6 @@ virDomainDefPostParseCommon(virDomainDefPtr def,
|
|
|
edecca |
|
|
|
edecca |
virDomainDefPostParseGraphics(def);
|
|
|
edecca |
|
|
|
edecca |
- if (virDomainDefPostParseHostdev(def) < 0)
|
|
|
edecca |
- return -1;
|
|
|
edecca |
-
|
|
|
edecca |
if (virDomainDefPostParseCPU(def) < 0)
|
|
|
edecca |
return -1;
|
|
|
edecca |
|
|
|
edecca |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
edecca |
index 4898d58733..08f479fa1d 100644
|
|
|
edecca |
--- a/src/qemu/qemu_domain.c
|
|
|
edecca |
+++ b/src/qemu/qemu_domain.c
|
|
|
edecca |
@@ -4486,6 +4486,32 @@ qemuDomainMdevDefVFIOPCIValidate(const virDomainHostdevSubsysMediatedDev *dev,
|
|
|
edecca |
}
|
|
|
edecca |
|
|
|
edecca |
|
|
|
edecca |
+static int
|
|
|
edecca |
+qemuDomainMdevDefVFIOAPValidate(const virDomainDef *def)
|
|
|
edecca |
+{
|
|
|
edecca |
+ size_t i;
|
|
|
edecca |
+ bool vfioap_found = false;
|
|
|
edecca |
+
|
|
|
edecca |
+ /* VFIO-AP is restricted to a single mediated device only */
|
|
|
edecca |
+ for (i = 0; i < def->nhostdevs; i++) {
|
|
|
edecca |
+ virDomainHostdevDefPtr hostdev = def->hostdevs[i];
|
|
|
edecca |
+
|
|
|
edecca |
+ if (virHostdevIsMdevDevice(hostdev) &&
|
|
|
edecca |
+ hostdev->source.subsys.u.mdev.model == VIR_MDEV_MODEL_TYPE_VFIO_AP) {
|
|
|
edecca |
+ if (vfioap_found) {
|
|
|
edecca |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
edecca |
+ _("Only one hostdev of model vfio-ap is "
|
|
|
edecca |
+ "supported"));
|
|
|
edecca |
+ return -1;
|
|
|
edecca |
+ }
|
|
|
edecca |
+ vfioap_found = true;
|
|
|
edecca |
+ }
|
|
|
edecca |
+ }
|
|
|
edecca |
+
|
|
|
edecca |
+ return 0;
|
|
|
edecca |
+}
|
|
|
edecca |
+
|
|
|
edecca |
+
|
|
|
edecca |
static int
|
|
|
edecca |
qemuDomainMdevDefValidate(const virDomainHostdevSubsysMediatedDev *mdevsrc,
|
|
|
edecca |
const virDomainDef *def,
|
|
|
edecca |
@@ -4495,7 +4521,7 @@ qemuDomainMdevDefValidate(const virDomainHostdevSubsysMediatedDev *mdevsrc,
|
|
|
edecca |
case VIR_MDEV_MODEL_TYPE_VFIO_PCI:
|
|
|
edecca |
return qemuDomainMdevDefVFIOPCIValidate(mdevsrc, def, qemuCaps);
|
|
|
edecca |
case VIR_MDEV_MODEL_TYPE_VFIO_AP:
|
|
|
edecca |
- break;
|
|
|
edecca |
+ return qemuDomainMdevDefVFIOAPValidate(def);
|
|
|
edecca |
case VIR_MDEV_MODEL_TYPE_VFIO_CCW:
|
|
|
edecca |
break;
|
|
|
edecca |
case VIR_MDEV_MODEL_TYPE_LAST:
|
|
|
edecca |
--
|
|
|
edecca |
2.19.2
|
|
|
edecca |
|