enjoy-digital / litepcie

Small footprint and configurable PCIe core
Other
468 stars 116 forks source link

Check PCIe bus rescan after loading bitstream. #36

Open enjoy-digital opened 4 years ago

enjoy-digital commented 4 years ago

It seems to be possible: https://stackoverflow.com/questions/32334870/how-to-do-a-true-rescan-of-pcie-bus but hasn't been tested.

zyp commented 4 years ago

I've been doing this with the CLE-215+, works for me.

enjoy-digital commented 4 years ago

@zyp thanks, indeed i also just tested it successfully on Ubuntu 18.04:

echo 1 | sudo tee /sys/bus/pci/devices/0000\:02\:00.0/remove
echo 1 | sudo tee /sys/bus/pci/rescan
racerxdl commented 3 years ago

@enjoy-digital I don't think it works on all machines though. Here the BAR doesn't get remmaped if I don't reboot. The device correctly get removed and when I issue rescan, they show up again, but it can't be used.

Here is a HP Server that I'm using to test it.

smunaut commented 2 years ago

In case anyone is still looking for such info : doing a remove on the root bridge corresponding to that PCIe slot and then doing a rescan often works better because it forces reconfiguration of the memory zones being mapped / enabled through it.

racerxdl commented 2 years ago

Just confirmed that it does work issuing a remove in root bridge as @smunaut pointed out.

Just need to be carefull for Allocated BAR size, which kernel doesnt always find a place to fit it. But it does correctly accept a new device.