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/DRA71: DDR allocation in Linux device tree

Part Number: DRA71

Tool/software: Linux

Below is what I allocate DDR  in device tree file:

ipu1_cma@84000000 {
compatible = "shared-dma-pool";
reg = <0x0 0x84000000 0x0 0x4000000>;
no-map;
status = "okay";
linux,phandle = <0xb7>;
phandle = <0xb7>;
};

cmem_block_mem@88000000 {
reg = <0x0 0x88000000 0x0 0xc00000>;
no-map;
status = "okay";
linux,phandle = <0x109>;
phandle = <0x109>;
};

What I want to asks is:

1, As reserved memory for IPU1, is A15 still can read/write IPU1 memory area? 

2, What cmem means, can I understand it as share memory?

3, Except Reserved memory, other memory area is used by A15?

Thanks.

  • Hi,

    Please find the response to your questions:

    1. No. The reserved node implies, kernel can't allocate from the given region of DDR and the no-map attribute implies the region isn't mapped in kernel.
    2. Cmem is a contiguous memory allocator which is used to allocate physically contiguous buffers from Linux and pass it to remote-cores such as DSP/M4. More details can be found here.
    processors.wiki.ti.com/.../CMEM_Overview

    3. Yes.

    Regards
    Shravan
  • Hi Shravan,

    About first question, in A15 application, A15 still can read/write IPU1 reserved memory , is that right?

    And if so, how memory isolation works?

    Thanks for you reply.

  • Hi,

    No, it isn't possible for A15 to read/write to IPU1/2 cma region. The attribute 'no-map' implies the region of DDR isn't mapped by kernel.
    If the attribute 'reusable' is provided it implies the kernel can re-use the DDR region if it runs out of memory. Please refer to arch/arm/boot/dts/dra7-evm.dts for a reference implementation on the different carve-outs in the device-tree.

    Regards
    Shravan
  • Hi Shravan,

    Below is my memory allocation in device tree:
    reserved-memory {
    #address-cells = <0x2>;
    #size-cells = <0x2>;
    ranges;

    ipu1_cma@84000000 {
    compatible = "shared-dma-pool";
    reg = <0x0 0x84000000 0x0 0x4000000>;
    no-map;
    status = "okay";
    linux,phandle = <0xb7>;
    phandle = <0xb7>;
    };
    };

    And in the application we use mmap to map the memory, then read/write this memory area:
    mmap(NULL, SCM_PHYSICAL_LEN_B, PROT_READ | PROT_WRITE, MAP_SHARED, fd, SCM_PHYSICAL_ADDR);
    #define SCM_PHYSICAL_ADDR (0x87E00000)

    Is that reasonable?

    Thanks.
  • Hi ,

    Yes this should be fine.

    Regards
    Shravan
  • Hi Shravan,

    Thanks for your support.

    In my understanding, reserved memory in device tree means this area is not mapped in kernel, but A15 still can operate this memory area by specific memory physical address.

    Am I right?

  • Hi,

    As indicated in previous posts, reserved memory indicates the kernel can't allocate buffers/ memory from the given region, unless the resusable flag is set. You can still access the region from kernel through explicit map operations (such as mmap). You may find more information here.

    www.kernel.org/.../reserved-memory.txt

    Regards
    Shravan
  • Hi Shravan,

    Got it, thanks for your great support.