[PATCH v14 17/49] rename qemuReAttachPciDevice to virHostdevReAttachPciDevice

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

 



Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx>
---
 src/qemu/qemu_hostdev.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 5fa6eb4..2dfe252 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -1254,10 +1254,8 @@ qemuPrepareHostDevices(virQEMUDriverPtr driver,
  * are locked
  */
 static void
-qemuReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
+virHostdevReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
 {
-    int retries = 100;
-
     /* If the device is not managed and was attached to guest
      * successfully, it must have been inactive.
      */
@@ -1267,10 +1265,14 @@ qemuReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
         return;
     }
 
-    while (virPCIDeviceWaitForCleanup(dev, "kvm_assigned_device")
-           && retries) {
-        usleep(100*1000);
-        retries--;
+    /* Wait for device cleanup if it is qemu/kvm */
+    if (STREQ(virPCIDeviceGetStubDriver(dev), "pci-stub")) {
+        int retries = 100;
+        while (virPCIDeviceWaitForCleanup(dev, "kvm_assigned_device")
+               && retries) {
+            usleep(100*1000);
+            retries--;
+        }
     }
 
     if (virPCIDeviceReattach(dev, mgr->activePciHostdevs,
@@ -1363,7 +1365,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
 
     while (virPCIDeviceListCount(pcidevs) > 0) {
         virPCIDevicePtr dev = virPCIDeviceListStealIndex(pcidevs, 0);
-        qemuReattachPciDevice(dev, hostdev_mgr);
+        virHostdevReattachPciDevice(dev, hostdev_mgr);
     }
 
     virObjectUnref(pcidevs);
-- 
1.9.0

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