dma_ip_drivers icon indicating copy to clipboard operation
dma_ip_drivers copied to clipboard

Does the driver support direct DMA writes into userspace memory

Open geiliwanghaichao opened this issue 3 months ago • 3 comments

"I want the userspace program to be able to directly specify the DMA target address to avoid data copying from read()/write()." "Does the driver support direct DMA writes into userspace memory (hundreds of megabytes to gigabytes) instead of kernel buffers?"

geiliwanghaichao avatar Sep 15 '25 07:09 geiliwanghaichao

The driver support this when read/write from/to a axi mem interface. It does not support it when read/write from/to a axi stream interface. I already modified it to use the "mem" part of the driver even when using a "stream" interface. This is a very small change. It work and improve performance.

Also, DrvDMA is a third partie driver supporting XDMA in a very efficient way. https://www.kms-quebec.com/Cards/0066_fr.pdf

martindubois avatar Sep 15 '25 12:09 martindubois

@geiliwanghaichao

"I want the userspace program to be able to directly specify the DMA target address to avoid data copying from read()/write()." "Does the driver support direct DMA writes into userspace memory (hundreds of megabytes to gigabytes) instead of kernel buffers?"

Yes, the way the driver works, it maps userspace buffer into DMA address space, und thus enables to perform direct transfer between it and the FPGA without any intermediate copying. However, the original reference driver on this repository is woefully inefficient for such large transfers that you require. I recommend you to try the reworked version: https://github.com/Prandr/dma_ip_drivers It is also open source and operates under the same principle of direct DMA transfers between userspace buffer and FPGA, but was optimised to vastly reduce overhead and increase efficiency especially for large transfers.

@martindubois

The driver support this when read/write from/to a axi mem interface. It does not support it when read/write from/to a axi stream interface. I already modified it to use the "mem" part of the driver even when using a "stream" interface. This is a very small change. It work and improve performance.

Sorry, your answer is wrong. There is no principal difference between implementations of AXI-MM and -Stream.

And I am afraid your commercial driver is no longer relevant, thanks to freely available alternatives, like the in-tree driver, or my reworked version of the reference driver.

Prandr avatar Sep 15 '25 16:09 Prandr

@Prandr Thanks for correcting me. I should have take more time to verify your driver and not assume it share the same issue as the original Windows driver Xilinx provide. And you are also right about the fact that DrvDMA is less of interest on Linux since the in-tree driver is available. The main interest of DrvDMA is now on Windows or for developer who want the same interface on Linux and Windows. Regards, Martin

martindubois avatar Sep 15 '25 17:09 martindubois