ASOC: SOF: ipc: add support for stricter ABI checks
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tue, 30 Apr 2019 23:09:17 +0000 (18:09 -0500)
committerMark Brown <broonie@kernel.org>
Fri, 3 May 2019 05:56:06 +0000 (14:56 +0900)
Fail early if firmware is more recent than kernel and Kconfig is
selected.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/ipc.c

index d00373c..bf58d58 100644 (file)
@@ -762,6 +762,15 @@ int snd_sof_ipc_valid(struct snd_sof_dev *sdev)
                return -EINVAL;
        }
 
+       if (v->abi_version > SOF_ABI_VERSION) {
+               if (!IS_ENABLED(CONFIG_SND_SOC_SOF_STRICT_ABI_CHECKS)) {
+                       dev_warn(sdev->dev, "warn: FW ABI is more recent than kernel\n");
+               } else {
+                       dev_err(sdev->dev, "error: FW ABI is more recent than kernel\n");
+                       return -EINVAL;
+               }
+       }
+
        if (ready->debug.bits.build) {
                dev_info(sdev->dev,
                         "Firmware debug build %d on %s-%s - options:\n"