qemu: Prefer VFIO for PCI device passthrough

Prefer using VFIO (if available) to the legacy KVM device passthrough.

With this patch a PCI passthrough device without the driver configured
will be started with VFIO if it's available on the host. If not legacy
KVM passthrough is checked and error is reported if it's not available.
This commit is contained in:
Peter Krempa committed 2013-10-10 12:00:56 +02:00
1 parent 467b561ac2
commit f094aaac48
9 files changed
+61 -25

No files matched your search

+11
View File
@@ -98,6 +98,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
virConnectPtr conn;
char *log = NULL;
virCommandPtr cmd = NULL;
size_t i;
if (!(conn = virGetConnect()))
goto out;
@@ -154,6 +155,16 @@ static int testCompareXMLToArgvFiles(const char *xml,
if (qemuAssignDeviceAliases(vmdef, extraFlags) < 0)
goto out;
for (i = 0; i < vmdef->nhostdevs; i++) {
virDomainHostdevDefPtr hostdev = vmdef->hostdevs[i];
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
hostdev->source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
hostdev->source.subsys.u.pci.backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM;
}
}
if (!(cmd = qemuBuildCommandLine(conn, &driver, vmdef, &monitor_chr,
(flags & FLAG_JSON), extraFlags,
migrateFrom, migrateFd, NULL,