!190 Add some improvements and add new modules to HiSilicon common section
From: @fwo Reviewed-by: @hubin95 Signed-off-by: @hubin95
This commit is contained in:
commit
c7ac29215a
@ -0,0 +1,38 @@
|
||||
From a0cf58e6c96bb5e2646da9fd43e1ddd285a6e8da Mon Sep 17 00:00:00 2001
|
||||
From: Bing Xia <xiabing14@h-partners.com>
|
||||
Date: Sun, 19 Jan 2025 11:08:26 +0000
|
||||
Subject: [PATCH 1/4] rasdaemon: Fix some compilation alarms in ras-record.h.
|
||||
|
||||
Fix the problem that the type of a constant string does not match
|
||||
when it is assigned to a character pointer.
|
||||
|
||||
Signed-off-by: Bing Xia <xiabing14@h-partners.com>
|
||||
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
||||
---
|
||||
ras-record.h | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/ras-record.h b/ras-record.h
|
||||
index 5eab62c..eec0702 100644
|
||||
--- a/ras-record.h
|
||||
+++ b/ras-record.h
|
||||
@@ -318,12 +318,12 @@ struct sqlite3_priv {
|
||||
};
|
||||
|
||||
struct db_fields {
|
||||
- char *name;
|
||||
- char *type;
|
||||
+ const char *name;
|
||||
+ const char *type;
|
||||
};
|
||||
|
||||
struct db_table_descriptor {
|
||||
- char *name;
|
||||
+ const char *name;
|
||||
const struct db_fields *fields;
|
||||
size_t num_fields;
|
||||
};
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
From 1d83921b5ad4dc03a411abf759c1025e548ce3e0 Mon Sep 17 00:00:00 2001
|
||||
From: Bing Xia <xiabing14@h-partners.com>
|
||||
Date: Sun, 19 Jan 2025 11:26:43 +0000
|
||||
Subject: [PATCH 2/4] rasdaemon: Fix few compilation warnings in non standard
|
||||
hisilicon code
|
||||
|
||||
Fix the problem that the type of a constant string does not match
|
||||
when it is assigned to a character pointer.
|
||||
|
||||
Signed-off-by: Bing Xia <xiabing14@h-partners.com>
|
||||
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
||||
---
|
||||
non-standard-hisi_hip08.c | 2 +-
|
||||
non-standard-hisilicon.h | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/non-standard-hisi_hip08.c b/non-standard-hisi_hip08.c
|
||||
index de5b5e9..3b8d93c 100644
|
||||
--- a/non-standard-hisi_hip08.c
|
||||
+++ b/non-standard-hisi_hip08.c
|
||||
@@ -462,7 +462,7 @@ static const char * const oem_submodule_name(const struct hisi_module_info *info
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
-static char *pcie_local_sub_module_name(uint8_t id)
|
||||
+static const char *pcie_local_sub_module_name(uint8_t id)
|
||||
{
|
||||
switch (id) {
|
||||
case HISI_PCIE_SUB_MODULE_ID_AP: return "AP_Layer";
|
||||
diff --git a/non-standard-hisilicon.h b/non-standard-hisilicon.h
|
||||
index 44da9e7..afd5e83 100644
|
||||
--- a/non-standard-hisilicon.h
|
||||
+++ b/non-standard-hisilicon.h
|
||||
@@ -24,7 +24,7 @@ enum hisi_oem_data_type {
|
||||
};
|
||||
|
||||
/* helper functions */
|
||||
-static inline char *err_severity(uint8_t err_sev)
|
||||
+static inline const char *err_severity(uint8_t err_sev)
|
||||
{
|
||||
switch (err_sev) {
|
||||
case HISI_ERR_SEVERITY_NFE: return "recoverable";
|
||||
--
|
||||
2.25.1
|
||||
|
||||
198
0003-rasdaemon-Fix-some-static-check-warning.patch
Normal file
198
0003-rasdaemon-Fix-some-static-check-warning.patch
Normal file
@ -0,0 +1,198 @@
|
||||
From f717326ae7ffb30d6da09840c7e4613793d0113e Mon Sep 17 00:00:00 2001
|
||||
From: Qizhi Zhang <zhangqizhi3@h-partners.com>
|
||||
Date: Tue, 8 Apr 2025 10:55:06 +0800
|
||||
Subject: [PATCH] rasdaemon: Fix some static check warning
|
||||
|
||||
The decode_int_fields() and decode_text_fields() functions are used
|
||||
to replace the original if judgment branch, reducing the cyclomatic
|
||||
complexity.
|
||||
|
||||
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
|
||||
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
||||
---
|
||||
non-standard-hisilicon.c | 135 ++++++++++++++++++---------------------
|
||||
1 file changed, 61 insertions(+), 74 deletions(-)
|
||||
|
||||
diff --git a/non-standard-hisilicon.c b/non-standard-hisilicon.c
|
||||
index 2b00ed6..53b36ed 100644
|
||||
--- a/non-standard-hisilicon.c
|
||||
+++ b/non-standard-hisilicon.c
|
||||
@@ -144,7 +144,6 @@ int step_vendor_data_tab(struct ras_ns_ev_decoder *ev_decoder, const char *name)
|
||||
}
|
||||
#endif
|
||||
|
||||
-#ifdef HAVE_SQLITE3
|
||||
static const struct db_fields hisi_common_section_fields[] = {
|
||||
{ .name = "id", .type = "INTEGER PRIMARY KEY" },
|
||||
{ .name = "timestamp", .type = "TEXT" },
|
||||
@@ -164,6 +163,7 @@ static const struct db_fields hisi_common_section_fields[] = {
|
||||
{ .name = "regs_dump", .type = "TEXT" },
|
||||
};
|
||||
|
||||
+#ifdef HAVE_SQLITE3
|
||||
static const struct db_table_descriptor hisi_common_section_tab = {
|
||||
.name = "hisi_common_section_v2",
|
||||
.fields = hisi_common_section_fields,
|
||||
@@ -245,81 +245,33 @@ static void decode_module(struct ras_ns_ev_decoder *ev_decoder,
|
||||
}
|
||||
}
|
||||
|
||||
-static void decode_hisi_common_section_hdr(struct ras_ns_ev_decoder *ev_decoder,
|
||||
- const struct hisi_common_error_section *err,
|
||||
- struct hisi_event *event)
|
||||
+static void decode_int_fields(struct ras_ns_ev_decoder *ev_decoder, int id,
|
||||
+ uint16_t data, struct hisi_event *event, bool valid)
|
||||
{
|
||||
- HISI_SNPRINTF(event->error_msg, "[ table_version=%hhu", err->version);
|
||||
- record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT,
|
||||
- HISI_COMMON_FIELD_VERSION,
|
||||
- err->version, NULL);
|
||||
- if (err->val_bits & BIT(HISI_COMMON_VALID_SOC_ID)) {
|
||||
- HISI_SNPRINTF(event->error_msg, "soc=%s", get_soc_desc(err->soc_id));
|
||||
- record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT,
|
||||
- HISI_COMMON_FIELD_SOC_ID,
|
||||
- err->soc_id, NULL);
|
||||
- }
|
||||
-
|
||||
- if (err->val_bits & BIT(HISI_COMMON_VALID_SOCKET_ID)) {
|
||||
- HISI_SNPRINTF(event->error_msg, "socket_id=%hhu", err->socket_id);
|
||||
- record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT,
|
||||
- HISI_COMMON_FIELD_SOCKET_ID,
|
||||
- err->socket_id, NULL);
|
||||
- }
|
||||
+ if (!valid)
|
||||
+ return;
|
||||
|
||||
- if (err->val_bits & BIT(HISI_COMMON_VALID_TOTEM_ID)) {
|
||||
- HISI_SNPRINTF(event->error_msg, "totem_id=%hhu", err->totem_id);
|
||||
- record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT,
|
||||
- HISI_COMMON_FIELD_TOTEM_ID,
|
||||
- err->totem_id, NULL);
|
||||
+ if (id == HISI_COMMON_FIELD_SOC_ID) {
|
||||
+ HISI_SNPRINTF(event->error_msg, "soc=%s", get_soc_desc(data));
|
||||
+ } else {
|
||||
+ HISI_SNPRINTF(event->error_msg, "%s=%hu",
|
||||
+ hisi_common_section_fields[id].name, data);
|
||||
}
|
||||
|
||||
- if (err->val_bits & BIT(HISI_COMMON_VALID_NIMBUS_ID)) {
|
||||
- HISI_SNPRINTF(event->error_msg, "nimbus_id=%hhu", err->nimbus_id);
|
||||
- record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT,
|
||||
- HISI_COMMON_FIELD_NIMBUS_ID,
|
||||
- err->nimbus_id, NULL);
|
||||
- }
|
||||
+ record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT, id, data, NULL);
|
||||
+}
|
||||
|
||||
- if (err->val_bits & BIT(HISI_COMMON_VALID_SUBSYSTEM_ID)) {
|
||||
- HISI_SNPRINTF(event->error_msg, "subsystem_id=%hhu", err->subsystem_id);
|
||||
- record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT,
|
||||
- HISI_COMMON_FIELD_SUB_SYSTEM_ID,
|
||||
- err->subsystem_id, NULL);
|
||||
- }
|
||||
+static void decode_text_fields(struct ras_ns_ev_decoder *ev_decoder, int id,
|
||||
+ const struct hisi_common_error_section *err,
|
||||
+ struct hisi_event *event, bool valid)
|
||||
+{
|
||||
+ if (!valid)
|
||||
+ return;
|
||||
|
||||
- if (err->val_bits & BIT(HISI_COMMON_VALID_MODULE_ID))
|
||||
+ if (id == HISI_COMMON_FIELD_MODULE_ID)
|
||||
decode_module(ev_decoder, event, err->module_id);
|
||||
|
||||
- if (err->val_bits & BIT(HISI_COMMON_VALID_SUBMODULE_ID)) {
|
||||
- HISI_SNPRINTF(event->error_msg, "submodule_id=%hhu", err->submodule_id);
|
||||
- record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT,
|
||||
- HISI_COMMON_FIELD_SUB_MODULE_ID,
|
||||
- err->submodule_id, NULL);
|
||||
- }
|
||||
-
|
||||
- if (err->val_bits & BIT(HISI_COMMON_VALID_CORE_ID)) {
|
||||
- HISI_SNPRINTF(event->error_msg, "core_id=%hhu", err->core_id);
|
||||
- record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT,
|
||||
- HISI_COMMON_FIELD_CORE_ID,
|
||||
- err->core_id, NULL);
|
||||
- }
|
||||
-
|
||||
- if (err->val_bits & BIT(HISI_COMMON_VALID_PORT_ID)) {
|
||||
- HISI_SNPRINTF(event->error_msg, "port_id=%hhu", err->port_id);
|
||||
- record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT,
|
||||
- HISI_COMMON_FIELD_PORT_ID,
|
||||
- err->port_id, NULL);
|
||||
- }
|
||||
-
|
||||
- if (err->val_bits & BIT(HISI_COMMON_VALID_ERR_TYPE)) {
|
||||
- HISI_SNPRINTF(event->error_msg, "err_type=%hu", err->err_type);
|
||||
- record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_INT,
|
||||
- HISI_COMMON_FIELD_ERR_TYPE,
|
||||
- err->err_type, NULL);
|
||||
- }
|
||||
-
|
||||
- if (err->val_bits & BIT(HISI_COMMON_VALID_PCIE_INFO)) {
|
||||
+ if (id == HISI_COMMON_FIELD_PCIE_INFO) {
|
||||
HISI_SNPRINTF(event->error_msg, "pcie_device_id=%04x:%02x:%02x.%x",
|
||||
err->pcie_info.segment, err->pcie_info.bus,
|
||||
err->pcie_info.device, err->pcie_info.function);
|
||||
@@ -327,16 +279,51 @@ static void decode_hisi_common_section_hdr(struct ras_ns_ev_decoder *ev_decoder,
|
||||
err->pcie_info.segment, err->pcie_info.bus,
|
||||
err->pcie_info.device, err->pcie_info.function);
|
||||
record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT,
|
||||
- HISI_COMMON_FIELD_PCIE_INFO,
|
||||
- 0, event->pcie_info);
|
||||
+ id, 0, event->pcie_info);
|
||||
}
|
||||
|
||||
- if (err->val_bits & BIT(HISI_COMMON_VALID_ERR_SEVERITY)) {
|
||||
- HISI_SNPRINTF(event->error_msg, "err_severity=%s", err_severity(err->err_severity));
|
||||
+ if (id == HISI_COMMON_FIELD_ERR_SEVERITY) {
|
||||
+ HISI_SNPRINTF(event->error_msg, "err_severity=%s",
|
||||
+ err_severity(err->err_severity));
|
||||
record_vendor_data(ev_decoder, HISI_OEM_DATA_TYPE_TEXT,
|
||||
- HISI_COMMON_FIELD_ERR_SEVERITY,
|
||||
- 0, err_severity(err->err_severity));
|
||||
+ id, 0, err_severity(err->err_severity));
|
||||
}
|
||||
+}
|
||||
+
|
||||
+static void decode_hisi_common_section_hdr(struct ras_ns_ev_decoder *ev_decoder,
|
||||
+ const struct hisi_common_error_section *err,
|
||||
+ struct hisi_event *event)
|
||||
+{
|
||||
+ HISI_SNPRINTF(event->error_msg, "[");
|
||||
+
|
||||
+ decode_int_fields(ev_decoder, HISI_COMMON_FIELD_VERSION, err->version, event, 1);
|
||||
+ decode_int_fields(ev_decoder, HISI_COMMON_FIELD_SOC_ID, err->soc_id, event,
|
||||
+ err->val_bits & BIT(HISI_COMMON_VALID_SOC_ID));
|
||||
+ decode_int_fields(ev_decoder, HISI_COMMON_FIELD_SOCKET_ID, err->socket_id, event,
|
||||
+ err->val_bits & BIT(HISI_COMMON_VALID_SOCKET_ID));
|
||||
+ decode_int_fields(ev_decoder, HISI_COMMON_FIELD_TOTEM_ID, err->totem_id, event,
|
||||
+ err->val_bits & BIT(HISI_COMMON_VALID_TOTEM_ID));
|
||||
+ decode_int_fields(ev_decoder, HISI_COMMON_FIELD_NIMBUS_ID, err->nimbus_id, event,
|
||||
+ err->val_bits & BIT(HISI_COMMON_VALID_NIMBUS_ID));
|
||||
+ decode_int_fields(ev_decoder, HISI_COMMON_FIELD_SUB_SYSTEM_ID, err->subsystem_id, event,
|
||||
+ err->val_bits & BIT(HISI_COMMON_VALID_SUBSYSTEM_ID));
|
||||
+
|
||||
+ decode_text_fields(ev_decoder, HISI_COMMON_FIELD_MODULE_ID, err, event,
|
||||
+ err->val_bits & BIT(HISI_COMMON_VALID_MODULE_ID));
|
||||
+
|
||||
+ decode_int_fields(ev_decoder, HISI_COMMON_FIELD_SUB_MODULE_ID, err->submodule_id, event,
|
||||
+ err->val_bits & BIT(HISI_COMMON_VALID_SUBMODULE_ID));
|
||||
+ decode_int_fields(ev_decoder, HISI_COMMON_FIELD_CORE_ID, err->core_id, event,
|
||||
+ err->val_bits & BIT(HISI_COMMON_VALID_CORE_ID));
|
||||
+ decode_int_fields(ev_decoder, HISI_COMMON_FIELD_PORT_ID, err->port_id, event,
|
||||
+ err->val_bits & BIT(HISI_COMMON_VALID_PORT_ID));
|
||||
+ decode_int_fields(ev_decoder, HISI_COMMON_FIELD_ERR_TYPE, err->err_type, event,
|
||||
+ err->val_bits & BIT(HISI_COMMON_VALID_ERR_TYPE));
|
||||
+
|
||||
+ decode_text_fields(ev_decoder, HISI_COMMON_FIELD_PCIE_INFO, err, event,
|
||||
+ err->val_bits & BIT(HISI_COMMON_VALID_PCIE_INFO));
|
||||
+ decode_text_fields(ev_decoder, HISI_COMMON_FIELD_ERR_SEVERITY, err, event,
|
||||
+ err->val_bits & BIT(HISI_COMMON_VALID_ERR_SEVERITY));
|
||||
|
||||
HISI_SNPRINTF(event->error_msg, "]");
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
From 34e16f737fdcc90ed396a4b6074c6f2e3573e1d1 Mon Sep 17 00:00:00 2001
|
||||
From: Qizhi Zhang <zhangqizhi3@h-partners.com>
|
||||
Date: Tue, 8 Apr 2025 11:15:55 +0800
|
||||
Subject: [PATCH] rasdaemon: Add new modules supported by HiSilicon common
|
||||
section
|
||||
|
||||
Add new modules supported by HiSilicon common error section.
|
||||
|
||||
Signed-off-by: Bing Xia <xiabing14@h-partners.com>
|
||||
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
||||
---
|
||||
non-standard-hisilicon.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/non-standard-hisilicon.c b/non-standard-hisilicon.c
|
||||
index 2b00ed6..d294442 100644
|
||||
--- a/non-standard-hisilicon.c
|
||||
+++ b/non-standard-hisilicon.c
|
||||
@@ -219,6 +219,17 @@ static const char* module_name[] = {
|
||||
"SDMA",
|
||||
"UC",
|
||||
"HBMC",
|
||||
+ "PMC",
|
||||
+ "SCHE",
|
||||
+ "ASMB_DFS",
|
||||
+ "ASMB_NTU",
|
||||
+ "UB",
|
||||
+ "UMMU",
|
||||
+ "PCU",
|
||||
+ "UCMI",
|
||||
+ "DJTAGM",
|
||||
+ "CFGBUS",
|
||||
+ "MPU",
|
||||
};
|
||||
|
||||
static const char* get_soc_desc(uint8_t soc_id)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: rasdaemon
|
||||
Version: 0.8.0
|
||||
Release: 7
|
||||
Release: 8
|
||||
License: GPLv2
|
||||
Summary: Utility to get Platform Reliability, Availability and Serviceability (RAS) reports via the Kernel tracing events
|
||||
URL: https://github.com/mchehab/rasdaemon.git
|
||||
@ -36,6 +36,10 @@ Patch9009: bugfix-fix-cpu-isolate-errors-when-some-cpus-are-.patch
|
||||
Patch9010: rasdaemon-ras-mc-ctl-Modify-check-for-HiSilicon-KunP.patch
|
||||
Patch9011: bugfix-set-to-default-when-param-is-overflow.patch
|
||||
Patch9012: fix-ras-mc-ctl-summary-failed.patch
|
||||
Patch9013: 0001-rasdaemon-Fix-some-compilation-alarms-in-ras-record..patch
|
||||
Patch9014: 0002-rasdaemon-Fix-few-compilation-warnings-in-non-standa.patch
|
||||
Patch9015: 0003-rasdaemon-Fix-some-static-check-warning.patch
|
||||
Patch9016: 0004-rasdaemon-Add-new-modules-supported-by-HiSilicon-com.patch
|
||||
|
||||
%description
|
||||
The rasdaemon program is a daemon which monitors the platform
|
||||
@ -87,6 +91,12 @@ fi
|
||||
/usr/bin/systemctl disable rasdaemon.service >/dev/null 2>&1 || :
|
||||
|
||||
%changelog
|
||||
* Wed Apr 30 2025 wangjiang <app@cameyan.com> - 0.8.0-8
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:Add some improvements and add new modules to HiSilicon common section
|
||||
|
||||
* Sat Apr 19 2025 zhangnan <zhangnan134@huawei.com> - 0.8.0-7
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user