At 09/28/2011 03:47 PM, Osier Yang Write:
This patch is just like commit 2ce90ea296, to init the member of
pciDevice before reattachment, otherwise the device won't be unbound
from pci_stub, and won't get the original driver (no probing).
---
src/qemu/qemu_hostdev.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 6f77717..74c817c 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -292,6 +292,7 @@ void qemuDomainReAttachHostdevDevices(struct qemud_driver *driver,
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
pciDevice *dev = pciDeviceListGet(pcidevs, i);
+ pciDeviceReAttachInit(dev);
qemuReattachPciDevice(dev, driver);
}
The user runs 'virsh attach-device' to pass through host pci device to guest
os. We will call the function qemuPrepareHostdevPCIDevices() to bind the pci
device to pci-stub, and reset it. If the pci device does not support reset function,
we will call pciReAttachDevice() to rollback the things we have done.
If the device is alread bound to pci-stub before the user runs 'virsh
attach-device',
we should do nothing. If the device is not bound to any driver, we should
unbound it from pci-stub. If the device is bound to other driver, we should
unbound it from pci-stub, and reprobe it.
With your patch, we can not rollback the things we have done.
What problems do you meet?
Thanks
Wen Congyang.