}
virPCIDeviceSetManaged(dev, hostdev->managed);
+ if (hostdev->source.subsys.u.pci.backend
+ == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_VFIO) {
+ virPCIDeviceSetStubDriver(dev, "vfio-pci");
+ } else {
+ virPCIDeviceSetStubDriver(dev, "pci-stub");
+ }
}
return list;
goto cleanup;
virPCIDeviceSetManaged(dev, hostdev->managed);
+ if (hostdev->source.subsys.u.pci.backend
+ == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_VFIO) {
+ virPCIDeviceSetStubDriver(dev, "vfio-pci");
+ } else {
+ virPCIDeviceSetStubDriver(dev, "pci-stub");
+ }
virPCIDeviceSetUsedBy(dev, def->name);
/* Setup the original states for the PCI device */
}
}
- /* Loop 2: detach managed devices */
+ /* Loop 2: detach managed devices (i.e. bind to appropriate stub driver) */
for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
if (virPCIDeviceGetManaged(dev) &&
- virPCIDeviceDetach(dev, driver->activePciHostdevs, NULL, "pci-stub") < 0)
+ virPCIDeviceDetach(dev, driver->activePciHostdevs, NULL, NULL) < 0)
goto reattachdevs;
}
reattachdevs:
for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
- virPCIDeviceReattach(dev, driver->activePciHostdevs, NULL, "pci-stub");
+
+ /* NB: This doesn't actually re-bind to original driver, just
+ * unbinds from the stub driver
+ */
+ virPCIDeviceReattach(dev, driver->activePciHostdevs, NULL, NULL);
}
cleanup: