04-09-2019 12:39 AM - edited 04-09-2019 03:43 AM
i'm using ZCU106 and petalinux 2018.2.
I used "petalinux-config -c kernel" to allocate a large region of CMA memory for DMA transfer test.
Reserving 1900MB works fine. But,when I trying to reserve 2048MB or more of CMA ,I'll get:
"cma: Failed to reserve 2048MiB" error message during linux boot.
so,is there a limitation for reserve CMA memory larger than 2048MB or have some solutions?
04-12-2019 03:18 PM
The reason for the failure is that the DDR memory for MPSOC is not contiguous and it includes 2 memory ranges (2 GB each), 0 - 0x8000_0000, and 0x8_0000_0000 - 0x8_8000_0000. Since the DDR itself is limited to two 2 GB blocks, CMA allocations will only be successful for sizes < 2 GB.
04-12-2019 10:22 PM
Thanks very much！@shirilt
I have changed it in the "system-user.dtsi",such as
Then, successly reserved 3000Mib cma from the linux boot log.
When I use "cat /proc/iomem" ,i found the "0x8_0000_0000 - 0x8_1000_0000" was not applied.
Is there any wrong for my system-user.dtsi?
04-16-2019 02:46 PM
I tested your device tree on my zcu102 board, and as expected, the board did not boot up. In your device tree, your first bank of memory has a size 0xf000000 which is ca. 4 GB. If you take a look at Table 10-1 on p. 223 of https://www.xilinx.com/support/documentation/user_guides/ug1085-zynq-ultrascale-trm.pdf, you will see that the DDR_LOW range of addresses is from 0x0 to 0x7fff_ffff which is 2 GB. Since your device tree entry allocated more than this, other reserved memory areas (especially for the CSU, PSU, TCM, OCM) were stomped on, and caused a failure during Linux boot up.
Could you run dmesg | grep cma on your board and post the output here? I'd like to see what area the cma memory is being allocated to, and how much memory you have available. Mine looks like this:
From this figure, you can see that the two 'System RAM' areas obey the address map, and total up to ca. 4 GB of memory as expected. In theory, if you have more than 4 GB of DDR memory available, then you can allocate more than 2 GB chunks of CMA, but only in the DDR_HIGH address region (beyond 0x8_0000_0000).