2

我有一个 FPGA 卡连接到 Linux 系统上的 PCIe。我可以对 FPGA 重新编程,然后echo 1 > /sys/bus/pci/rescan我的卡就会出现在lspci.

但是 BAR 区域没有分配任何内存:

Region 0: Memory at <unassigned> (64-bit, prefetchable) [disabled] [size=32M]
Region 2: Memory at <unassigned> (64-bit, prefetchable) [disabled] [size=64M]

pci=在 Linux 启动命令行上尝试了各种标志,但效果不大。

我怀疑 BAR 区域太大,因此 Linux 无法在地址空间中找到适当对齐的范围来映射 BAR,因为它们在启动时不存在。

这是一个正确的理论吗?是否可以告诉 Linux 为我的设备保留空间?

4

3 回答 3

1

I am seeing this too in Linux. There is an answer on the Xilinx forums at http://forums.xilinx.com/t5/PCI-Express/Incorrect-assignment-of-64bit-BAR-addresses/td-p/347577 - your memory spaces are smallish though. Try reducing the size until you get an allocation.

Most likely your BIOS does not allow such a big memory space BAR. Actually I have never seen a real PCIe device with more than 512MB mapped into memory space. Why would you want to do this? If you think to have a reason for that, check again whether your application really requires this amount of memory being always accessible at the same time or if you could also handle this with a paging mechanism.

Your suspicion is close but it is the BIOS that is allocating the regions, not linux. As I see it the root port is given a fixed chunk of memory, if you're asking for more than is free in that chunk then you go unallocated.

于 2014-09-15T21:23:10.130 回答
0

只是一个疯狂的猜测:当驱动程序第一次映射它们时,这些区域被分配了地址。

于 2014-06-25T11:55:20.187 回答
0

Tom Keddie 说,为设备分配地址区域的是 BIOS,而不是 linux 内核。我发现有时您需要重新启动 Linux 系统才能让它映射设备。根据您配置 FPGA 的方式,您可能需要为 FPGA 提供外部电源,以便在重启时不会清除其配置。

于 2014-09-22T15:17:26.867 回答