Allocate write combined memory for BAR of a PCIe device and transfer data in bursts

Ankit Pradhan ap3188 at
Mon Jul 20 23:00:15 EDT 2015

Hello everyone

I want to be able to send 1-2KB of data from host, using BARs of a PCIe
device, with very low latency.

I am working on an FPGA project in which I have to send packet data from
Host to FPGA over PCIe 3.0 interface. This is a latency critical
application and therefore I want to use BARs to send data in bursts and not
use DMA because it has a lot of overhead.

I started out with the device driver provided to me by my FPGA board
vendor. That driver allocates 'uncached' memory for the BAR via mmap and
provides its virtual pointer to the user application for use. When I
initiate a transfer by dereferencing that pointer in my application and
observe the write signals that arrive at my FPGA using a logic analyzer. I
see all write requests arriving after constant time period and the burst
count signal is always 1. I have concluded that these transfers are not in

I modified the driver by using the ioremap_wc() on the physical address of
BAR and then passed the virtual pointer it returned to set_memory_wc()
(apparently I have to use both). I was able to get 'write combined' memory
for the physical BAR address. When I do writes using this pointer and
observe from logic analyzer I can see burst transfers. That is, I see 4
bursts of 5-6 write requests sent within a short time period.

The problem is that the pointer to this memory is a kernel virtual pointer.
I want to be able to do the above from user space. How can I do this?

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Kernelnewbies mailing list