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.

PROCESSOR-SDK-AM62X: PROCESSOR-SDK-AM62X

Part Number: PROCESSOR-SDK-AM62X

Tool/software:

Hi,

I'm trying to test the Linux <-> M4 zero-copy example on my AM62x board running kernel 6.12.13-ti. I downloaded the code from:

https://git.ti.com/cgit/rpmsg/rpmsg_char_zerocopy/

The M4 code loads fine and gets to the point where it is waiting for Linux to connect. On the Linux side, however, when I run the command:

./rpmsg_char_zerocopy -r 9 -e linux,cma

I get this error:

----------------------------------

./rpmsg_char_zerocopy -r 9 -e linux,cma

Created endpt device rpmsg-char-9-394, fd = 4 port = 1025
Exchanging 1 messages with rpmsg device on rproc id 9 ...

Failed to open /dev/remoteproc9: -2

-----------------------------------

The function dmabuf_heap_alloc() is passed rproc_id=9 for M4, but my /dev only has:

crw------- 1 root root 248, 0 Dec 31 18:00 /dev/remoteproc0
crw------- 1 root root 248, 1 Dec 31 18:00 /dev/remoteproc1
crw------- 1 root root 248, 2 Dec 31 18:00 /dev/remoteproc2

Am I supposed to have remoteproc9 under /dev? If so, who creates that device file and at what point?

Thanks.

Ayman

  • Hello Ayman,

    there is a bug

    Thanks for posting. That is definitely a bug.

    rproc_id is a fixed value defined at https://git.ti.com/cgit/rpmsg/ti-rpmsg-char/tree/include/rproc_id.h 

    remoteprocX is NOT a fixed value. It is assigned at boot time, so it can change each boot cycle, and should not be used to identify cores.

    You can still run the example on Linux kernel 6.6. I have not gotten the chance to validate on Linux kernel 6.12 yet

    The command you used is incorrect. If you want to allocate from the CMA heap, do not use the -e argument. Please search for the "Examples" section in the README:
    https://git.ti.com/cgit/rpmsg/rpmsg_char_zerocopy/tree/linux/README.md

    Please do me a favor and retry based on the example for "cma-reserved dma-heap". It may still fail, but then I know for sure you're giving the code the expected inputs.

    If I can get you to test with a carveout allocated in the Linux devicetree file, that should tell us if Linux kernel 6.12 works the same as Linux kernel 6.6 without any changes. I know for sure that I validated that memory allocation as working back in 2024, e.g. https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1448394/sk-am64b-rpmsg-between-a53-and-r5-performance-update-cont/5554798#5554798

    I will try to set aside some time for fixing the bug and validating Linux kernel 6.12 over the next couple days, but your input can help me get that done faster.

    Regards,

    Nick

  • Hi Nick,

    Thanks for checking this. At first, I tried to run the example for "cma-reserved dma-heap" as you requested. However, I was getting this error:

    ----------

    root@etn-cbc9000:/lib/firmware# rpmsg-zcp -r 9 -s 128
    Created endpt device rpmsg-char-9-1167, fd = 4 port = 1025
    Exchanging 1 messages with rpmsg device on rproc id 9 ...

    Failed to open /dev/dma_heap/reserved: -2
    TEST STATUS: FAILED

    ----------

    Since "-e" isn't passed, the dmaheap_open() is passed "reserved" (DMA_HEAP_RESERVED) for the heap_name and it can't find /dev/dma_heap/reserved.

    My device tree file "k3-am62x-sk-common.dtsi" has this subnode under the "reserved-memory" node:


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

                    ....

                     /* global cma region */
                     linux,cma {
                               compatible = "shared-dma-pool";
                               reusable;
                               size = <0x00 0x8000000>;
                               linux,cma-default;
                      };

    At boot time, I have this device file under /dev/dma_heap/

    crw------- 1 root root 253, 1 Dec 31 18:00 /dev/dma_heap/linux,cma

    and that's why I was using the explicit "-e linux,cma" option. So, it seems to me there is inconsistency between what the code is looking for DMA_HEAP_RESERVED under /dev/dma_heap and what the device tree file has for the "linux,cma" node name. When I pass "-e linux,cma", the dmaheap_open() succeeds, but then get the error in my original posting. I don't think this is 6.6 vs 6.12 issue but let me know if you want me to try something.

    Thanks again for your help.

    -Ayman

  • Hello Ayman,

    Ok. So it looks like the CMA allocation option is broken (as I would expect from looking at the source code).

    For now, please use a memory carveout defined in the Linux devicetree instead of CMA. I do not see anything huge that changed from Linux kernel 6.6 to kernel 6.12, so hopefully that allows you to keep making progress with your development while I work through things on my end.

    I've run out of time for this week. My plan is to finish running RPMsg benchmark tests early next week, and then pivot to the zerocopy example around midweek. Please keep me honest and check back in if you haven't heard anything by Wednesday.

    Regards,

    Nick

  • Hello Ayman,

    Checking back in. I have the bug report filed against the zerocopy example, but neither I nor the development team have had time to work on it yet.

    Were you able to make progress for now with memory carveouts? Anything else needed from my side in the near term?

    Regards,

    Nick

  • Hi Nick,

    yes, I was able to get it to work with memory carveout. I still like to use CMA since it is already allocated in the device tree by default. So, let me know when you have it fixed. Thanks for following up.

    -Ayman

  • Hello Ayman,

    Understood. We have not addressed it yet, but it is on our TODO list ahead of AM62x SDK 11.1 (planned for July/August timeframe).

    Regards,
    Nick