I have a PC as a root complex and Xilinx fpga device as an end point that writes via PCI Express to root complex RAM using DMA and a linux driver to it. I have a problem that I can't solve in any way. For some reason, when allocating memory from user space, I have a problem with the write response in the AXI Memory Mapped to PCI Express module.
For example, during the execution of this code, my recording PCI via dma is constantly paused.
const int numAllocations = 10000;
for(int i = 0; i < 1000000; ++i) {
std::vector<Dummy*> allocations;
for (int i = 0; i < numAllocations; ++i) {
Dummy* ptr = new Dummy();
allocations.push_back(ptr);
}
I get the addresses that I give to the fpga in the driver using the function:
fdev->dma.buffers_kernel[i] = dmam_alloc_coherent(
&pdev->dev,
fdev->dma.buffer_size,
&fdev->dma.buffers_device[i],
GFP_KERNEL);
I have already tried to disable IOMMU in the OS and in the BIOS, but it did not help. Someone can explain why this is happening. After all, there should be plenty of RAM and PCI speeds. I think the problem has something to do with the server RAM memory.
ioctlcalls, have the driver do the [internal]mmapequivalent. It can set up a userspace mapping that a simplemmapcan't. It can disable caching on the memory range, etc. Because the driver knows the most about the device, it can do whatever is necessary to facilitate whatever the userspace app needs (e.g.) map the device into kernel address space, map device buffer(s) to userspace app, map the device to CPU memory (if needed), etc. Also, I'd avoidstd::vectoret. al. at least at first.