CMA Size

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CMA Size

5,872 Views
oferausterlitz
Senior Contributor II

Hi,

At the moment Linux CMA size is hard-coded on all i.MX8 and i.MX8M platforms in SoC DTSI file.

i.MX8MM: fsl-imx8mm.dtsi\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel 

i.MX8M: fsl-imx8mq.dtsi\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel

i.MX8QM: fsl-imx8qm.dtsi\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel 

i.MX8QXP: fsl-imx8dx.dtsi\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel 

This works for NXP evaluation platforms, but may result in kernel crashes on custom boards with smaller amount of RAM.

For example, our i.MX8M board with 1GB of RAM crashes since by default 960MB area is allocated by CMA.

It is not clear why CMA size, which is board specific, is being fixed in SoC DTSI file inherited by all boards.

Is there any benefit in defining CMA parameters in DTS instead of passing CMA size as kernel command line parameter based on the actual DRAM size ?

Thanks.

Felix.

0 Kudos
5 Replies

4,623 Views
oferausterlitz
Senior Contributor II

Hi Victor,

Yes, it can be ignored, I have described the exact scenario when it happens. Assuming that CMA kernel option is not ignored, is it safe to use ?

Thanks.

0 Kudos

4,623 Views
oferausterlitz
Senior Contributor II

Hi Victor,

My questions were not answered, please remove "Assume answered" indicator.

0 Kudos

4,623 Views
oferausterlitz
Senior Contributor II

Hi Victor,

Thanks for a prompt reply. When "linux,cma-default" property exists in DTS node, kernel ignores cma= command line parameter. You can see that here:

dma-contiguous.c\base\drivers - linux-imx - i.MX Linux kernel 

dma-contiguous.c\base\drivers - linux-imx - i.MX Linux kernel

So you can either have "linux,cma-default" DTS node or pass CMA size via kernel command line, but not both.

Without big enough CMA area video playback and camera streaming are not going to work, so completely disabling CMA is not an option for us. The only difference I can see between DTS and command line CMA configurartion, is that in DTS you can set memory range used by CMA and in command line you cannot. My question is: is it safe to configure CMA via command line for all use cases on i.MX8 and i.MX8M platforms ?

Thanks.

0 Kudos

4,623 Views
b36401
NXP Employee
NXP Employee

I was told that one need to use DTS. CMA option of kernel command line may be ignored.

0 Kudos

4,623 Views
b36401
NXP Employee
NXP Employee

CMA (physically-continuous memory) can be used to make sure that buffers can be used plain with DMA or some other device.
You can specify "CMA=" option among of kernel parameters in u-boot to set any CMA size you wish.
And you can disable it at all for all memory to be available usual way.

0 Kudos