I have a Xilinx FPGA PCIe end-point on the PCI Bus. Linux picks up the device just fine and everything in lspci looks perfect.
My question is about PCI access options from user-space and what would be good/bad.
Option 1: Direct access via /sys/.../resource0
(only one I have managed to make work so far)
I can open and mmap say /sys/bus/pci/devices/XXXX:XX:XX.X/resource0 then mmap that and read/write. Just need to fix permissions first. My question is, is this a good or bad approach? It feels like this might not be the preferred approach of accessing PCI address space?
Option 2: using uio_pci_generic
I've managed to configure my FPGA so that this driver actually connects, the fact that it requires interrupts is really annoying. And it seems this gives access to nothing accept interrupts and configuration memory space? This doesn't seem very useful to me? Am I missing something?
Option 3: Write my own uio driver
This might be a reasonable option perhaps? I'm not really sure how difficult this is. One possible advantage of this is that I might get access to DMA and therefore speed things up quite a bit.
Option 4: Write a completely custom linux PCI driver
I would like to avoid this option if possible
My question is about what is the best approach and what are the down sides specifically of option 1. Or are there any other approaches I should consider?
(I'm running debian with kernel 3.14.15 rt patched)