From cd762a18417d9b1b342ef0cb7dab4cd8c064b776 Mon Sep 17 00:00:00 2001 From: veega2022 Date: Thu, 6 Apr 2023 11:45:38 +0000 Subject: [PATCH] fix sas device info print error bug fix bug for sas device info print is 0, because the O2 compilation optimization is enabled. we use the volatile modifier added for pointer. Signed-off-by: veega2022 (cherry picked from commit 8196ce5ddeaaa0f08b6706bdff9ac1761b09a53d) --- ...fix-print-sas_dev-info-error-problem.patch | 43 +++++++++++++++++++ hikptool.spec | 6 ++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 0004-hikptool-fix-print-sas_dev-info-error-problem.patch diff --git a/0004-hikptool-fix-print-sas_dev-info-error-problem.patch b/0004-hikptool-fix-print-sas_dev-info-error-problem.patch new file mode 100644 index 0000000..19509e6 --- /dev/null +++ b/0004-hikptool-fix-print-sas_dev-info-error-problem.patch @@ -0,0 +1,43 @@ +From 1a4f58e149d14146d399878418bdba9dc824e0a6 Mon Sep 17 00:00:00 2001 +From: veega2022 +Date: Thu, 6 Apr 2023 11:33:14 +0000 +Subject: [PATCH] hikptool: fix print sas_dev info error problem + +the volatile modifier is added because the O2 compilation optimization is enbaled. +As a result, the pointer data is not updated. + +Signed-off-by: veega2022 +--- + sas/sas_func/sas_read_dev.c | 2 +- + tool_lib/tool_lib.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sas/sas_func/sas_read_dev.c b/sas/sas_func/sas_read_dev.c +index 382a1ef..d01f95f 100644 +--- a/sas/sas_func/sas_read_dev.c ++++ b/sas/sas_func/sas_read_dev.c +@@ -77,7 +77,7 @@ static void print_dev_link(const uint32_t *reg_save, uint32_t reg_num) + + static void print_dev_info(const void *reg_save, uint32_t reg_num) + { +- struct hikp_sas_itct *itct = (struct hikp_sas_itct *)reg_save; ++ volatile struct hikp_sas_itct *itct = (volatile struct hikp_sas_itct *)reg_save; + + printf("The device information as below:\n"); + printf("dev_type: %d\n", itct->dw0.dev_type); +diff --git a/tool_lib/tool_lib.h b/tool_lib/tool_lib.h +index 29e7e8c..b211175 100644 +--- a/tool_lib/tool_lib.h ++++ b/tool_lib/tool_lib.h +@@ -18,7 +18,7 @@ + + #define TOOL_NAME "hikptool" + +-#define TOOL_VER "1.0.12" ++#define TOOL_VER "1.0.13" + + #define HI_GET_BITFIELD(value, start, mask) (((value) >> (start)) & (mask)) + #define HI_SET_FIELD(origin, shift, val) ((origin) |= (val) << (shift)) +-- +2.25.1 + diff --git a/hikptool.spec b/hikptool.spec index 4b038de..af05617 100644 --- a/hikptool.spec +++ b/hikptool.spec @@ -1,7 +1,7 @@ Name: hikptool Summary: A userspace tool for Linux providing problem location on Kunpeng chips Version: 1.0.0 -Release: 8 +Release: 9 License: MulanPSL2 Source: %{name}-%{version}.tar.gz ExclusiveOS: linux @@ -17,6 +17,7 @@ ExclusiveArch: aarch64 Patch0001: 0001-socip-Return-EINVAL-when-the-parameter-check-fails.patch Patch0002: 0002-fix-compiler-security-option-problem.patch Patch0003: 0003-fix-the-security-compilation-PIE-issue.patch +Patch0004: 0004-hikptool-fix-print-sas_dev-info-error-problem.patch %description This package contains the hikptool @@ -69,6 +70,9 @@ fi /sbin/ldconfig %changelog +* Thu Apr 06 2023 veega2022 1.0.0-9 +- fix sas device info print error bug + * Wed Mar 15 2023 veega2022 1.0.0-8 - fix security compilation PIE issue -- Gitee