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.

TCI6638K2K: Linux CMA configuration

Part Number: TCI6638K2K

I notice that linux kernel allocates the default cma pool at 2e800000, but I don't find how to change this default starting address, how can I indicate kernel to allocate cma pool from the specified memory address? I really try to call dma_declare_contigous(NULL, pkt_buf_size, pkt_buf_base, 0), it always fails to reserve cma pool from the un-zero pkt_buf_base memory address. If pkt_buf_base is set to zero, it can succeed to allocate one memory pool for cma, but it doesn't locate in the specified memory space I need. Please help me out.

Another question is about the address 0x2e800000, it is not a memory address (0x80000000 ~ 0xffffffff) 2G, why does kernel get this address for cma pool?

  • Hello,

    I'm looping in our Linux expert to help with this, but in the meantime you may find your answer in the Linux IPC on K2x guide here: http://software-dl.ti.com/processor-sdk-linux/esd/docs/latest/linux/Foundational_Components_IPC.html#understanding-the-memory-map

    The examples are for K2G but should apply to all K2x platforms. 

    Best,
    Sahin

  • Hi,

    Which SDK release and version are you using? and where do you see that the CMA is using area at 0x2e800000?

    All Keystone-2 devices (K2H/K/E/G) have CMA defined at 0x08 1f80 0000 as shown in the IPC link provided by Sahin. The CMA is defined in keystone-k2hk-evm.dts file.

    $ ~/work/ti-processor-sdk-linux-k2hk-evm-06.00.00.07/board-support/linux-4.19.38+gitAUTOINC+4dae378bbe-g4dae378bbe/arch/arm/boot/dts$ grep -ir 1f800000 keystone-k2hk*
    keystone-k2hk-evm.dts: dsp_common_memory: dsp-common-memory@81f800000 {
    keystone-k2hk-evm.dts: reg = <0x00000008 0x1f800000 0x00000000 0x800000>;

    The boot logs show:

    [ 0.000000] efi: UEFI not found.
    [ 0.000000] Reserved memory: created CMA memory pool at 0x000000081f800000, size 8 MiB
    [ 0.000000] OF: reserved mem: initialized node dsp-common-memory@81f800000, compatible id shared-dma-pool

    Rex

  • Thanks for your response, I am using mcsdk_3.0.3 with linux kernel v3.10.10. It has no the dts file you mentioned. For older version of MCSDK and kernel needed by me, how can cma be configured? Can I allocate the specified memory space as cma pool?

    This is the log output of my kernel:

    cma: CMA: reserved 16 MiB at 2d800000

  • Hi, 

    You should take a look at the drivers/base/dma-contiguous.c. The CMA is allocated in dma_declare_contiguous() which is called from dma_contiguous_reserve(). The base in the argument list passed to dma_declare_contiguous() is 0 which means starting address is any.

     * @dev:   Pointer to device structure.
     * @size:  Size of the reserved memory.
     * @base:  Start address of the reserved memory (optional, 0 for any).
     * @limit: End address of the reserved memory (optional, 0 for any).
     *
    

    The way I understand that any means dymanically allocated which you should be able to find more details in dma_declare_contiguous() function.

    For your info, the TCI6638K2K is NRND, please find more info on the support for TCK6638K2K can be found in https://e2e.ti.com/support/processors/f/791/t/809582

    The MCSDK is also no longer supported. I recommend you to switch to other TI silicon device similar to TCI6638K2K, and using the latest Processor SDK 6.0 for better support.

    Rex

  • Thanks a lot for your kindly response, currently we have no plan to migrate our product to new chip.  For the arguments of the function dma_declare_contiguous(), base is optional, and it can be 0 for any or other specified memory address. If base is un-zero, kernel will reserve the specified memory space in the best effort. Is my understanding right?

    Can you also shed light on the reserved physical address (0x2d800000)? It seems to be wrong. Expect your comments.

    Thanks,

  • Hi,

    if the base is non-zero, that address will be used. That's correct.

    I don't think linux is dealing with physical address directly. I didn't try to trace the code, but think the address of 0x2d800000 may be the virtual address. I don't know if that is the case though.

    Rex