[PATCH 2/2] qemu: hostdev: Don't error out on domain with an mdev when IOMMU is off

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit b4c2ac8d56 made a false assumption that IOMMU support necessary
for an mdev device to be assigned to a VM. Unlike direct PCI assignment,
IOMMU support is not needed for mediated devices, as the physical parent
device provides the IOMMU isolation, therefore, simply checking for VFIO
presence is enough to successfully start a VM.
Luckily, this issue is not very serious, since as of yet, libvirt
mandates the mdevs to be pre-created prior to a domain's launch, so this
patch will merely change the error the end user is going to see.

Previously:
unsupported configuration: Mediated host device assignment requires VFIO
support

Now:
failed to read device '/sys/bus/mdev/devices/<uuid>/': No such file or
directory

Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
 src/qemu/qemu_hostdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 73d26f4c6..afe445d4e 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -330,9 +330,14 @@ qemuHostdevPrepareMediatedDevices(virQEMUDriverPtr driver,
                                   int nhostdevs)
 {
     virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
-    bool supportsVFIO = qemuHostdevHostSupportsPassthroughVFIO();
+    bool supportsVFIO;
     size_t i;

+    /* Checking for VFIO only is fine with mdev, as IOMMU isolation is achieved
+     * by the physical parent device.
+     */
+    supportsVFIO = virFileExists("/dev/vfio/vfio");
+
     for (i = 0; i < nhostdevs; i++) {
         if (hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
             hostdevs[i]->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) {
--
2.13.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux