Skip to content

Commit 159d944

Browse files
b-brnichpraneethbajjuri
authored andcommitted
fix: How_To_Guides: Add Guide for Changing Size of CMA Region
Many components use the CMA to read and write memory. This how-to was originally placed only in the Wave5 documenation. Lets separate this to a how-to guide so that it can be more generic acorss domains. Signed-off-by: Brandon Brnich <[email protected]>
1 parent 1af0207 commit 159d944

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
How to Configure the CMA Size
3+
=============================
4+
5+
Contiguous Memory allocation (CMA) is commonly used by memory-to-memory (M2M) devices that do not have
6+
have MMU support. By default in Linux, the CMA size will be 32 MB. For the common TI board, this is far
7+
too small. There are a handful of components that need to use CMA in order for proper operation as well as
8+
achieving optimal performance. These components include, but are not limited to, the multimedia Codecs, CSI,
9+
and TIDSS. TI has already increased the amount of CMA that comes in |__SDK_FULL_NAME__|. The amount that has
10+
been allocated can be checked by running the following command on target:
11+
12+
.. code-block:: console
13+
14+
target$ cat /proc/meminfo | grep Cma
15+
16+
After executing, an output similar to the one below will be seen.
17+
18+
.. code-block:: console
19+
20+
CmaTotal: 589824 kB
21+
CmaFree: 583984 kB
22+
23+
These logs can be used to obtain the amount of CMA that has been allocated and how much of that is still available
24+
for use. Depending on the particular use case, it may be of interest to decrease the size of this allocation pool.
25+
To do so, locate the device tree (.dts) file that contains the main domain for the target board. For example, if
26+
using the AM62PX SoC, open up :file:`arch/arm64/boot/dts/ti/k3-am62p5-sk.dts`. These device tree files contain a
27+
node for reserved memory. A portion of this reserved memory area is for CMA, therefore the area has been named
28+
`linux,cma`. This node contains an attribute called size; changing the value of this attribute cause the CMA region
29+
to grow or shrink. Once attribute is changed to desired value, save and close the dts file so it can be compiled into
30+
proper device tree blob (.dtb). Update the target with new .dtb file and check that new CMA region matches the size
31+
set in the device tree.
32+
33+
CMA allocation can also be changed without re-compilation of device tree. One can stop at u-boot prompt during boot
34+
and update the CMA parameter as shown below:
35+
36+
.. code-block:: console
37+
38+
target # setenv args_all $args_all cma=1000M
39+
target # boot
40+
41+
.. note::
42+
43+
Allocating at u-boot tends to place the CMA in the lower 32 bit region of memory. Many of the common components have been
44+
ported to operate in the higher 48 bit region of memory. It is recommended to take the approach with changing device tree,
45+
but this method is fine for quick validation.

source/linux/How_to_Guides_Developer_Notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ Developer Notes
5050
How_to_Guides/Host/Program_MMC_boot_media
5151
How_to_Guides/FAQ/Tda4_Latest_FAQs
5252
How_to_Guides/FAQ/How_to_run_BIST_on_a_core
53+
How_to_Guides/Target/How_To_Carve_Out_CMA

0 commit comments

Comments
 (0)