|
|
3e5111 |
From 0642cb0d5040df1e483752e15ba724fe04b3afca Mon Sep 17 00:00:00 2001
|
|
|
3e5111 |
Message-Id: <0642cb0d5040df1e483752e15ba724fe04b3afca@dist-git>
|
|
|
3e5111 |
From: Erik Skultety <eskultet@redhat.com>
|
|
|
3e5111 |
Date: Wed, 12 Apr 2017 13:07:14 +0200
|
|
|
3e5111 |
Subject: [PATCH] qemu: Fix mdev checking for VFIO support
|
|
|
3e5111 |
|
|
|
3e5111 |
Commit a4a39d90 added a check that checks for VFIO support with mediated
|
|
|
3e5111 |
devices. The problem is that the hostdev preparing functions behave like
|
|
|
3e5111 |
a fallthrough if device of that specific type doesn't exist. However,
|
|
|
3e5111 |
the check for VFIO support was independent of the existence of a mdev
|
|
|
3e5111 |
device which caused the guest to fail to start with any device to be
|
|
|
3e5111 |
directly assigned if VFIO was disabled/unavailable in the kernel.
|
|
|
3e5111 |
The proposed change first ensures that it makes sense to check for VFIO
|
|
|
3e5111 |
support in the first place, and only then performs the VFIO support check
|
|
|
3e5111 |
itself.
|
|
|
3e5111 |
|
|
|
3e5111 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1441291
|
|
|
3e5111 |
|
|
|
3e5111 |
(cherry picked from commit b4c2ac8d56124428d9329643a68625465094c5a7)
|
|
|
3e5111 |
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
|
|
3e5111 |
---
|
|
|
3e5111 |
src/qemu/qemu_hostdev.c | 17 +++++++++++++----
|
|
|
3e5111 |
1 file changed, 13 insertions(+), 4 deletions(-)
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
|
|
|
3e5111 |
index 685bf5b59..73d26f4c6 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_hostdev.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_hostdev.c
|
|
|
3e5111 |
@@ -330,11 +330,20 @@ qemuHostdevPrepareMediatedDevices(virQEMUDriverPtr driver,
|
|
|
3e5111 |
int nhostdevs)
|
|
|
3e5111 |
{
|
|
|
3e5111 |
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
|
|
|
3e5111 |
+ bool supportsVFIO = qemuHostdevHostSupportsPassthroughVFIO();
|
|
|
3e5111 |
+ size_t i;
|
|
|
3e5111 |
|
|
|
3e5111 |
- if (!qemuHostdevHostSupportsPassthroughVFIO()) {
|
|
|
3e5111 |
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
3e5111 |
- _("host doesn't support VFIO PCI interface"));
|
|
|
3e5111 |
- return -1;
|
|
|
3e5111 |
+ for (i = 0; i < nhostdevs; i++) {
|
|
|
3e5111 |
+ if (hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
|
|
3e5111 |
+ hostdevs[i]->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) {
|
|
|
3e5111 |
+ if (!supportsVFIO) {
|
|
|
3e5111 |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
3e5111 |
+ _("Mediated host device assignment requires "
|
|
|
3e5111 |
+ "VFIO support"));
|
|
|
3e5111 |
+ return -1;
|
|
|
3e5111 |
+ }
|
|
|
3e5111 |
+ break;
|
|
|
3e5111 |
+ }
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
return virHostdevPrepareMediatedDevices(hostdev_mgr, QEMU_DRIVER_NAME,
|
|
|
3e5111 |
--
|
|
|
3e5111 |
2.12.2
|
|
|
3e5111 |
|