cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
3,591 Views
Registered: ‎02-21-2017

RPMsg size

Hi 

 

I have basic question , I am newbie  with OpenAmp

I am trying to create communication channel between R5 and A53 processors on UltraScale MPSoc , R5 running free RTOS and  A53 running Linux  

I want to send 1024 bytes buffer from R5 to A53 via rpmsg_send function .

 

As I understand , the message actually  sent via VIRIO mechanism, when the size of VRING buffers in R5 ( free rtos) side defined in rsc_table.c file

See below my  remote_resource_table structure

 

#define NUM_VRINGS                  0x02

#define VRING_ALIGN                 0x1000

#define RING_TX                     0x3ED40000

#define RING_RX                     0x3ED44000

#define VRING_SIZE                  256

 

#define NUM_TABLE_ENTRIES           3

 

struct remote_resource_table __resource resources = {

       /* Version */

       1,

 

       /* NUmber of table entries */

       NUM_TABLE_ENTRIES,

       /* reserved fields */

       {0, 0,},

 

       /* Offsets of rsc entries */

       {

        offsetof(struct remote_resource_table, rproc_mem),

        offsetof(struct remote_resource_table, fw_chksum),

        offsetof(struct remote_resource_table, rpmsg_vdev),

        },

 

       {RSC_RPROC_MEM, 0x3ed40000, 0x3ed40000, 0x100000, 0},

 

       /* firmware checksum */

       {RSC_FW_CHKSUM, "sha256", {0}},

 

       /* Virtio device entry */

       {

        RSC_VDEV, VIRTIO_ID_RPMSG_, 0, RPMSG_IPU_C0_FEATURES, 0, 0, 0,

        NUM_VRINGS, {0, 0},

        },

 

       /* Vring rsc entry - part of vdev rsc entry */

       {RING_TX, VRING_ALIGN, VRING_SIZE, 1, 0},

       {RING_RX, VRING_ALIGN, VRING_SIZE, 2, 0},

};

 

 

 

The size of my vring buffer is 256 , and I have only 2 such buffers?  I understand it right?

If I want to send 1024 bytes , do I need to send it in parts of (256*2 = 512) bytes? Or the VIRTIO mechanism knows to do the buffer decomposing and composing back by itself?

 

If I want to decrease the size of buffer which I can to transfer as one peace , what I need to do , on Linux side and freeRtos side ?  There is example for that?

 

 

Thanks a lot.

 

 

0 Kudos
5 Replies
Highlighted
Moderator
Moderator
3,556 Views
Registered: ‎05-10-2017

Re: RPMsg size

To decrease the buffer size, RPMSG_BUFFER_SIZE must be changed in rpmsg_core.h

If you want to use the proxy demo, then in rpmsg_retarget.h, on the firmware side RPC_BUFF_SIZE will need to be changed as well.

On the linux kernel side MAX_RPMSG_NUM_BUFS in drivers/rpmsg/virtio_rpmsg_bus.c

 

To send 1024 bytes,

you will need to split the data into multiple rpmsgs.

On the firmware side, you can increase the size of the buffers in the resource table.

On the Linux kernel side, you will need to change the MAX_RPMSG_NUM_BUFS in drivers/rpmsg/virtio_rpmsg_bus.c

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Highlighted
Participant
Participant
3,445 Views
Registered: ‎01-31-2018

Re: RPMsg size

 

I am working on XSDK and Petalinux 2015.4. I'm running Linux on PS0 and Baremetal of PS1.

 

I want to transfer some data of 13Kbytes from PS0 to PS1 via RPMSG and vice versa. 

 

I will need to increase the buffer size in the following files:

1) petalinux kernel - virtio_rpmsg_bus.c

2) user modules - rpmsg_echo_test_kern_app.c / rpmsg_mat_mul_kern_app.c / rpmsg_proxy_dev_driver.c / promsg_user_dev_driver.c

3) XSDK BSP - rpmsg_core.h

4) XSDK - rsc_table.c

 

I can only increase the buffer size from 512bytes to 1024 bytes and I could transfer 1K from both sides of PS.

 

However, if I increase the buffer size to 2048bytes (1-3 above)  and 1024 bytes (4 above), I got an error message after I load the BM.

 

virtio_rpmsg_bus virtio0: msg received with no recipient

 

I know RPMSG is not suitable for very large buffer, like in the ~M byte range.

 

Is 13K bytes on one direction considered very large?

 

If not, what other files should I modify to accommodate 13K bytes for PS0 to PS1 and PS1 to PS0.

 

Thanks.

0 Kudos
Highlighted
Participant
Participant
3,430 Views
Registered: ‎01-31-2018

Re: RPMsg size

 

ok. Realized my mistake ...

 

MAX_RPMSG_NUM_BUFS * RPMSG_BUF_SIZE (defined in virtio_rpmsg_bus.c) must be approximately equals to VRING_SIZE (XSDK rsc_table.c)  

0 Kudos
Highlighted
Observer
Observer
3,310 Views
Registered: ‎08-22-2016

Re: RPMsg size

Hi,

 

How did you configure the different defines?

 

I am trying to post buffers with size of 8192. My settings are:

 

virtio_rpmsg_bus.c

 

#define MAX_RPMSG_NUM_BUFS    (512)
#define RPMSG_BUF_SIZE        (8192)

 

rpmsg_core.h

 

#define RPMSG_BUFFER_SIZE                       8192

 

rsc_table.c

 

#define VRING_SIZE                  4096

 

For the moment what I am doing is splitting the messages indicating in a header the number of sub messages.

 

I would appreciate some help,

 

Thanks!!!

 

 

0 Kudos
Highlighted
Observer
Observer
3,281 Views
Registered: ‎08-22-2016

Re: RPMsg size

Hi, finally I was able to make it work. This is how I configured for 8192, with the same logic I tested with 512kB and its working too.

 

 

Remote
--------------
system_helper.h

#define RB_BUF_DATA_SZ                 8192

rpmsg_core.h

#define RPMSG_BUFFER_SIZE           8192

rsc_table.c

#define VRING_SIZE                            256

Petalinux
----------------
rpmsg_core.h

#define RPMSG_BUFFER_SIZE          8192

virtio_rpmsg_bus.c

#define MAX_RPMSG_NUM_BUFS    (32)
#define RPMSG_BUF_SIZE                (8192)

0 Kudos