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: Error allocating large CMEM buffer

Part Number: AM5728

Tool/software: Linux

Previously I was using CMEM to create two 16M pools. When I go and change that to 128M I get an error when I try to load/start the DSP; see below. What can I do to make this work successfully?

[ 90.080869] remoteproc2: powering up 40800000.dsp
[ 90.085760] remoteproc2: Booting fw image dra7-dsp1-fw.xe66, size 16233880
[ 90.100167] omap_hwmod: mmu0_dsp1: _wait_target_disable failed
[ 90.106067] omap-iommu 40d01000.mmu: 40d01000.mmu: version 3.0
[ 90.111996] omap-iommu 40d02000.mmu: 40d02000.mmu: version 3.0
[ 90.118014] omap-rproc 40800000.dsp: dma_alloc_coherent err: 134217728
[ 90.124705] remoteproc2: Failed to process resources: -12
[ 90.137312] omap_hwmod: mmu1_dsp1: _wait_target_disable failed
[ 90.150247] omap_hwmod: mmu0_dsp1: _wait_target_disable failed
[ 90.156229] remoteproc2: rproc_boot() failed -12
[ 90.161225] virtio_rpmsg_bus: probe of virtio0 failed with error -12
[ 90.168642] remoteproc2: registered virtio0 (type 7)

CMEM Device Tree Allocation:

reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;

/* 0xf000_0000 - 0xf7ffffff */
cmem_block_mem_0: cmem_block_mem@f0000000 {
reg = <0x0 0xf0000000 0x0 0x08000000>;
no-map;
status = "okay";
};

/* 0xf800_0000 - 0xffffffff */
cmem_block_mem_1: cmem_block_mem@f8000000 {
    reg = <0x0 0xf8000000 0x0 0x08000000>;
    no-map;
    status = "okay";
};

};

cmem {
    compatible = "ti,cmem";
    #address-cells = <1>;
    #size-cells = <0>;

    #pool-size-cells = <2>;

    status = "okay";

    /* Pool 0 - DSP1's FPGA Buffer */
    cmem_block_0: cmem_block@0 {
        reg = <0>;
        memory-region = <&cmem_block_mem_0>;
        cmem-buf-pools = <1 0x0 0x08000000>;
    };

    /* Pool 1 - DSP2's FPGA Buffer */
    cmem_block_1: cmem_block@1 {
        reg = <1>;
        memory-region = <&cmem_block_mem_1>;
        cmem-buf-pools = <1 0x0 0x08000000>;
    };

};

Kernel Commandline Addition:

memmap=128M$0xf0000000

memmap=128M$0xf8000000

CMEM Information:

-bash-4.3# cat /proc/cmem

Block 0: Pool 0: 1 bufs size 0x8000000 (0x8000000 requested)

Pool 0 busy bufs:
id 0: phys addr 0xf0000000 (noncached)

Pool 0 free bufs:

Pool -1 free bufs:

Block 1: Pool 0: 1 bufs size 0x8000000 (0x8000000 requested)

Pool 0 busy bufs:
id 0: phys addr 0xf8000000 (noncached)

  • Hi Gerard,

    Can you stop your board at u-boot stage, execute printenv & share the result?

    I am specifically interested in mem=## parameter if present.

    Also can you specify which SDK version are you using?

    Best Regards,
    Yordan
  • Yordan Kovachev said:


    Can you stop your board at u-boot stage, execute printenv & share the result?

    I am specifically interested in mem=## parameter if present.

    Also can you specify which SDK version are you using? 

    I am using SD 03.03..00.04. Here is the printenv output - note, I do not have a "mem=" in there at all (and I removed the "memmap=" since it didn't fix anything):

    UBOOT_FLAG=0
    arch=arm
    args_mmc=run finduuid;setenv bootargs console=ttyS2,115200n8 vmalloc=512M root=/dev/mmcblk0p2 rw; rootfstype=ext4 rootwait
    baudrate=115200
    board=am572x_custom
    board_name=am572x_custom
    bootcmd=if test ${dofastboot} -eq 1; then echo Boot fastboot requested, resetting dofastboot ...;setenv dofastboot 0; saveenv;echo Booting into fastboot ...; fastboot;fi;run findfdt; run envboot; run mmcboot;setenv mmcdev 1; setenv bootpart 1:2; setenv mmcroot /dev/mmcblk0p2 rw; run mmcboot;
    bootdelay=1
    bootdir=/current_rootfs/boot
    bootenvfile=uEnv.txt
    bootfile=zImage
    bootm_size=0x10000000
    bootpart=0:2
    bootscript=echo Running bootscript from mmc${mmcdev} ...; source ${loadaddr}
    console=ttyS2,115200n8
    cpu=armv7
    dfu_alt_info_emmc=rawemmc raw 0 3751936;boot part 1 1;rootfs part 1 2;MLO fat 1 1;MLO.raw raw 0x100 0x100;u-boot.img.raw raw 0x300 0x400;spl-os-args.raw raw 0x80 0x80;spl-os-image.raw raw 0x900 0x2000;spl-os-args fat 1 1;spl-os-image fat 1 1;u-boot.img fat 1 1;uEnv.txt fat 1 1
    dfu_alt_info_mmc=boot part 0 1;rootfs part 0 2;MLO fat 0 1;MLO.raw raw 0x100 0x100;u-boot.img.raw raw 0x300 0x400;spl-os-args.raw raw 0x80 0x80;spl-os-image.raw raw 0x900 0x2000;spl-os-args fat 0 1;spl-os-image fat 0 1;u-boot.img fat 0 1;uEnv.txt fat 0 1
    dfu_alt_info_qspi=MLO raw 0x0 0x010000;MLO.backup1 raw 0x010000 0x010000;MLO.backup2 raw 0x020000 0x010000;MLO.backup3 raw 0x030000 0x010000;u-boot.img raw 0x040000 0x0100000;u-boot-spl-os raw 0x140000 0x080000;u-boot-env raw 0x1C0000 0x010000;u-boot-env.backup raw 0x1D0000 0x010000;kernel raw 0x1E0000 0x800000
    dfu_alt_info_ram=kernel ram 0x80200000 0x4000000;fdt ram 0x80f80000 0x80000;ramdisk ram 0x81000000 0x4000000
    dfu_bufsiz=0x10000
    dofastboot=0
    env_file_flag=1
    envboot=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadbootscript; then run bootscript;else if run loadbootenv; then echo Loaded env from ${bootenvfile};run importbootenv;else if run loadbootenvfromemmc; then echo Loaded env from ${bootenvfile};run importbootenv;fi;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;fi;fi;
    eth1addr=7c:ec:79:a1:0d:0d
    ethact=cpsw
    ethaddr=7c:ec:79:a1:0d:0c
    fdt_addr_r=0x88000000
    fdtaddr=0x88000000
    fdtfile=am572x-custom.dtb
    findfdt=if test $board_name = am572x_custom; then setenv fdtfile am572x-custom.dtb; fi; if test $board_name = am572x_custom_evm; then setenv fdtfile am572x-custom-evm.dtb; fi; if test $fdtfile = undefined; then setenv fdtfile am572x-custom-evm.dtb; fi;
    finduuid=part uuid mmc ${mmcdev}:2 uuid
    importbootenv=echo Importing environment from mmc${mmcdev} ...; env import -t ${loadaddr} ${filesize}
    kernel_addr_r=0x82000000
    loadaddr=0x82000000
    loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
    loadbootenvfromemmc=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootenvfile}
    loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr
    loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile};
    loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
    mmcboot=mmc dev ${mmcdev}; if test -e mmc ${mmcdev} uboot.env; then; else saveenv; fi; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadimage; then run loadfdt; echo Booting from mmc${mmcdev} ...; run args_mmc; bootz ${loadaddr} - ${fdtaddr}; fi;fi;
    mmcdev=1
    mmcroot=/dev/mmcblk0p2 rw;
    mmcrootfstype=ext4 rootwait
    netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
    netboot=echo Booting from network ...; setenv autoload no; dhcp; run netloadimage; run netloadfdt; run netargs; bootz ${loadaddr} - ${fdtaddr}
    netloadfdt=tftp ${fdtaddr} ${fdtfile}
    netloadimage=tftp ${loadaddr} ${bootfile}
    nfsopts=nolock
    partitions=uuid_disk=${uuid_gpt_disk};name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}
    ramdisk_addr_r=0x88080000
    rdaddr=0x88080000
    rootpath=/export/rootfs
    scsidevs=0
    soc=omap5
    static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
    stderr=serial
    stdin=serial
    stdout=serial
    usbnet_devaddr=7c:ec:79:a0:8c:7c
    usbtty=cdc_acm
    vendor=ti
    ver=U-Boot 2016.05-00319-g8d0b2ca-dirty (May 23 2017 - 16:32:41 -0400)
    vram=16M

    Environment size: 4248/65532 bytes

  • Hi Gerard,
    As Yordan mentioned, you need to add "mem" allocation in the command line arguments.
    Please have a look at below wiki page which describes more about cmem allocation :
    processors.wiki.ti.com/.../CMEM_Overview

    Also, when you increase the cmem allocation, it might be getting overlapped with DSP memory. So, you need to re-arrange the memory assignment.

    Hope it helps.

    Thanks,
    Prabhuraj
    BlackPepper Technologies
  • Yes, try adding mem=## to the u-boot environment parameters or in am572x_evm.h.

    Best Regards,
    Yordan
  • Yordan Kovachev said:
    Yes, try adding mem=## to the u-boot environment parameters or in am572x_evm.h.

    I have tried doing this but in most cases the Linux kernel fails to boot as a result. Note that we have 4GB of DDR memory on this custom board. Ideally I wanted to tell Linux it had 3.5GB and leave the remaining .5GB for the DSPs.

    This failed to boot when added to the Linux command line via the U-Boot environment:

    mem=1024M@0x80000000

    mem=1G@0x80000000

    mem=1536M@0x80000000

    mem=1536M@0x200000000

    mem=3584M@0x200000000

    This booted but does me no good since it is only 512M:

    mem=512M@0x80000000

    Any ideas?

    Thanks

  • Hi,

    What is the DDR memory size configured to in device tree ? Have you configured for 4GB ?
  • sai prasad said:

    What is the DDR memory size configured to in device tree ? Have you configured for 4GB ?

    I can include some specific device tree nodes related to the DDR memory - which ones are you interested in?

  • Gerard,

    It seems to me that you are allocating the first 2 blocks for your applications, DSP1 and DSP2 FPGA. Please avoid using the first 2 blocks because they are reserved for OpenCL. Please see disucssion of CMEM in e2e.ti.com/.../604490

    Rex