I'm running custom HDL applications on the Red Pitaya and I'm currently using 0.94 ecosystem (though I could probably change if needed). I'd like to reduce the memory allocation to linux (therefore, increase the dma-reserve portion).
The goal of this modification is to make a high speed acquisition card (ADC -> Datamover -> DDR3 and when the acquisition is done, read DDR3 and save to sd card or send via ethernet). Therefore, I'd like to reduce the linux RAM size as much as possible (around 100 MB) and use the remaining (around 412 MB ~ 256 MSamples at 125 MHz).
First, quick question which might make the next one unnecessary:
Can I assume that if I allocate memory in a C program with the following pseudo code, it's not used by linux. So if I change 0x1E000000UL to a lower address like 0x10000000UL (and corresponfing MAP_SIZE and MAP_MASK), will I be sure all my data in the DDR3 won't be modified by linux?
Code: Select all
#define MAP_SIZE_DMA (1UL<<25) //DMA from FPGA_MEMORY_START_DMA to 0x1FFFFFFFUL (for 1E000000 to 1FFFFFFF => 2^25-1 = 32MB)
#define MAP_MASK_DMA (MAP_SIZE_DMA - 1)
uint32_t FPGA_MEMORY_START_DMA = 0x1E000000UL;
void* map_base_dma = (void*)(-1);
fd_dev_mem = open("/dev/mem", O_RDWR | O_SYNC);
map_base_dma = mmap(0, MAP_SIZE_DMA, PROT_READ | PROT_WRITE, MAP_SHARED, fd_dev_mem, FPGA_MEMORY_START_DMA & ~MAP_MASK_DMA);
How should I proceed to modify dma-reserved memory? I've tried several path, but not sure which one to follow. I recently started having an okay understanding of the FPGA side, but frankly, I'm lost with everything on the processing side (and mostly booting). Every bit of advice is welcome.
Here's what I've tried so far:
- Currently, I can decompile the devicetree ( dtc -I dtb -O dts /boot/devicetree.dtb) and see this line
which fit approximately with what i get from "vmstat -s" (468 MB of RAM)memory {
device_type = "memory";
reg = <0x0 0x1c000000>;
};
If I manually change the value in the devicetree, run479256 K total memory
Code: Select all
dtc -I dts -O dtb devicetree.dtb devicetree.dts
If I manually change the devicetree.dtb via windows (by inserting the sd card in the sd reader), nothing happen but I can see the dtb file has been modified (if I decompile it with the dtc command).
- Also, if I look at everything in the boot section I see these lines:
- I also looked at u-boot.src (and u-boot.src.buildroot and u-boot.src.debian) and there is the following lines:## Executing script at 02000000
Set devicetree and ramdisk high loading address to 512MB-64MB
[...]
Machine model: xlnx,zynq-7000
cma: Reserved 16 MiB at 0x1d000000
Memory policy: Data cache writealloc
[...]
Memory: 462656K/491520K available (5444K kernel code, 336K rwdata, 1776K rodata, 216K init, 238K bss, 28864K reserved, 0K highmem)
[...]
DMA: preallocated 256 KiB pool for atomic coherent allocations
To summarize, I see contradictory information (u-boot and devicetree vs text in boot section) and I don't know how to boot with a modified devicetree (or even if I should). Do you have any suggestion for me?setenv high 0x1c000000
setenv fdt_high ${high}
setenv initrd_high ${high}
Thank you very much for your help.
Alex