]> xenbits.xensource.com Git - libvirt.git/commitdiff
pci: initialize state values on reattach
authorGuannan Ren <gren@redhat.com>
Sun, 3 Jul 2011 12:09:44 +0000 (20:09 +0800)
committerEric Blake <eblake@redhat.com>
Tue, 5 Jul 2011 17:42:38 +0000 (11:42 -0600)
add a new API pciDeviceReAttachInit() in pci.c to initialize state values for nodedev reattach

Initialize three state value of device driver to 1. This is just for a new call to
qemudNodeDeviceReAttach()

AUTHORS
src/libvirt_private.syms
src/qemu/qemu_driver.c
src/util/pci.c
src/util/pci.h

diff --git a/AUTHORS b/AUTHORS
index 074dace720e6019d1c46348b55c081829643adcb..2919249a54891c92a801ab071727db7cd3a2698c 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -180,6 +180,7 @@ Patches have also been contributed by:
   David S. Wang        <dwang2@cisco.com>
   Ruben Kerkhof        <ruben@rubenkerkhof.com>
   Scott Moser          <smoser@ubuntu.com>
+  Guannan Ren          <gren@redhat.com>
 
   [....send patches to get your name here....]
 
index 626ac6ccf80a77d7017cf547a9663e173dfa37a2..ae0d1995167fb183738f8f3077e5cfa4147310f2 100644 (file)
@@ -801,6 +801,7 @@ pciDeviceListFree;
 pciDeviceListGet;
 pciDeviceListNew;
 pciDeviceListSteal;
+pciDeviceReAttachInit;
 pciDeviceSetManaged;
 pciFreeDevice;
 pciGetDevice;
index 5d61f0ad1f45efe00dbb2213bdb6d064c765f075..cd43bf7de4c868e3775a877025ed4eaf1ed58266 100644 (file)
@@ -7197,6 +7197,8 @@ qemudNodeDeviceReAttach (virNodeDevicePtr dev)
     if (!pci)
         return -1;
 
+    pciDeviceReAttachInit(pci);
+
     qemuDriverLock(driver);
     if (pciReAttachDevice(pci, driver->activePciHostdevs) < 0)
         goto out;
index 21c12b97b2bd9266fef6195a2eac4555fa99b293..e3f978c54762b4a72bb31090b2b6087f08d6d47a 100644 (file)
@@ -1382,6 +1382,14 @@ unsigned pciDeviceGetManaged(pciDevice *dev)
     return dev->managed;
 }
 
+void pciDeviceReAttachInit(pciDevice *pci)
+{
+    pci->unbind_from_stub = 1;
+    pci->remove_slot = 1;
+    pci->reprobe = 1;
+}
+
+
 pciDeviceList *
 pciDeviceListNew(void)
 {
index b767930bbccecd7bde26248f33e74cc65369c7ac..a351baf028e9c4814bfb01b636b87fe8211fa865 100644 (file)
@@ -40,6 +40,7 @@ int        pciResetDevice    (pciDevice     *dev,
 void      pciDeviceSetManaged(pciDevice     *dev,
                               unsigned       managed);
 unsigned  pciDeviceGetManaged(pciDevice     *dev);
+void      pciDeviceReAttachInit(pciDevice   *dev);
 
 pciDeviceList *pciDeviceListNew  (void);
 void           pciDeviceListFree (pciDeviceList *list);