From 3dd7fd4f7014fffff0d8ca28d62274e380bcf9f8 Mon Sep 17 00:00:00 2001 From: Carlo Caione Date: Wed, 25 Aug 2021 15:20:44 +0200 Subject: [PATCH] ipc: Call ipm_set_enabled() on RX channel also for dual IPM support The IPC drivers rpmsg_service and rpmsg_multi_instance are not explicitly enabling the RX IPM channel when two different devices are used for TX and RX. While this could be redundant for some IPM drivers, in some cases the hardware needs to be enabled before using it. Add the missing calls to ipm_set_enabled() for both the devices. Signed-off-by: Carlo Caione --- subsys/ipc/rpmsg_multi_instance/rpmsg_multi_instance.c | 6 ++++++ subsys/ipc/rpmsg_service/rpmsg_backend.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/subsys/ipc/rpmsg_multi_instance/rpmsg_multi_instance.c b/subsys/ipc/rpmsg_multi_instance/rpmsg_multi_instance.c index f21f93d0971..82d00916a6b 100644 --- a/subsys/ipc/rpmsg_multi_instance/rpmsg_multi_instance.c +++ b/subsys/ipc/rpmsg_multi_instance/rpmsg_multi_instance.c @@ -267,6 +267,12 @@ int rpmsg_mi_ctx_init(struct rpmsg_mi_ctx *ctx, const struct rpmsg_mi_ctx_cfg *c /* Register IPM callback. This cb executes when msg has come. */ ipm_register_callback(ctx->ipm_rx_handle, ipm_callback, ctx); + err = ipm_set_enabled(ctx->ipm_rx_handle, 1); + if (err != 0) { + LOG_ERR("Could not enable IPM interrupts and callbacks for RX"); + return err; + } + ctx->vq[RPMSG_VQ_0] = virtqueue_allocate(vring_size); if (!ctx->vq[RPMSG_VQ_0]) { LOG_ERR("virtqueue_allocate failed to alloc vq[RPMSG_VQ_0]"); diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend.c b/subsys/ipc/rpmsg_service/rpmsg_backend.c index 07902811f80..3f1a7ed98cc 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_backend.c +++ b/subsys/ipc/rpmsg_service/rpmsg_backend.c @@ -229,6 +229,13 @@ int rpmsg_backend_init(struct metal_io_region **io, struct virtio_device *vdev) } ipm_register_callback(ipm_rx_handle, ipm_callback, NULL); + + err = ipm_set_enabled(ipm_rx_handle, 1); + if (err != 0) { + LOG_ERR("Could not enable IPM interrupts and callbacks for RX"); + return err; + } + #elif defined(CONFIG_RPMSG_SERVICE_SINGLE_IPM_SUPPORT) ipm_handle = device_get_binding(CONFIG_RPMSG_SERVICE_IPM_NAME);