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.

AM5728: DSP/RTOS -ARM/Linux shared memory issue

Part Number: AM5728

HI ,

I am using AM5728 GPEVM, DSP is running on RTOS and A15 core is running on linux, In my applcatoin I want to send the data from DSP core to A15 core.

For this application I am trying to implement shared memory, I am writing to OCM memory from DSP/RTOS and trying to read it from ARM/Linux

What I observed is what ever data is written from DSP only initial few memory lications is read from ARM A15 properly and rest of the data is read improper.

To validate if the DSP is writing properly or not, I have read back the data from DSP also . My sequence is as below,

1. Write from DSP

2. Read from DSP

3. Read from ARM/Linux

What I observe is what ever data is written from DSP, DSP is able to read it back properly but same data ARM/linux is not able to read properly so presently I assume that DSP is able to write properly

but there would be some issue with ARM/Linux reads. I am using mmap to generate the vitrtual address and read using it from ARM/Linux end.

I have attached some logs, please find the same.

Thanks,

JanardanShared_Memory_Result.zip

  • Hi, Janardan,

    Could you check if ti-mctd daemon is running on Linux side? If it is, see if it makes difference after disabling it. Also, try devmem2 to dump ocmc area to see if the data being correct.

    Rex
  • Hi, Janardan,

    I don't see the issue. I enabled OCMC in Linux, and use the CCS to attach to DSP1 core. Then modified the OCMC memory space from DSP. On Linux side, I dumped the memory using devmem2, and the OCMC memory reflected what was modified from DSP.

    Before changes, the CCS displays OCMC memory at 0x40400000:

    Linux dump sees the same contents before modifying the contents

    root@am57xx-evm:/sys/bus/platform/drivers/omap-rproc# devmem2 0x40400000

    /dev/mem opened.

    Memory mapped at address 0xb6fd6000.

    Read at address 0x40400000 (0xb6fd6000): 0x86C34043

    root@am57xx-evm:/sys/bus/platform/drivers/omap-rproc# devmem2 0x40400004

    /dev/mem opened.

    Memory mapped at address 0xb6f45000.

    Read at address 0x40400004 (0xb6f45004): 0x7300E9A5

    root@am57xx-evm:/sys/bus/platform/drivers/omap-rproc# devmem2 0x40400008

    /dev/mem opened.

    Memory mapped at address 0xb6eff000.

    Read at address 0x40400008 (0xb6eff008): 0x42B48C43

    root@am57xx-evm:/sys/bus/platform/drivers/omap-rproc# devmem2 0x4040000C

    /dev/mem opened.

    Memory mapped at address 0xb6ff1000.

    Read at address 0x4040000C (0xb6ff100c): 0xBF81C69C

    Modify the OCMC contents from DSP1 through CCS:


    Dump the OCMC memory from Linux:

    root@am57xx-evm:/sys/bus/platform/drivers/omap-rproc#

    root@am57xx-evm:/sys/bus/platform/drivers/omap-rproc# devmem2 0x40400000

    /dev/mem opened.

    Memory mapped at address 0xb6f61000.

    Read at address 0x40400000 (0xb6f61000): 0x00010203

    root@am57xx-evm:/sys/bus/platform/drivers/omap-rproc# devmem2 0x40400004

    /dev/mem opened.

    Memory mapped at address 0xb6f32000.

    Read at address 0x40400004 (0xb6f32004): 0x04050607

    root@am57xx-evm:/sys/bus/platform/drivers/omap-rproc# devmem2 0x40400008

    /dev/mem opened.

    Memory mapped at address 0xb6fc1000.

    Read at address 0x40400008 (0xb6fc1008): 0x08090A0B

    root@am57xx-evm:/sys/bus/platform/drivers/omap-rproc# devmem2 0x4040000C

    /dev/mem opened.

    Memory mapped at address 0xb6f5c000.

    Read at address 0x4040000C (0xb6f5c00c): 0x0C0D0E0F

    root@am57xx-evm:/sys/bus/platform/drivers/omap-rproc# devmem2 0x40400010

    /dev/mem opened.

    Memory mapped at address 0xb6fad000.

    Read at address 0x40400010 (0xb6fad010): 0x10111213

    root@am57xx-evm:/sys/bus/platform/drivers/omap-rproc# devmem2 0x40400014

    /dev/mem opened.

    Memory mapped at address 0xb6f3a000.

    Read at address 0x40400014 (0xb6f3a014): 0x14151617

    root@am57xx-evm:/sys/bus/platform/drivers/omap-rproc# devmem2 0x40400018

    /dev/mem opened.

    Memory mapped at address 0xb6fb6000.

    Read at address 0x40400018 (0xb6fb6018): 0x18191A1B

    root@am57xx-evm:/sys/bus/platform/drivers/omap-rproc# devmem2 0x4040001C

    /dev/mem opened.

    Memory mapped at address 0xb6f18000.

    Read at address 0x4040001C (0xb6f1801c): 0x1C1D1E1F


    The CCS screen as a reference:

      

    You may want to check your DSP OCMC configuraton, or the Linux User Space application to see if there any issue there if the issue still exists after disabling ti-mctd daemon.

     

    Rex

     

     

  • Hi Rex,

    I have tried the multiple iterations and unable to fix it. I have attached my resource table, configuration file along with this post.

    Also please find the user space code used from Linux end.

    Is there any thing to do in Linux DTS to accomplish this?

    I tried using devmem2 and it appears like DSP/write and ARM/Read is not seeing the same memory.

    Please help me fixing this issue.

    Thanks,

    Janardan M

    6646.Documents.zip

  • Hi, Janardan,

    There isn't coherency between ARM and DSP over OCMC. Since, it is not coherent, it requires cache write back operation after write. The consumer requires invalidate after consuming. DEVMEM2 bypasses cache.

    Rex
  • Hi Rex,

    I am doing cache write back operation after the write from DSP end, from ARM I am not doing ivalidate and as of my understanding that is not required from ARM end, correct me if I am wrong.

    I have listed down the  processes running on linux, please let me know if any of the process is causing issue.

      PID USER       VSZ STAT COMMAND
        1 root      1384 S    init [5]
        2 root         0 SW   [kthreadd]
        3 root         0 SW   [ksoftirqd/0]
        4 root         0 SW   [kworker/0:0]
        5 root         0 SW<  [kworker/0:0H]
        7 root         0 SW   [rcu_preempt]
        8 root         0 SW   [rcu_sched]
        9 root         0 SW   [rcu_bh]
       10 root         0 SW   [migration/0]
       11 root         0 SW   [migration/1]
       12 root         0 SW   [ksoftirqd/1]
       14 root         0 SW<  [kworker/1:0H]
       15 root         0 SW<  [khelper]
       16 root         0 SW   [kdevtmpfs]
       17 root         0 SW<  [netns]
       18 root         0 SW<  [perf]
       20 root         0 SW<  [writeback]
       21 root         0 SW<  [crypto]
       22 root         0 SW<  [bioset]
       23 root         0 SW<  [kblockd]
       24 root         0 SW   [irq/330-4807000]
       25 root         0 SW   [irq/36-palmas]
       27 root         0 SW   [irq/331-4806000]
       28 root         0 SW   [irq/332-4807c00]
       29 root         0 SW<  [rpciod]
       30 root         0 SW   [kswapd0]
       31 root         0 SW   [fsnotify_mark]
       32 root         0 SW<  [nfsiod]
       48 root         0 SW   [irq/379-OMAP HD]
       49 root         0 SW   [kworker/u4:1]
       54 root         0 SW   [irq/27-talert]
       55 root         0 SW   [irq/228-4809c00]
       56 root         0 SW   [mmcqd/0]
       78 root         0 SW   [irq/361-4846800]
       79 root         0 SW   [irq/360-4846800]
       80 root         0 SW   [mmcqd/1]
       81 root         0 SW   [mmcqd/1boot0]
       82 root         0 SW   [mmcqd/1boot1]
       83 root         0 SW<  [deferwq]
       85 root         0 SW<  [kworker/1:1H]
       86 root         0 SW   [jbd2/mmcblk0p2-]
       87 root         0 SW<  [ext4-rsv-conver]
       88 root         0 SW   [kworker/1:2]
       89 root         0 SW<  [kworker/0:1H]
       90 root         0 SW   [kworker/0:2]
       96 root         0 SW   [irq/447-4802000]
      121 root      3232 S    /lib/udev/udevd -d
      266 root         0 SW   [kworker/0:3]
      311 root         0 SW<  [ata_sff]
      360 root         0 SW   [irq/448-mcp7941]
      366 root         0 SW   [irq/449-2-006f]
      377 root         0 SW<  [pvr_timer]
      401 root         0 SW   [irq/259-extcon_]
      402 root         0 SW   [irq/258-palmas_]
      474 root         0 SW   [kworker/u4:3]
      497 root         0 SW   [irq/73-pixcir_t]
      507 root         0 SW   [scsi_eh_0]
      508 root         0 SW<  [scsi_tmf_0]
      748 root         0 SW   [kjournald]
      797 root         0 SW<  [cryptodev_queue]
      815 root      1368 S    /usr/sbin/rngd
      942 root      1988 S    udhcpc -R -b -p /var/run/udhcpc.eth0.pid -i eth0
      949 messageb  2616 S    /usr/bin/dbus-daemon --system
      956 root      1236 S    /usr/bin/uim -f /sys/./devices/platform/kim
      959 root         0 SW<  [pvr_workqueue]
      964 root      2320 S    {runWeston} /bin/bash /usr/bin/runWeston
      971 root     24856 S    weston --idle-time=0
      974 root      3228 S    /lib/udev/udevd -d
      975 root      3228 S    /lib/udev/udevd -d
      976 root         0 SW<  [ipv6_addrconf]
      977 root      2256 S    /usr/sbin/dropbear -r /etc/dropbear/dropbear_rsa_hos
      980 root      1988 S    /usr/sbin/telnetd
      983 root      7400 S    /usr/lib/weston/weston-keyboard
      984 root      9840 S    /usr/bin/lad_dra7xx -g -l lad.txt
      989 root      8436 S    /usr/lib/weston/weston-desktop-shell
      990 rpc       2220 S    /usr/sbin/rpcbind
      995 rpcuser   1988 S    /usr/sbin/rpc.statd
     1002 root      1988 S    /sbin/syslogd -n -O /var/log/messages
     1004 root         0 SW   [kworker/1:3]
     1006 root      1988 S    /sbin/klogd -n
     1009 nobody    2476 S    /usr/sbin/thttpd -d /srv/www -p 8080
     1015 avahi     3392 S    avahi-daemon: running [am57xx-evm.local]
     1016 avahi     3392 S    avahi-daemon: chroot helper
     1027 root      4572 S    /usr/sbin/ofonod
     1036 root      5192 S    /usr/sbin/lighttpd -f /etc/lighttpd.conf
     1063 root      179m S    /usr/bin/matrix_browser http://localhost:80/
     1206 root      3400 S    /bin/login --
     1207 root      1992 S    /sbin/getty 38400 tty1
     1210 root         0 SW   [kworker/0:1]
     1211 root         0 SW   [kworker/1:0]
     1212 root      2736 S    -sh
     1213 root      2404 R    ps

    I tried to access the DDR - SDRAM memory at address 0x81000000, below attached is the memory locations as seen from CCS memory window after writes are done from DSP, it appears to be proper.

    I tried to read this data back from A15 using devmem2. Results are as below.

    root@am57xx-evm:~# devmem2 0x81000000
    /dev/mem opened.
    Memory mapped at address 0xb6f4a000.
    Read at address  0x81000000 (0xb6f4a000): 0x00000000
    root@am57xx-evm:~# devmem2 0x81000004
    /dev/mem opened.
    Memory mapped at address 0xb6f9b000.
    Read at address  0x81000004 (0xb6f9b004): 0x00000000
    root@am57xx-evm:~# devmem2 0x81000008
    /dev/mem opened.
    Memory mapped at address 0xb6f7b000.
    Read at address  0x81000008 (0xb6f7b008): 0x00000000
    root@am57xx-evm:~# devmem2 0x8100000C
    /dev/mem opened.
    Memory mapped at address 0xb6fb5000.
    Read at address  0x8100000C (0xb6fb500c): 0x00000000
    root@am57xx-evm:~# devmem2 0x81000010
    /dev/mem opened.
    Memory mapped at address 0xb6f0c000.
    Read at address  0x81000010 (0xb6f0c010): 0x00000000
    root@am57xx-evm:~# devmem2 0x8100023C
    /dev/mem opened.
    Memory mapped at address 0xb6f9a000.
    Read at address  0x8100023C (0xb6f9a23c): 0x00000000
    root@am57xx-evm:~# devmem2 0x8100035C
    /dev/mem opened.
    Memory mapped at address 0xb6fbb000.
    Read at address  0x8100035C (0xb6fbb35c): 0x00000000
    root@am57xx-evm:~#

     All values are read zeros, I am not able to figure out the issue.

    To use SDRAM as shared memory between ARM-DSP, am I supposed to do any configurations from ARM/DSP side?

    Thanks,

    Janardan

  • Hi, Janardan,

    Isn't the OCMC used for the shared memory? If you are using OCMC, why is it the DDR memory at 0x81000000 dumped? Shouldn't you dump the ocmc2 memory at 0x40400000 or ocmc3 at 0x40500000?

    Rex
  • HI Rex,

    When I use 0x40300000 or 0x40400000 OCMC memories, I was observing kernel crash , so I wanted to check with the SDRAM as well, using SDRAM as shared memory is also fine for our requirement.

    Please provide me details regarding usage of OCMC as shared memory and also on using SDRAM as shared memory.

    I am not able to figure out the dependencies. I see that it is working on your setup from your post, I believe I am doing something wrong . Presently I am following below sequence.

    1. Write to memory from DSP (dra7-dsp1-fw.xe66 loaded from linux through remote-proc)
    2. Read back the memories through devmem2

    Is there anything to do on DTS or any other dependencies from Linux end?
    Is there anything to do in configuration file or resource table from DSP end?

    Expecting your kind help.

    Thanks,
    Janardan
  • Hello Rex,

    Sounds like an interesting issue.  

    Would you please share a sample application that works on your setup which can be tried as is? Please provide the detail steps/changes required.

    Appreciate your quick help.

    - Rj

     

  • Janardan>>>
    I am doing cache write back operation after the write from DSP end, from ARM I am not doing invalidate and as of my understanding that is not required from ARM end, correct me if I am wrong.

    Rex,
    Can you please comment on this? Thanks
  • Hi, Raj & Janardan,

    I just try with default dtb file from release. That means no changes at all. I am able to modify OCMC2 from DSP side and devmem2 dump correcctly from Linux on ARM.

    Rex
  • By the way, I will be off for the holiday and won't be back in office till 12/3. I don't see any issue with the OCMC shared memory. In case you still have questions, it will be after I get back to office before I can access the forum.
  • Hi Rex,

    Which version of Processor SDK linux are you using?

    Thanks,

    Janardan

  • Hi Rex,


    Taking forward the conversation, we are still facing issue using SDRAM / OCMC as shared memory.

    We tried to use L2S RAM as shared memory between DSP-ARM, L2S is internal to DSP sub-system and is working fine, DSP/Write -> ARM/Read and ARM/Write -> DSP/read is working fine on this memory.

    Here is the sequence I followed.


    1. Access L2S memory from DSP through a pointer and write to that memory.

    2. From arm end ,converted the L2S memory address into Global address

    3. Used this global address to read the memory

    This is working as expected, but we need to get this shared memory working on SDRAM and OCMC as well, please help us figuring out the issue.

    Thanks,

    Janardan

  • Hi, Janardan,

    Sorry, I have been out since Thanksgiving and didn't have access to the forum.

    I was using 5.0 release. I assume you made changes to DTS to configure the OCMC2 and/or OCMC3 on Linux side.
    I am not sure if you read the IPC documentation. Please check the IPC page, software-dl.ti.com/.../Foundational_Components_IPC.html

    All info in the IPC page are helpful for your multicore application. There is a AM57x Customizing Multicore Application, www.ti.com/.../sprac60.pdf. It describes several options of using CMEM or CMA.

    In the IPC User's Guide (RTOS) which there is a link in IPC page, you should find a IPC Custom Resource Table. It specifies what areas are used by DSP and for Linux to grant access to them.

    Rex