mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
reattach pci devices when qemuPrepareHostdevPCIDevices() failed
Reattach all pci devices that we detached when qemuPrepareHostdevPCIDevices() failed.
This commit is contained in:
parent
4e8969ebcf
commit
a4efb2e335
@ -127,11 +127,11 @@ int qemuPrepareHostdevPCIDevices(struct qemud_driver *driver,
|
||||
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
|
||||
pciDevice *dev = pciDeviceListGet(pcidevs, i);
|
||||
if (!pciDeviceIsAssignable(dev, !driver->relaxedACS))
|
||||
goto cleanup;
|
||||
goto reattachdevs;
|
||||
|
||||
if (pciDeviceGetManaged(dev) &&
|
||||
pciDettachDevice(dev, driver->activePciHostdevs) < 0)
|
||||
goto cleanup;
|
||||
goto reattachdevs;
|
||||
}
|
||||
|
||||
/* Now that all the PCI hostdevs have be dettached, we can safely
|
||||
@ -139,7 +139,7 @@ int qemuPrepareHostdevPCIDevices(struct qemud_driver *driver,
|
||||
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
|
||||
pciDevice *dev = pciDeviceListGet(pcidevs, i);
|
||||
if (pciResetDevice(dev, driver->activePciHostdevs, pcidevs) < 0)
|
||||
goto cleanup;
|
||||
goto reattachdevs;
|
||||
}
|
||||
|
||||
/* Now mark all the devices as active */
|
||||
@ -169,6 +169,12 @@ inactivedevs:
|
||||
pciDeviceListSteal(driver->activePciHostdevs, dev);
|
||||
}
|
||||
|
||||
reattachdevs:
|
||||
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
|
||||
pciDevice *dev = pciDeviceListGet(pcidevs, i);
|
||||
pciReAttachDevice(dev, driver->activePciHostdevs);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
pciDeviceListFree(pcidevs);
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user