Newbie - so please bare with me. I have read some of the other discussion on the topic, but I feel they have not completely answered my question, at least.
Windows 10 system. I have user code that allocates 4GB of Large Page memory (VirtualAlloc ). No problems there.
I have an FPGA that is DMA’ing data based on an MDL I program it with.
- Data goes from FPGA → SysMem; no plan to go from SysMem–>FPGA.
- The FPGA is assuming 64KB page sizes.
Once the data is in SysMem, the user code will process that data.
- Basically, The 4GB buffer is intended to by a type of circular buffer.
- FPGA generated interrupts will signal user code via the FPGA kernel driver when new data is available.
- But lets put this piece aside for now, I want to focus on how to properly DMA the data into the 4GB buffer.
Since the 4GB is contiguous, and 64KB is a multiple of 2MB, my plan is to:
- Create an page-table of virtual addresses that are in increments of 64KB.
– 4GiB / 64KiB = 65,536 entries. - Have my FPGA kernel driver convert the virtual addresses to physical addresses ( use MmGetPhysicalAddress ).
- Program the FPGA with the “translated” physical addresses.
However, reading some other discussions on the topic of DMA, this is not the right way of doings this - even if I get lucky and this happens to work.
Question: I have a pointer (virtual address) to my 4GB buffer of Large Page Memory, what is the correct way of
- Breaking up the 4GB buffer into 64KB “chunks”.
- Converting the virtual addresses into physical addresses.
- Setting up the physical addresses to be DMA recipients.
Thank you, all, in advance.
OneKneeToe