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.

Linux/AM5728: CMA and CMEM memory mapping

Part Number: AM5728

Tool/software: Linux

Hello,

I am working on a custom AM5728 board with less RAM than the EVM (256MB). I have been modifying the device tree to reallocate memory resources such as CMA and CMEM, but I am having difficulties designing a new memory map for my system without compromising any of the resources.

Part of the challenge is understanding why the different CMA and CMEM allocations were made for the EVM and how these can be safely modified for my board. I have been referencing SPRAC60 which outlines the Default PSDK Memory Map in Table 1, as follows:

Memory Section Physical Address
A15 Linux Kernel 0x80000000
IPU2 CMA 0x95800000
DSP1 CMA 0x99000000
IPU1 CMA 0x9D000000
DSP2 CMA 0x9F000000
CMEM 0xA0000000

On my system the valid physical memory range is from 0x80000000-0x8FFFFFFF this means the offsets and sizes of all of the CMA and CMEM allocations must be modified. Can anyone provide any guidance or information on how these allocations should be modified safely.

Specifically a few questions:

1) Can all of the above CMA and CMEM allocations be moved into the 0x80000000-0x8FFFFFFF range? I am aware of the Linux Kernel sitting at the lower address range (approximately 0x80000000-0x81000000) and the device tree and U-Boot image sitting in the higher address range (approximately 0x8F5FFFFF-0x8FFFFFFF), but is there anything else in the 0x80000000-0x8FFFFFFF range to be aware of?

2) How can I determine the required size for each of these CMA and CMEM allocations for my situation?

Thanks,

Chad

  • The software team have been notified. They will respond here.
  • HI, Chad,

    The CMA is used by Kernel for DMA, and CMEM is used by IPC between ARM and DSP/IPU cores. You need to tune the sizes. Different drivers may have different requirement for CMA size and same for CMEM. If the sizes aren't big enough, the drivers or the applicationis would complain when allocating memory.

    Rex
  • Hello Rex,

    I was hoping for some specific numbers or methods to calculate or determine ballpark numbers.

    Perhaps even some reasoning as to why the current allocations were chosen.

    Thanks,
    Chad
  • Hi, Chad,

    CMA sizes are determined based on the known usecases and a minimum default of 8 MB for processors for which this is not known. These sizes are also chosen in multiples of 8 MB to satisfy the CMA granularity needs back in the day when it was first developed. Most of these are derived from the usecases of other TI BU, and we haven’t changed carveouts in years (believe they were the same since 3.8 kernel actually). Also, there is currently a dependency between these carveout addresses and addresses used in IPC 3.x software, and IPC 3.x doesn’t have separate builds between AM57xx and the other BU's platform, so they all match across all platforms.

    The CMEM default blocks are reserved for OpenCL application, and the sizes are based on OpenCL's requirement. If OpenCL is not used, the CMEM node in dts can be removed. However, if IPC is used between ARM and DSP/IPU, and if continuous memory blocks are preferred way for memory allocation, then the size of CMEM will be depended on the data size sent to DSP/IPU by the application. 

    Rex