From: Daniel Baluta <daniel.baluta@oss.nxp.com> To: broonie@kernel.org, alsa-devel@alsa-project.org Cc: daniel.baluta@nxp.com, linux-imx@nxp.com, lgirdwood@gmail.com, peter.ujfalusi@linux.intel.com, yung-chuan.liao@linux.intel.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com, yc.hung@mediatek.com, linux-kernel@vger.kernel.org, Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Subject: [PATCH 3/4] ASoC: SOF: compress: Prevent current kernel running with older FW Date: Tue, 12 Jul 2022 17:15:30 +0300 [thread overview] Message-ID: <20220712141531.14599-4-daniel.baluta@oss.nxp.com> (raw) In-Reply-To: <20220712141531.14599-1-daniel.baluta@oss.nxp.com> From: Daniel Baluta <daniel.baluta@nxp.com> After introducing extended parameters we need to forbid older firmware versions to run with the current and future kernel versions. Although in theory the communication protocol will still work the semantics at application level are undefined. So, prevent this by disallowing older firmwares to run with newer kernels. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> --- sound/soc/sof/compress.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/sof/compress.c b/sound/soc/sof/compress.c index 1204dce29ef9..67139e15f862 100644 --- a/sound/soc/sof/compress.c +++ b/sound/soc/sof/compress.c @@ -167,12 +167,23 @@ static int sof_compr_set_params(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_compr_runtime *crtd = cstream->runtime; struct sof_ipc_pcm_params_reply ipc_params_reply; + struct sof_ipc_fw_ready *ready = &sdev->fw_ready; + struct sof_ipc_fw_version *v = &ready->version; struct snd_compr_tstamp *tstamp; struct sof_ipc_pcm_params *pcm; struct snd_sof_pcm *spcm; size_t ext_data_size; int ret; + if (v->abi_version < SOF_ABI_VER(3, 22, 0)) { + dev_err(component->dev, + "Compress params not supported with FW ABI version %d:%d:%d\n", + SOF_ABI_VERSION_MAJOR(v->abi_version), + SOF_ABI_VERSION_MINOR(v->abi_version), + SOF_ABI_VERSION_PATCH(v->abi_version)); + return -EINVAL; + } + tstamp = crtd->private_data; spcm = snd_sof_find_spcm_dai(component, rtd); -- 2.27.0
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Baluta <daniel.baluta@oss.nxp.com> To: broonie@kernel.org, alsa-devel@alsa-project.org Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, kai.vehmanen@linux.intel.com, yung-chuan.liao@linux.intel.com, daniel.baluta@nxp.com, ranjani.sridharan@linux.intel.com, lgirdwood@gmail.com, linux-imx@nxp.com, yc.hung@mediatek.com, peter.ujfalusi@linux.intel.com, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] ASoC: SOF: compress: Prevent current kernel running with older FW Date: Tue, 12 Jul 2022 17:15:30 +0300 [thread overview] Message-ID: <20220712141531.14599-4-daniel.baluta@oss.nxp.com> (raw) In-Reply-To: <20220712141531.14599-1-daniel.baluta@oss.nxp.com> From: Daniel Baluta <daniel.baluta@nxp.com> After introducing extended parameters we need to forbid older firmware versions to run with the current and future kernel versions. Although in theory the communication protocol will still work the semantics at application level are undefined. So, prevent this by disallowing older firmwares to run with newer kernels. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> --- sound/soc/sof/compress.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/sof/compress.c b/sound/soc/sof/compress.c index 1204dce29ef9..67139e15f862 100644 --- a/sound/soc/sof/compress.c +++ b/sound/soc/sof/compress.c @@ -167,12 +167,23 @@ static int sof_compr_set_params(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_compr_runtime *crtd = cstream->runtime; struct sof_ipc_pcm_params_reply ipc_params_reply; + struct sof_ipc_fw_ready *ready = &sdev->fw_ready; + struct sof_ipc_fw_version *v = &ready->version; struct snd_compr_tstamp *tstamp; struct sof_ipc_pcm_params *pcm; struct snd_sof_pcm *spcm; size_t ext_data_size; int ret; + if (v->abi_version < SOF_ABI_VER(3, 22, 0)) { + dev_err(component->dev, + "Compress params not supported with FW ABI version %d:%d:%d\n", + SOF_ABI_VERSION_MAJOR(v->abi_version), + SOF_ABI_VERSION_MINOR(v->abi_version), + SOF_ABI_VERSION_PATCH(v->abi_version)); + return -EINVAL; + } + tstamp = crtd->private_data; spcm = snd_sof_find_spcm_dai(component, rtd); -- 2.27.0
next prev parent reply other threads:[~2022-07-12 14:16 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-12 14:15 [PATCH 0/4] Extend ipc stream parameters sent to DSP Daniel Baluta 2022-07-12 14:15 ` Daniel Baluta 2022-07-12 14:15 ` [PATCH 1/4] ASoC: SOF: compress: Dynamically allocate pcm params struct Daniel Baluta 2022-07-12 14:15 ` Daniel Baluta 2022-07-12 14:15 ` [PATCH 2/4] ASoC: SOF: Copy compress parameters into extended data Daniel Baluta 2022-07-12 14:15 ` Daniel Baluta 2022-07-12 14:15 ` Daniel Baluta [this message] 2022-07-12 14:15 ` [PATCH 3/4] ASoC: SOF: compress: Prevent current kernel running with older FW Daniel Baluta 2022-07-12 14:15 ` [PATCH 4/4] uapi: sof: abi: Bump SOF ABI for ext_data_length Daniel Baluta 2022-07-12 14:15 ` Daniel Baluta 2022-07-12 18:22 ` [PATCH 0/4] Extend ipc stream parameters sent to DSP Mark Brown 2022-07-12 18:22 ` Mark Brown
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220712141531.14599-4-daniel.baluta@oss.nxp.com \ --to=daniel.baluta@oss.nxp.com \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@kernel.org \ --cc=daniel.baluta@nxp.com \ --cc=kai.vehmanen@linux.intel.com \ --cc=lgirdwood@gmail.com \ --cc=linux-imx@nxp.com \ --cc=linux-kernel@vger.kernel.org \ --cc=peter.ujfalusi@linux.intel.com \ --cc=pierre-louis.bossart@linux.intel.com \ --cc=ranjani.sridharan@linux.intel.com \ --cc=yc.hung@mediatek.com \ --cc=yung-chuan.liao@linux.intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.