I was working on I.MX7D sabre for rpmsg communication got one query
I have seen imx7d-sdb-m4.dtsi the memory allocated for rpmsg communication is 64kb but logical when I calculate(512 buffers * 512 byte size = 256kb). But the question is from where remaining 192kb memory will get allocated ??
refs : linux-fslc/imx7d-sdb-m4.dtsi at 4.14-2.0.x-imx · Freescale/linux-fslc · GitHub
&rpmsg{
vdev-nums = <1>;
reg = <0xbfff0000 0x10000>; //0x10000 -> 64kb
status = "okay";
};
Thank you for support!
Dear @Yasir_NL
I need to get into more detail about memory used for the rpmsg communication:
The memory used to transmit messages between M4 and A7 is split into two regions:
-
A linked list VRING, which contains (in a simplified view) only a list of pointers. Each pointer points to an actual message.
- To be a bit more precise, there are two such lists VRING0 and VRING1, one for the communication A7 → M4, and one for the communication M4 → A7.
-
The actual storage (virtual queue) for the messages themselves.
First Region: VRING0 and VRING1
The VRING0 and VRING1 storage is located at 0xbfff0000, as you found it in the device tree.
VRING0 and VRING1 each occupy roughly 26 bytes for every entry, so for 256 buffers this would be 6.6kB. Due to alignment requirements it is 10.1kB for each VRING0 and VRING1.
Second Region: Virtual Queue
This memory region is not at a fixed position. Instead Linux allocates it dynamically from the shared-dma-pool.
Regards, Andy
While booting board I have seen below log. dma_alloc_coherent_xxxx allocates buffers for rpmsg communication ?
DMA: preallocated 256 KiB pool for atomic coherent allocations
Thanks you support
Dear @Yasir_NL
Not really. This pool is used by Linux for various components, rpmsg being one of them.
Regards, Andy
Is only linux will allocate memory for buffers or freeRTOS will also allocate memory for buffer?
How freeRTOS will know about the allocated buffers by linux?
Thank you for support
Dear @Yasir_NL
Only Linux allocates the memory buffers for Rpmsg. The buffer addresses are communicated to the M4 as part of the Rpmsg protocol.
Regards, Andy
Thank you for kind support