On Fri, 28 Nov 2008, Alex Chiang wrote: > I like this idea: > > Maybe we want a /sys/bus/pci/scan or > /sys/bus/pci/devices/scan file that we can echo > "0000:01:02.3" to scan just that function, or > "0000:01:02" to scan the device. > > Will that work for you, Trent? I don't think that's the best interface for it. If you want to know what bus number a SCSI bus was assigned, you can find that out from /proc/scsi. The SCSI ID is usually explicitly set by the user on the device. So if you want to add a scsi device, you should be able to know all the parts of the address. But PCI is different. If the PCI devices on your computer right now disappeared from Linux, would you know their IDs off the top of your head? I sure wouldn't. And how would you find them out? Suppose someone plugged an FPGA card into a sever PCI system with multiple busses and bridges. How would they ever guess what ID to scan? What function numbers might be present once the FPGA is programmed? I think a much more useful interface would be a "scan" file that will just trigger a rescan of everything. Even the users who know what ID to scan would probably rather not be bothered to be forced to specify. Maybe each PCI device could get a 'rescan' attribute that triggers a rescan of that device for new functions and recursively rescans any subordinate busses if it's a bridge? That might be useful too. But anyway, how about removing PCI devices. I see adding a "remove" attribute was mentioned. When I first had the problem with getting the FPGA re-scanned I was going to add something like that, but searching for what people with a similar problem has done turned up fakephp as the established interface. I've made a patch to add the remove attribute. It ends up not being that much code. fakephp is a lot more complex that it needs to be. However, fakephp does not like this! As I mentioned earlier, it can't handle something other than itself causing a PCI device to be removed. So I came up with a compatibility layer that creates directories in bus/pci/slots the same way fakephp used too. This layer _can_ handle devices being removed (and added!) by other means. It ends up being a lot simpler than fakephp too. It doesn't use hotplug at all and should be able to coexist with real hotplug drivers and fakephp. I'll followup with the patches. So far this only handles removal. I haven't done bus rescanning yet. -- 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