[PATCH 03/11] ASoC: SOF: ipc: Add max_payload_size field in struct snd_sof_ipc

Ranjani Sridharan ranjani.sridharan at linux.intel.com
Wed Mar 30 22:19:18 CEST 2022


From: Peter Ujfalusi <peter.ujfalusi at linux.intel.com>

The max_payload_size is an IPC level constraint. Add a new field,
max_payload_size to struct snd_sof_ipc and set it during IPC init.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi at linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen at linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao at linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta at nxp.com>
Reviewed-by: Rander Wang <rander.wang at intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
---
 sound/soc/sof/ipc.c      | 2 ++
 sound/soc/sof/sof-priv.h | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c
index 5f5753608c79..af2efc1c8436 100644
--- a/sound/soc/sof/ipc.c
+++ b/sound/soc/sof/ipc.c
@@ -1005,6 +1005,8 @@ int sof_ipc_init_msg_memory(struct snd_sof_dev *sdev)
 	if (!msg->reply_data)
 		return -ENOMEM;
 
+	sdev->ipc->max_payload_size = SOF_IPC_MSG_MAX_SIZE;
+
 	return 0;
 }
 
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 93de5547b952..f75c6f76297e 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -394,6 +394,9 @@ struct snd_sof_ipc {
 	/* disables further sending of ipc's */
 	bool disable_ipc_tx;
 
+	/* Maximum allowed size of a single IPC message/reply */
+	size_t max_payload_size;
+
 	struct snd_sof_ipc_msg msg;
 
 	/* IPC ops based on version */
-- 
2.25.1



More information about the Alsa-devel mailing list