提交 416814e6 编写于 作者: G Guannan Ren 提交者: Eric Blake

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()
上级 0c97dc41
...@@ -180,6 +180,7 @@ Patches have also been contributed by: ...@@ -180,6 +180,7 @@ Patches have also been contributed by:
David S. Wang <dwang2@cisco.com> David S. Wang <dwang2@cisco.com>
Ruben Kerkhof <ruben@rubenkerkhof.com> Ruben Kerkhof <ruben@rubenkerkhof.com>
Scott Moser <smoser@ubuntu.com> Scott Moser <smoser@ubuntu.com>
Guannan Ren <gren@redhat.com>
[....send patches to get your name here....] [....send patches to get your name here....]
......
...@@ -801,6 +801,7 @@ pciDeviceListFree; ...@@ -801,6 +801,7 @@ pciDeviceListFree;
pciDeviceListGet; pciDeviceListGet;
pciDeviceListNew; pciDeviceListNew;
pciDeviceListSteal; pciDeviceListSteal;
pciDeviceReAttachInit;
pciDeviceSetManaged; pciDeviceSetManaged;
pciFreeDevice; pciFreeDevice;
pciGetDevice; pciGetDevice;
......
...@@ -7197,6 +7197,8 @@ qemudNodeDeviceReAttach (virNodeDevicePtr dev) ...@@ -7197,6 +7197,8 @@ qemudNodeDeviceReAttach (virNodeDevicePtr dev)
if (!pci) if (!pci)
return -1; return -1;
pciDeviceReAttachInit(pci);
qemuDriverLock(driver); qemuDriverLock(driver);
if (pciReAttachDevice(pci, driver->activePciHostdevs) < 0) if (pciReAttachDevice(pci, driver->activePciHostdevs) < 0)
goto out; goto out;
......
...@@ -1382,6 +1382,14 @@ unsigned pciDeviceGetManaged(pciDevice *dev) ...@@ -1382,6 +1382,14 @@ unsigned pciDeviceGetManaged(pciDevice *dev)
return dev->managed; return dev->managed;
} }
void pciDeviceReAttachInit(pciDevice *pci)
{
pci->unbind_from_stub = 1;
pci->remove_slot = 1;
pci->reprobe = 1;
}
pciDeviceList * pciDeviceList *
pciDeviceListNew(void) pciDeviceListNew(void)
{ {
......
...@@ -40,6 +40,7 @@ int pciResetDevice (pciDevice *dev, ...@@ -40,6 +40,7 @@ int pciResetDevice (pciDevice *dev,
void pciDeviceSetManaged(pciDevice *dev, void pciDeviceSetManaged(pciDevice *dev,
unsigned managed); unsigned managed);
unsigned pciDeviceGetManaged(pciDevice *dev); unsigned pciDeviceGetManaged(pciDevice *dev);
void pciDeviceReAttachInit(pciDevice *dev);
pciDeviceList *pciDeviceListNew (void); pciDeviceList *pciDeviceListNew (void);
void pciDeviceListFree (pciDeviceList *list); void pciDeviceListFree (pciDeviceList *list);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册