pci: initialize state values on reattach

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()
This commit is contained in:
Guannan Ren 2011-07-03 20:09:44 +08:00 committed by Eric Blake
parent 0c97dc4159
commit 416814e66a
5 changed files with 13 additions and 0 deletions

View File

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

View File

@ -801,6 +801,7 @@ pciDeviceListFree;
pciDeviceListGet;
pciDeviceListNew;
pciDeviceListSteal;
pciDeviceReAttachInit;
pciDeviceSetManaged;
pciFreeDevice;
pciGetDevice;

View File

@ -7197,6 +7197,8 @@ qemudNodeDeviceReAttach (virNodeDevicePtr dev)
if (!pci)
return -1;
pciDeviceReAttachInit(pci);
qemuDriverLock(driver);
if (pciReAttachDevice(pci, driver->activePciHostdevs) < 0)
goto out;

View 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)
{

View 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);