Re: About hotplug multifunction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

After reading the pci driver code, I found a problem.

There is a list for each slot, (slot->funcs)
it will be inited in acpiphp_glue.c:register_slot() before hotpluging device,
and only one entry(func 0) will be added to it,
no new entry will be added to the list when hotpluging devices to the slot.

When we release the device, there are only _one_ entry in the list(slot->funcs).

acpiphp_glue.c:disable_device()
list_for_each_entry(func, &slot->funcs, sibling) {
    pdev = pci_get_slot(slot->bridge->pci_bus,
                        PCI_DEVFN(slot->device, func->function));
    ...release code...  // those code can only be executed one time (func 0)
    pci_remove_bus_device(pdev);
}

bus.c:pci_bus_add_device() is called for each func device in acpiphp_glue.c:enable_device().
bus.c:pci_remove_bus_device(pdev) is only called for func 0 in acpiphp_glue.c:disable_device().


Resolution: (I've tested it, success)
enumerate all the funcs when disable device.

list_for_each_entry(func, &slot->funcs, sibling) {
    for (i=0; i<8; i++) {
        pdev = pci_get_slot(slot->bridge->pci_bus,
                            PCI_DEVFN(slot->device, i));
        ...release code...
        pci_remove_bus_device(pdev);

    }
}

Thanks,
Amos
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux