This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM6442: Reserved CMA memory allocation

Part Number: AM6442
Other Parts Discussed in Thread: AM625

Hello TI expert,

My custom board used AM6442 SoC with LPDDR4 512MB.

I have already customized the memory config and booted Linux successfully.

But I have issue about cma memory allocation as below:

1. Good case on AM64x-EVM: booting og

[    0.000000] cma: Reserved 512 MiB at 0x00000000c0000000

2. Bad case on my custom board: booting log

[    0.000000] cma: Failed to reserve 512 MiB

I am wondering why my custom board using DDR-512MB is still reserved 512MiB for cma!

And on TI' SDK does not support to adjust the cma size by dts so I need some helps from TI's expert.

Can you help me adjust the cma size to 64MiB.

Thanks

Brian

  • Hello Brian,

    Please post the changes you made to your memory configuration.

    For example, on AM64x EVM, I see Linux devicetree under arch/arm64/boot/dts/ti/k3-am642-evm.dts and uboot devicetree under arch/arm/dts/k3-am642-evm.dts both list 2GB of RAM:

            memory@80000000 {
                    device_type = "memory";
                    /* 2G RAM */
                    reg = <0x00000000 0x80000000 0x00000000 0x80000000>;
    
            };
    

    Did you change that in your design?

    Regards,

    Nick

  • Hello Nick,

    Many thank you for your response soon,

    This issue is one of the problems you have ever supported me (IPC shared memory adjustment worked well on this but CMA has issue)

    Because my custom board: LPDDR4 512MB so I need to change the memory layout for u-boot and kernel as below:

    	memory@80000000 {
    		device_type = "memory";
    		/* 512MB RAM */
    		reg = <0x00000000 0x80000000 0x00000000 0x20000000>;
    	};
    	reserved-memory {
    		#address-cells = <2>;
    		#size-cells = <2>;
    		ranges;
    
    		secure_ddr: optee@9e800000 {
    			reg = <0x00 0x9e800000 0x00 0x01800000>; /* for OP-TEE */
    			alignment = <0x1000>;
    			no-map;
    		};
    
    		mcu_m4fss_dma_memory_region: m4f-dma-memory@91000000 {
    			compatible = "shared-dma-pool";
    			reg = <0x00 0x91000000 0x00 0x100000>;
    			no-map;
    		};
    
    		mcu_m4fss_memory_region: m4f-memory@91100000 {
    			compatible = "shared-dma-pool";
    			reg = <0x00 0x91100000 0x00 0xf00000>;
    			no-map;
    		};
    
    		rtos_ipc_memory_region: ipc-memories@95000000 {
    			reg = <0x00 0x95000000 0x00 0x00800000>;
    			alignment = <0x1000>;
    			no-map;
    		};
    	};
    

    This is error log:

    [    0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x000000009fffffff]
    [    0.000000] cma: Failed to reserve 512 MiB

    How to adjust the CMA memory size to 64MiB?

    Thanks,

    Brian

  • Hello Brian,

    I am going to give you a response that I have not had time to test myself. Please let me know if it does not work, or if there is additional information future readers should know before going through these steps.

    One of my team members indicated that the CMA buffer size is calculated based on the kernel page size. If that is true, you should see a smaller CMA allocation by selecting a smaller kernel page size. I have not looked into whether there are other ramifications of changing the kernel page size.

    When I check on the AM64x EVM, it looks like the page size is 64kB by default:

    root@am64xx-evm:~# getconf PAGESIZE
    65536
    

    You can use adjust the kernel configuration by following the steps at https://software-dl.ti.com/processor-sdk-linux/esd/AM64X/08_01_00_39/exports/docs/linux/Foundational_Components_Kernel_Users_Guide.html

    Use menuconfig to adjust the kernel configuration. Go Kernel Features-->Page size(64KB). Select 4KB, then save the new kernel configuration. Then rebuild the kernel following the steps in the kernel users guide.

    Let me know what you end up seeing.

    Regards,

    Nick

  • Hello Nick,

    CMA can register with 24MiB, or 64MiB on AM64xx.

    Thank you so much.

    Brian

  • Hello Brian,

    Circling back: do you need any additional guidance here?

    Regards,

    Nick

  • Hello Nick,

    I saw the new SDK for AM625 using 4MiB in defconfig.

    It worked fine in my system

    Thanks

    Brian