ASoC: SOF: ipc: Add max_payload_size field in struct snd_sof_ipc
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Wed, 30 Mar 2022 20:19:18 +0000 (13:19 -0700)
committerMark Brown <broonie@kernel.org>
Mon, 4 Apr 2022 07:39:03 +0000 (08:39 +0100)
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@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220330201926.1330402-4-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/ipc.c
sound/soc/sof/sof-priv.h

index 5f5753608c7939c2790f8a0199c9bafc47e4bad1..af2efc1c8436ea586b43840ec945859fe2a518c9 100644 (file)
@@ -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;
 }
 
index 93de5547b95221cce9c629c1b52734ad3c57d72d..f75c6f76297e795083a558614205a89ad7c7c5e9 100644 (file)
@@ -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 */