From 901f991eee82df45df9e32570584219af0faceef Mon Sep 17 00:00:00 2001 From: Karol Trzcinski Date: Wed, 8 Jul 2020 13:38:58 +0200 Subject: [PATCH] logger: Validate by src_hash instead of abi version from fw_ready ABI version saved in fw_ready doesn't match with DBG_ABI version saved in ldc file even for proper pair of fw and ldc file. Moreover ldc file content changes at any log modyfication, what is not related with DBG_ABI change, so this way of solving this problem is incorrect. Introduced src_hash value change solves both problems. Signed-off-by: Karol Trzcinski --- src/include/user/abi_dbg.h | 2 +- tools/logger/convert.c | 29 +++++------------------------ 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/src/include/user/abi_dbg.h b/src/include/user/abi_dbg.h index 8ea8ef37d..16bf77fa9 100644 --- a/src/include/user/abi_dbg.h +++ b/src/include/user/abi_dbg.h @@ -19,7 +19,7 @@ #define __USER_ABI_DBG_H__ #define SOF_ABI_DBG_MAJOR 5 -#define SOF_ABI_DBG_MINOR 0 +#define SOF_ABI_DBG_MINOR 1 #define SOF_ABI_DBG_PATCH 0 #define SOF_ABI_DBG_VERSION SOF_ABI_VER(SOF_ABI_DBG_MAJOR, \ diff --git a/tools/logger/convert.c b/tools/logger/convert.c index 1f26e4411..2fe837a0d 100644 --- a/tools/logger/convert.c +++ b/tools/logger/convert.c @@ -660,7 +660,7 @@ static int verify_fw_ver(const struct convert_config *config, const struct snd_sof_logs_header *snd) { struct sof_ipc_fw_version ver; - int count, ret = 0; + int count; if (!config->version_fd) return 0; @@ -673,30 +673,11 @@ static int verify_fw_ver(const struct convert_config *config, return -ferror(config->version_fd); } - ret = memcmp(&ver, &snd->version, sizeof(struct sof_ipc_fw_version)); - if (ret) { + /* compare source hash value from version file and ldc file */ + if (ver.src_hash != snd->version.src_hash) { log_err(config->out_fd, - "fw version in %s file does not coincide with fw version in %s file.\n", - config->ldc_file, config->version_file); - return -EINVAL; - } - - /* logger and version_file abi dbg verification */ - if (SOF_ABI_VERSION_INCOMPATIBLE(SOF_ABI_DBG_VERSION, - ver.abi_version)) { - log_err(config->out_fd, - "abi version in %s file does not coincide with abi version used by logger.\n", - config->version_file); - log_err(config->out_fd, - "logger ABI Version is %d:%d:%d\n", - SOF_ABI_VERSION_MAJOR(SOF_ABI_DBG_VERSION), - SOF_ABI_VERSION_MINOR(SOF_ABI_DBG_VERSION), - SOF_ABI_VERSION_PATCH(SOF_ABI_DBG_VERSION)); - log_err(config->out_fd, - "version_file ABI Version is %d:%d:%d\n", - SOF_ABI_VERSION_MAJOR(ver.abi_version), - SOF_ABI_VERSION_MINOR(ver.abi_version), - SOF_ABI_VERSION_PATCH(ver.abi_version)); + "src hash value from version file (0x%x) differ from src hash version saved in dictionary (0x%x).\n", + ver.src_hash, snd->version.src_hash); return -EINVAL; } return 0;