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 <karolx.trzcinski@linux.intel.com>
This commit is contained in:
Karol Trzcinski 2020-07-08 13:38:58 +02:00 committed by Liam Girdwood
parent 9f293b018d
commit 901f991eee
2 changed files with 6 additions and 25 deletions

View File

@ -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, \

View File

@ -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;