qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] About hotplug multifunction


From: Amos Kong
Subject: Re: [Qemu-devel] About hotplug multifunction
Date: Tue, 13 Sep 2011 08:23:29 -0400 (EDT)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]