I have an FPGA (Like most of the people asking this question) that gets configured after my Linux kernel does the initial PCIe bus scan and enumeration. As you can guess, the FPGA implements a PCIe endpoint.
I would Like to have the PCIe core re-enumerate the ENTIRE PCIe bus so that my FPGA will then show up and I can load my driver module. I would also like the ability to SWAP the FPGA load out for a different configuration. By this I mean I would like to be able to:
- Boot Linux
- Configure FPGA
- Enumerate PCIe endpoint and load module
- Remove PCIe endpoint
- Re-configure FPGA
- Re-enumerate PCIe endpoint
All without rebooting Linux
Here are solutions that have been proposed elsewhere but do not solve the problem.
echo 1 > /sys/bus/pci/rescan
This seems to work (only sometimes) and it does not work if I want to hotswap the FPGA load after it was first enumerated.
Can the Hotplug/power managment facilities of PCIe be used to make this work? If so is there any good resources for how to use the Hotplug system with PCIe? (LDD does not quite cover it thoroughly enough)
rescan
on the host machine or inside a Xen VM? Xen had problem to rescan the PCIe tree and crashed in the past. I don't know if it is solved. – Unbalancerescan
method rarely worked. I went the partial reconfiguration route to solve the problem (by not reenumerating). @Unbalance @Gaullist can you share your setup ? – Cleary