AM6442: Am64x: Issue replacement of dma_buff_phys with CDev driver

Part Number: AM6442


Tool/software:

Hi team,

I am trying to use the shared memory between remote core [RF51_0] and Linux [a53 core]. Initially we were using dma_buf_phys driver in he sdk 9.2.1.10. Now we have moved to Processor sdk 11.01.05.03 and found that there is a replacement of dma_buff_phys with the remoteproc CDev driver.

Remote Core Details: r5f1_0

When I try to use the example in the zerocopy , I found the following observation.

and when i checked /dev/ I found the following 

The rproc id that i have refered to is 4 for r5f1_0

Is there any changes to be done.

How do I proceed further to use the shared memory between A53 and remote core

Thank You,

Mamatha B M 

  • Hi, the domain expert is out of office for the next few days. Please expect delayed response. 

  • Hi Bin,

      I hope the domain expert is available now.

       Is there any update on this as we wanted to get it resolved at the earliest. 

    Thank you

    Mamatha B M 

  • For future readers, Mamatha is using the rpmsg_char_zerocopy project as a starting point:
    https://git.ti.com/cgit/rpmsg/rpmsg_char_zerocopy/

    Hello Mamatha,

    Hmm. It looks like function "dmabuf_heap_alloc" is forming rproc_name by taking rproc_id and putting it at the end of "/dev/remoteproc%d"
    https://git.ti.com/cgit/rpmsg/rpmsg_char_zerocopy/tree/linux/src/rpmsg_char_zerocopy.c 

    /* Allocate dma-buf from dma-heap, mmap locally, get the phys address
     * and setup the buffer data we want to pass to the remote endpoint
     * in ipc_buf and the local data we want to keep in local_buf.
     */
    int dmabuf_heap_alloc(int rproc_id, int dma_heap_fd, int size,
    		       struct local_buf *lbuf,
    		       struct ipc_buf *ibuf)
    {
    ...
    	sprintf(rproc_name, "/dev/remoteproc%d", rproc_id);
    	rproc_fd = open(rproc_name, O_RDONLY | O_CLOEXEC);
    	if (rproc_fd < 0) {
    		printf("Failed to open %s: -%d\n", rproc_name, errno);
    		return -1;
    	}

    But that is not how the code should run, because rproc_id is a fixed value for each core. On the other hand, /dev/remoteprocX is not a fixed value. The X value is assigned by order of which core gets initialized first, which means that which core is associated with a specific remoteprocX number can actually change on each boot.

    We can look at function _rpmsg_char_find_rproc() as a reference. rproc_id is used to find the correct remoteprocX instance, and it sets ept->remoteproc_id == X.
    https://git.ti.com/cgit/rpmsg/ti-rpmsg-char/tree/src/rpmsg_char.c 

    Please try to modify rpmsg_char_zerocopy > dmabuf_heap_alloc to look like _rpmsg_char_find_rproc(). Please let me know if this works, if so I will update the zerocopy project with the new code.

    Regards,

    Nick

  • Hi Nick,

        I did the changes as you suggested i.e. use _rpmsg_char_find_rproc() api to get the details remoteprocX value. I was able to proceed further.

    Thank You,

    Mamatha B M 

  • Hello Mamatha,

    Thank you for reporting the bug, and for confirming that you are able to move forward! I have filed a bug report so that we make sure to circle back and fix this code in the future.

    Regards,

    Nick