On Mon, Mar 14, 2011 at 04:20:16PM -0400, Jean-Francois Dagenais wrote: > > On Mar 14, 2011, at 16:01, Greg KH wrote: > > > On Mon, Mar 14, 2011 at 02:48:59PM -0500, david.hagood@xxxxxxxxx wrote: > >> The problems I've had with rescan happen when the device IS detected on > >> the bus, but later has a change of resources - rescan won't reallocate the > >> needed resources. > >> > >> Example #1: An FPGA on the bus that contains a fixed PCIe core, which > >> presents an interface on BAR0 allowing the rest of the FPGA to be > >> programmed. Once programmed, the FPGA now has BAR0, BAR1, and BAR2. Doing > >> a rescan in this case WILL NOT allocate any kernel resources for BAR1 and > >> BAR2. > >> > >> Example #2: A Freescale CPU as a PCIe endpoint. The initial set up as > >> defined by the boot code defines BAR0, which gets scanned by the host > >> processor on PCI enumeration. Later, the PPC finishes booting its code, > >> and reprograms the endpoint, and now BAR1 and BAR2 are defined. Again, > >> doing a rescan on the host CPU does NOT reallocate the resources. > >> > >> And a few months ago, when I asked how to handle this case, I basically > >> was told "you are doing it wrong", with no input on how to do it "right". > > > > There is no "right" way to do this. > > > > Seriously, other operating systems have thought about doing this, but in > > the end, they never shipped a working implementation because it is very > > difficult to handle this type of resource change while the system is > > running. > > > > Your only hope is to disconnect the device, and add it back with the new > > resources changed. Unless you wish to work on changing the core PCI > > code to handle such a change. Those changes might be possible to make, > > but as everything works today, it will not. > > > Do you mean that lower level support for clearing up resources is necessary? > Isn't the "pci_remove_bus_device" function clearing up all that a bus > scan found and setup for a given device? Does/can this function > replace a physical disconnect with proper actual hotplug events (such > as expressCard)? > > I don't understand why the pci_bus_rescan() was able to find a > completely new device with BAR0 (we only have one BAR on our device), > and set it up, although the BIOS had never seen it. But if I > pci_remove_bus_device() it, then rescan again, are you saying that it > would re-use a ~profile~ of a past-life device that had only one BAR > and reuse that? ... does this only happen if the device was live > during BIOS enumeration? No, the issue is if you want to reassign resources _without_ removing the device from the system virtually, like you are. > I'm still good for my scenario right? Since my FPGA board power up a > vegetable, and the BIOS doesn't see it, when I trigger a PCI rescan > from userspace, I shouldn't get a half-functionning device with > missing resources right? Yes, you should be fine. thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html