• O
    qemu: Introduce inactive PCI device list · 6be610bf
    Osier Yang 提交于
    pciTrySecondaryBusReset checks if there is active device on the
    same bus, however, qemu driver doesn't maintain an effective
    list for the inactive devices, and it passes meaningless argument
    for parameter "inactiveDevs". e.g. (qemuPrepareHostdevPCIDevices)
    
    if (!(pcidevs = qemuGetPciHostDeviceList(hostdevs, nhostdevs)))
        return -1;
    
    ..skipped...
    
    if (pciResetDevice(dev, driver->activePciHostdevs, pcidevs) < 0)
        goto reattachdevs;
    
    NB, the "pcidevs" used above are extracted from domain def, and
    thus one won't be able to attach a device of which bus has other
    device even detached from host (nodedev-detach). To see more
    details of the problem:
    
    RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=773667
    
    This patch is to resolve the problem by introducing an inactive
    PCI device list (just like qemu_driver->activePciHostdevs), and
    the whole logic is:
    
      * Add the device to inactive list during nodedev-dettach
      * Remove the device from inactive list during nodedev-reattach
      * Remove the device from inactive list during attach-device
        (for non-managed device)
      * Add the device to inactive list after detach-device, only
        if the device is not managed
    
    With the above, we have a sufficient inactive PCI device list, and thus
    we can use it for pciResetDevice. e.g.(qemuPrepareHostdevPCIDevices)
    
    if (pciResetDevice(dev, driver->activePciHostdevs,
                       driver->inactivePciHostdevs) < 0)
        goto reattachdevs;
    6be610bf
qemu_hotplug.c 77.9 KB