[PATCH 3/5] qemu: hotplug: Verify that the selected pci passhtrough option is present

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

 



Use the checking functions to verify that the host supports PCI
passthrough before attempting it.
---
 src/qemu/qemu_hotplug.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 728c734..9320ab9 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1152,6 +1152,12 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,
             goto error;
         }

+        if (!qemuHostdevHostSupportsPassthroughVFIO()) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("host doesn't support VFIO PCI passthrough"));
+            goto error;
+        }
+
         /* VFIO requires all of the guest's memory to be locked resident.
          * In this case, the guest's memory may already be locked, but it
          * doesn't hurt to "change" the limit to the same value.
@@ -1166,6 +1172,14 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,

     case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
     case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM:
+        if (!qemuHostdevHostSupportsPassthroughLegacy()) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("host doesn't support legacy PCI passthrough"));
+            goto error;
+        }
+
+        break;
+
     case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
         break;
     }
-- 
1.8.3.2

--
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]