How to change the size of RPMSG buffer?

I want to increase the RPMSG buffer size from 512 bytes to 1024 bytes.
I already try to increase the size of the buffer to 1024 Byte but it’s doesn’t work for the moment. I should misunderstand something.

In the futur i want to reach buffer size of 16384 or 32768 bytes

What should i change ?

If refer to the Toradex documentation : Change RPmsg Buffer Count and Size

On A7 Linux side :

imx_rpmsg.c - RPMSG_NUM_BUFS 256 → 1024

imx_rpmsg.c - RPMSG_BUF_SIZE 512 → 2048 // (RPMSG_NUM_BUFS *2 i guess)

On M4 freeRTOS side :

rpmsg_core.h - RPMSG_BUFFER_SIZE 512 → 2048

platform_info.c - RPMSG_NUM_BUFS 256 → 1028

platform_info.c - VRING0_BASE → 0x8FFF0000 → Should i change the address ?

platform_info.c - VRING1_BASE → 0x8FFF0000 → Should i change the address ?

By default, the shared memory for the two rpmsg virtio_ring is 0x8FFF0000 and 0x8FFF8000 into M4 DRAM area.

If i have to set another address for the VRING 0 & 1 that is mean i have to change it into device tree? Or another place?

Thanks for the support

Dear @joel_mcm

There’s a number of constants which must be manually kept identical on both freeRTOS and Linux:

  • RPMSG_NUM_BUFS
  • VRING0_BASE
  • VRING1_BASE

The size of a single data buffer can be configured on the rpmsg master side only:

  • RPMSG_BUFFER_SIZE

To get a step-by-step approach, I recommend to

  1. Start with a modification of RPMSG_BUFFER_SIZE only.
    Can you do that successfully?
  2. Reduce the value of RPMSG_NUM_BUFS.
    This is to proof that you are changing the correct constants on both the A7 and M4 side.

Additional Info

The RPMSG_BUF_SIZE and RPMSG_NUM_BUFS are not related:

  • RPMSG_NUM_BUFS is the number of entries in VRING0/VRING1 - two linked lists which limit the number of messages which can be enqueued before they are processed by the other side. One entry consumes 16 bytes., independent of how much data a message contains.

  • RPMSG_BUFFER_SIZE defines, how much data can be stored in a single message.

I hope this can bring some light on the configuration options.

Regards, Andy

Cannot find file imx-rpmsg.c in EmbeddedLinux Version 3.0

root@colibri-imx7-emmc:~# uname -r
4.14.159-00041-g1f43bce17a57

Hi @gada.kashyap

Please don’t hijack any old questions but ask a new one with providing all the information to reproduce your issue.

Thanks and best regards,
Jaski

The file is now located at drivers/rpmsg/imx_rpmsg.c

 /*
     * For now, allocate 256 buffers of 512 bytes for each side. each buffer
     * will then have 16B for the msg header and 496B for the payload.
     * This will require a total space of 256KB for the buffers themselves, and
     * 3 pages for every vring (the size of the vring depends on the number of
     * buffers it supports).
     */
    #define RPMSG_NUM_BUFS		(512)
    #define RPMSG_BUF_SIZE		(512)
    #define RPMSG_BUFS_SPACE	(RPMSG_NUM_BUFS * RPMSG_BUF_SIZE)

But in FreeRTOS the RPMSG_NUM_BUFS are 256 and RPMSG_BUF_SIZE is 512. Why these are different?

Thanks for your Input.

Best regards,
Jaski

No such intention, it was just the topic was related. So commented.

I understand. Actually we try to keep the community clean and organized. That’s why we have this rule.

Thanks for understanding.