1
votes

I am working on a project where I need to access a FPGA memory through PCI BAR0 from userspace.

What I used to do in older kernels is open the file named resource0 which is located in /sys/bus/pci/devices/my_device/ and then use the mmap() function which exposes the FPGA memory to the userspace.

Unfortunately, in kernel version 4.7 (architecture ARM64) it seems that for some reason resource0 file is not created.

When I use the lspci I can see that the system recognizes the PCI BARs of the FPGA. In addition, when I search the /sys/bus/pci/devices/my_device/ directory I can see that there is a file named resource which has among others the addresses of the PCI BARs written in it.

Is anyone familiar with a similar situation? How can I make linux create the resource0 file?

1
Probably your older kernels were 32 bit?Roman Khimov

1 Answers

3
votes

I understand your concern, you can try this out of Tree patch which was not accepted upstream.

https://patchwork.codeaurora.org/patch/2059/

http://lists.infradead.org/pipermail/linux-arm-kernel/2015-July/359435.html

It would help you to map PCI resource file in user space.