2

I want to reserve a large amount (~1 gigabyte) of contiguous memory for DMA from a device. The entire purpose of this particular Linux box is to run a single application which uses the device. The device does large transfers of ~10-200MB per operation.

To be clear, put up this question for the next guy. Expect to have an answer somewhat shortly.

  • To be clear, the Linux kernel has well-described support for allocating DMA buffers. The problem is with large buffers. This seems to be a continuing topic. https://lwn.net/Kernel/Index/#Memory_management-Large_allocations There are distinct large-allocations use cases. General purpose use is hard and (so far) unsolved. Specialized cases are more solvable. This question and answers are good, but fail to distinguish use-cases. https://unix.stackexchange.com/questions/37729/how-can-i-reserve-a-block-of-memory-from-the-linux-kernel – Preston L. Bannister Jul 27 '20 at 17:00
  • Also check https://wiki.debian.org/Hugepages – Artem S. Tashkinov Jul 27 '20 at 17:52
  • In my case, I want to have four 256MB blocks for DMA from the device. The device is an FPGA with streams from four sources at ~4GB/s each. No need for any sort of general purpose pool (how I read CMA) - in fact reason not. Pattern of allocation is fixed. – Preston L. Bannister Jul 27 '20 at 23:23
  • For completeness, will note I used ``memmap=4G!4G`` successfully for a time. Most of the development team is in fact still using this version. Then the FPGA design entirely changed, so I am now using the Xilinx XDMA driver for transfers to and from FPGA attached DDR4. The upside is no kernel parameters needed. – Preston L. Bannister Mar 27 '22 at 00:19

1 Answers1

1

I don't think you'll be able to. Instead, you'll have to "fake it" as described here.

The last time I checked (it's been a while), the CMA hadn't been ported to x86 from ARM yet. Even then, that big a buffer is unlikely to work out for you.

Aaron D. Marasco
  • 5,708
  • 24
  • 29