ipc: rpmsg_service: Support IPM without data transfer

RPMsg currently sends four dummy bytes over the IPM when sending a
notification/interrupt to another CPU. However, most IPM drivers
support sending messages with no data transfer, and for some IPM
drivers, like the STM32 HSEM IPM driver, data transfer is not
possible at all, thus breaking compatibility. To fix this, send an
empty message with size 0 instead of a dummy message if the STM32
HSEM IPM driver is active.

Signed-off-by: Celina Sophie Kalus <hello@celinakalus.de>
This commit is contained in:
Celina Sophie Kalus 2024-02-08 12:40:49 +01:00 committed by Fabio Baltieri
commit 19c8fa2441

View file

@ -129,8 +129,17 @@ static void ipc_virtio_notify(struct virtqueue *vq)
uint32_t current_core = sse_200_platform_get_cpu_id(); uint32_t current_core = sse_200_platform_get_cpu_id();
status = ipm_send(ipm_handle, 0, current_core ? 0 : 1, 0, 1); status = ipm_send(ipm_handle, 0, current_core ? 0 : 1, 0, 1);
#elif defined(CONFIG_IPM_STM32_HSEM)
/* No data transfer, only doorbell. */
status = ipm_send(ipm_handle, 0, 0, NULL, 0);
#else #else
uint32_t dummy_data = 0x55005500; /* Some data must be provided */ /* The IPM interface is unclear on whether or not ipm_send
* can be called with NULL as data, thus, drivers might cause
* problems if you do. To avoid problems, we always send some
* dummy data, unless the IPM driver cannot transfer data.
* Ref: #68741
*/
uint32_t dummy_data = 0x55005500;
status = ipm_send(ipm_handle, 0, 0, &dummy_data, sizeof(dummy_data)); status = ipm_send(ipm_handle, 0, 0, &dummy_data, sizeof(dummy_data));
#endif /* #if defined(CONFIG_SOC_MPS2_AN521) */ #endif /* #if defined(CONFIG_SOC_MPS2_AN521) */