library manager: allow sending IPC message if buffer is already prepared.

System service functionality used by 3rd party modules expects
that IPC data buffer will be filled with data during
notification preparation. To avoid additional data copy,
provide message buffer directly to module. This requires
that ipc_msg_send() function will not fail if source data pointer will be
equal to destination one.

Signed-off-by: Stelter, Jaroslaw <jaroslaw.stelter@intel.com>
Signed-off-by: Dobrowolski, PawelX <pawelx.dobrowolski@intel.com>
This commit is contained in:
Dobrowolski, PawelX 2022-08-31 10:14:23 +02:00 committed by Liam Girdwood
parent 0fea6d0050
commit adaebb3e43
1 changed files with 3 additions and 2 deletions

View File

@ -190,8 +190,9 @@ void ipc_msg_send(struct ipc_msg *msg, void *data, bool high_priority)
key = k_spin_lock(&ipc->lock); key = k_spin_lock(&ipc->lock);
/* copy mailbox data to message */ /* copy mailbox data to message if not already copied */
if (msg->tx_size > 0 && msg->tx_size < SOF_IPC_MSG_MAX_SIZE) { if ((msg->tx_size > 0 && msg->tx_size < SOF_IPC_MSG_MAX_SIZE) &&
msg->tx_data != data) {
ret = memcpy_s(msg->tx_data, msg->tx_size, data, msg->tx_size); ret = memcpy_s(msg->tx_data, msg->tx_size, data, msg->tx_size);
assert(!ret); assert(!ret);
} }