cancel
Showing results for 
Search instead for 
Did you mean: 

How to increase the RPMsg buffer size?

rengl
Associate II

i want to increase the RPMsg buffer size as suggested in this thread:

https://community.st.com/s/question/0D50X0000AnuE1XSQU/what-is-the-maximum-transmission-interprocessor-bandwidth-on-stm32mp1

i already tried the following:

On the M4:

  • Changing RPMSG_BUFFER_SIZE in rpmsg_virtio.h to 2048 (from 512)

On the A7:

  • Changing MAX_RPMSG_BUF_SIZE in virtio_rpmsg_bus.h to 2048 (from 512)

But if i start the M4 i get the following error from dmesg:

[   88.176478] remoteproc remoteproc0: powering up m4
[   88.180656] remoteproc remoteproc0: Booting fw image A96_CAC_RPMsg2048.elf, size 229920
[   88.193631] stm32-rproc m4@0: iommu not present
[   88.193670] stm32-rproc m4@0: pa 0x38000000 to da 0
[   88.193689] stm32-rproc m4@0: pa 0x30000000 to da 30000000
[   88.193704] stm32-rproc m4@0: pa 0x10000000 to da 10000000
[   88.193719] stm32-rproc m4@0: pa 0x10040000 to da 10040000
[   88.193738] stm32-rproc m4@0: pa 0x10042000 to da 10042000
[   88.193754] stm32-rproc m4@0: pa 0x10044000 to da 10044000
[   88.193777] remoteproc remoteproc0: rsc: type 3
[   88.193791] remoteproc remoteproc0: vdev rsc: id 7, dfeatures 0x1, cfg len 0, 2 vrings
[   88.193914] remoteproc remoteproc0: vdev rsc: vring0: da 0xffffffff, qsz 16, align 16
[   88.193929] remoteproc remoteproc0: vdev rsc: vring1: da 0xffffffff, qsz 16, align 16
[   88.193954] remoteproc remoteproc0: rsc: type 2
[   88.194009] remoteproc remoteproc0: trace0 added: da 0x100209a8, len 0x2000
[   88.194023] stm32-rproc m4@0: map memory: 0x38000000+10000
[   88.194052] stm32-rproc m4@0: map memory: 0x30000000+40000
[   88.194072] stm32-rproc m4@0: map memory: 0x10000000+40000
[   88.194094] stm32-rproc m4@0: map memory: 0x10040000+2000
[   88.194184] stm32-rproc m4@0: map memory: 0x10042000+2000
[   88.194203] remoteproc remoteproc0: phdr: type 1 da 0x0 memsz 0x298 filesz 0x298
[   88.194219] remoteproc remoteproc0: phdr: type 1 da 0x10000000 memsz 0x9e70 filesz 0x9e70
[   88.194312] remoteproc remoteproc0: phdr: type 1 da 0x10009e70 memsz 0x8068 filesz 0x240
[   88.199922] rproc-srm-core m4@0:m4_system_resources: bound m4@0:m4_system_resources:m4_led (ops 0xc0ad1758)
[   88.210056]  m4@0#vdev0buffer: assigned reserved memory node vdev0buffer@10044000
[   88.216563] virtio virtio0: reset !
[   88.216579] virtio virtio0: status: 1
[   88.216897] virtio_rpmsg_bus virtio0: status: 3
[   88.216933] remoteproc remoteproc0: vring0: va 316cec29 qsz 16 notifyid 0
[   88.216957] remoteproc remoteproc0: vring1: va 7e1982ab qsz 16 notifyid 1
[   88.216976] virtio_rpmsg_bus virtio0: status: 131
[   88.217010] virtio_rpmsg_bus: probe of virtio0 failed with error -12
[   88.222453]  m4@0#vdev0buffer: registered virtio0 (type 7)
[   88.232752] remoteproc remoteproc0: remote processor m4 is now up

 I use the resource table from the examples with trace buffer enabled. Do i have to change here something?

struct shared_resource_table __resource __attribute__((used)) resource_table = {
	.version = 1,
	.num = 2,
	.reserved = {0, 0},
	.offset = {
		offsetof(struct shared_resource_table, vdev),
		offsetof(struct shared_resource_table, cm_trace),
	},
	/* Virtio device entry */
	.vdev= {
		RSC_VDEV, VIRTIO_ID_RPMSG_, 0, RPMSG_IPU_C0_FEATURES, 0, 0, 0,
		VRING_COUNT, {0, 0},
	},
 
	/* Vring rsc entry - part of vdev rsc entry */
	.vring0 = {VRING_TX_ADDRESS, VRING_ALIGNMENT, VRING_NUM_BUFFS, VRING0_ID, 0},
	.vring1 = {VRING_RX_ADDRESS, VRING_ALIGNMENT, VRING_NUM_BUFFS, VRING1_ID, 0},
 
	.cm_trace = {
		RSC_TRACE,
		(uint32_t)system_log_buf, SYSTEM_TRACE_BUF_SZ, 0, "cm4_log",
	},
};

Here the relevant part of the device tree (i hope). I suspect i also have to adjust the sizes of vring0, vring1 and buffer? But how is the relation between vring0/1 and buffer? vring0 + vring1 = buffer?:

		vdev0vring0: vdev0vring0@10040000 {
			compatible = "shared-dma-pool";
			reg = <0x10040000 0x2000>;
			no-map;
		};
 
		vdev0vring1: vdev0vring1@10042000 {
			compatible = "shared-dma-pool";
			reg = <0x10042000 0x2000>;
			no-map;
		};
 
		vdev0buffer: vdev0buffer@10044000 {
			compatible = "shared-dma-pool";
			reg = <0x10044000 0x4000>;
			no-map;
		};

1 REPLY 1
rengl
Associate II

After updating this thread i had the idea to decrease the number of vring buffers (VRING_NUM_BUFFS) in the resource table.

If you multiply the buffer size by 4 and divide the number of buffers by 4 your total size stays the same.

That works.

But how do i increase the buffer size while keeping the number of buffers the same?