Implement high-performance via shared-memory communication between A53 m4

TI suggests using the RPMsg zerocopy-method, where:

1.bulk data resides in a shared memory region
2.RPMsg is used only as a notification mechanism

We want to ensure that the OSD62 BSP supports all required components and to confirm the correct steps to enable this.

1. Requesting Guidance on Shared Memory Setup:
To use rpmsg_char_zerocopy, we need a shared DDR region that both A53 and M4 can access.
The correct memory address & size for this carve-out

2. M4 Access to Shared DDR
For M4 to access the same physical DDR region, TI normally uses RAT (Region-Based Address Translation) or fixed mapping.

We need clarification on:

1.How the OSD62-PM-BRK maps shared DDR for the M4 core?
2.Whether RAT configuration is required for this board
3.Any example memory mapping/linker script you provide for M4 firmware

Meera,

Q: How the OSD62-PM-BRK maps shared DDR for the M4 core?
OSD62-PM-BRK sets up the DDR carveouts for M4 core same as AM62x-SK. Here is the device tree snippet for reserved-memory for BRK: osd62-pm-brk-tisdk/ti-linux-kernel-6.6.58+git-ti/0001-Add-Device-Tree-support-for-OSD62-PM-BRK.patch at v10 · octavosystems/osd62-pm-brk-tisdk · GitHub. This matches with TI DMA carveouts: 3.8. IPC for AM62x — Processor SDK AM62x Documentation

Q: Whether RAT configuration is required for this board
Yes. The only thing to keep in mind is the memory start address and size. OSD62-PM DDR start address is the same as AM62x-SK, but the size is 1GB: reg = <0x00000000 0x80000000 0x00000000 0x40000000>;

The RAT setting is exclusive to the M4 core. Nothing needs to be done on Linux side of things except for carveouts. See example.syscfg « m4fss0-0_freertos « am62x-sk « rtos - rpmsg/rpmsg_char_zerocopy - Unnamed repository; edit this file 'description' to name the repository. for the example configuration in the zerocopy example. Additional info here: https://dev.ti.com/tirex/explore/node?node=A__AXBsTEetU2hiTMZSzq4row__AM62A-ACADEMY__WeZ9SsL__LATEST

Q: Any example memory mapping/linker script you provide for M4 firmware
You should be able to use the example you pointed to by setting up a carveout:
Add a new 32MB range named “apps-shared-memory” at 0xa6000000.

reserved-memory {
	...
	apps-shared-memory {
		compatible = "dma-heap-carveout";
		reg = <0x00 0xa6000000 0x00 0x2000000>;
		no-map;
	};
 	...
}

and point to the carveout like:
with the default pattern:

# ./rpmsg_char_zerocopy -r 9 -e apps-shared-memory

I have enabled patch for shared memory blob between MPU and MCU



diff --git a/arch/arm64/boot/dts/ti/k3-am625-osd625-brk.dts b/arch/arm64/boot/dts/ti/k3-am625-osd625-brk.dts
index 26f400d69f17..b9b491852bcf 100644
--- a/arch/arm64/boot/dts/ti/k3-am625-osd625-brk.dts
+++ b/arch/arm64/boot/dts/ti/k3-am625-osd625-brk.dts
@@ -111,6 +111,12 @@ hyp_mem: jailhouse@dfa00000 {
 			alignment = <0x1000>;
 			no-map;
 		};
+
+		apps-shared-memory {
+			compatible = "dma-heap-carveout";
+			reg = <0x00 0xa6000000 0x00 0x02000000>;  /* 32MB at 0xa6000000 */
+			no-map;
+		};
 	};
 
 	leds {


root@osd62-pm-brk:~#  ./rpmsg_char_zerocopy -r 9 -e apps-shared-memory
_rpmsg_char_find_ctrldev: could not find the matching rpmsg_ctrl device for virtio0.rpmsg_chrdev.-1.16
Can't create an endpoint device: Invalid argument
TEST STATUS: FAILED 

Please tell me which code m4-core should run to make zerocopy example work.

Hey Meera,

My apologies for the delayed response. Hope you have made some progress on this issue. Looking at the log above, it seems like the linux application cannot find the remote M4 core according to the configuration in code. The remote endpoint is defined here in the linux application code: https://git.ti.com/cgit/rpmsg/rpmsg_char_zerocopy/tree/linux/src/rpmsg_char_zerocopy.c#n55.

Running “readlink -f /sys/bus/rpmsg/devices/virtio0.rpmsg_chrdev*” should show you a path that corresponds to the m4fss core. Please check on your board.

Looking at /sys/bus/rpmsg/devices/ I can see virtio0.rpmsg_chrdev.-1.14 but not 1.16 on the default BRK image I am running. Can you try modifying the linux code and recompiling? I will try to get the example running on my end and see if I run into any issues.

Best,
Neeraj

Hi Niraj,
Yes I have to add ti-rpmsg-char package in my Yocto to enable this support. After that the test has been passed so I am now able to use that shared memory region between MPU and MCU.

Awesome! thanks for the update.

Best,
Neeraj