linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shiju Jose <shiju.jose@huawei.com>
To: <linux-edac@vger.kernel.org>, <mchehab+huawei@kernel.org>
Cc: <linuxarm@openeuler.org>, <tanxiaofei@huawei.com>,
	<jonathan.cameron@huawei.com>
Subject: [PATCH v2 6/8] rasdaemon: ras-mc-ctl: Add support for HiSilicon Kunpeng920 errors
Date: Mon, 25 Jan 2021 17:14:53 +0000	[thread overview]
Message-ID: <20210125171455.1886-7-shiju.jose@huawei.com> (raw)
In-Reply-To: <20210125171455.1886-1-shiju.jose@huawei.com>

Add support for the HiSilicon Kunpeng920 errors.
Supported error formats: OEM type 1, OEM typ2 and PCIe controller
error formats.

Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
Reviewed-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 util/ras-mc-ctl.in | 149 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 149 insertions(+)

diff --git a/util/ras-mc-ctl.in b/util/ras-mc-ctl.in
index 6820823..8befc5d 100755
--- a/util/ras-mc-ctl.in
+++ b/util/ras-mc-ctl.in
@@ -1516,10 +1516,17 @@ sub errors
     undef($dbh);
 }
 
+# Definitions of the vendor platform IDs.
+use constant {
+    HISILICON_KUNPENG_920 => "Kunpeng920",
+};
+
 sub vendor_errors_summary
 {
     require DBI;
     my ($num_args, $platform_id);
+    my ($query, $query_handle, $count, $out);
+    my ($module_id, $sub_module_id, $err_severity, $err_sev);
 
     $num_args = $#ARGV + 1;
     $platform_id = 0;
@@ -1531,6 +1538,69 @@ sub vendor_errors_summary
 
     my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
 
+    # HiSilicon Kunpeng920 errors
+    if ($platform_id eq HISILICON_KUNPENG_920) {
+        $query = "select err_severity, module_id, count(*) from hip08_oem_type1_event_v2 group by err_severity, module_id";
+        $query_handle = $dbh->prepare($query);
+        $query_handle->execute();
+        $query_handle->bind_columns(\($err_severity, $module_id, $count));
+        $out = "";
+        $err_sev = "";
+        while($query_handle->fetch()) {
+            if ($err_severity ne $err_sev) {
+                $out .= "$err_severity errors:\n";
+                $err_sev = $err_severity;
+            }
+            $out .= "\t$module_id: $count\n";
+        }
+        if ($out ne "") {
+            print "HiSilicon Kunpeng920 OEM type1 error events summary:\n$out\n";
+        } else {
+            print "No HiSilicon Kunpeng920 OEM type1 errors.\n\n";
+        }
+        $query_handle->finish;
+
+        $query = "select err_severity, module_id, count(*) from hip08_oem_type2_event_v2 group by err_severity, module_id";
+        $query_handle = $dbh->prepare($query);
+        $query_handle->execute();
+        $query_handle->bind_columns(\($err_severity, $module_id, $count));
+        $out = "";
+        $err_sev = "";
+        while($query_handle->fetch()) {
+            if ($err_severity ne $err_sev) {
+                $out .= "$err_severity errors:\n";
+                $err_sev = $err_severity;
+            }
+            $out .= "\t$module_id: $count\n";
+        }
+        if ($out ne "") {
+            print "HiSilicon Kunpeng920 OEM type2 error events summary:\n$out\n";
+        } else {
+            print "No HiSilicon Kunpeng920 OEM type2 errors.\n\n";
+        }
+        $query_handle->finish;
+
+        $query = "select err_severity, sub_module_id, count(*) from hip08_pcie_local_event_v2 group by err_severity, sub_module_id";
+        $query_handle = $dbh->prepare($query);
+        $query_handle->execute();
+        $query_handle->bind_columns(\($err_severity, $sub_module_id, $count));
+        $out = "";
+        $err_sev = "";
+        while($query_handle->fetch()) {
+            if ($err_severity ne $err_sev) {
+                $out .= "$err_severity errors:\n";
+                $err_sev = $err_severity;
+            }
+            $out .= "\t$sub_module_id: $count\n";
+        }
+        if ($out ne "") {
+            print "HiSilicon Kunpeng920 PCIe controller error events summary:\n$out\n";
+        } else {
+            print "No HiSilicon Kunpeng920 PCIe controller errors.\n\n";
+        }
+        $query_handle->finish;
+    }
+
     undef($dbh);
 }
 
@@ -1538,6 +1608,9 @@ sub vendor_errors
 {
     require DBI;
     my ($num_args, $platform_id);
+    my ($query, $query_handle, $id, $timestamp, $out);
+    my ($version, $soc_id, $socket_id, $nimbus_id, $core_id, $port_id);
+    my ($module_id, $sub_module_id, $err_severity, $err_type, $regs);
 
     $num_args = $#ARGV + 1;
     $platform_id = 0;
@@ -1549,12 +1622,88 @@ sub vendor_errors
 
     my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
 
+    # HiSilicon Kunpeng920 errors
+    if ($platform_id eq HISILICON_KUNPENG_920) {
+        $query = "select id, timestamp, version, soc_id, socket_id, nimbus_id, module_id, sub_module_id, err_severity, regs_dump from hip08_oem_type1_event_v2 order by id, module_id, err_severity";
+        $query_handle = $dbh->prepare($query);
+        $query_handle->execute();
+        $query_handle->bind_columns(\($id, $timestamp, $version, $soc_id, $socket_id, $nimbus_id, $module_id, $sub_module_id, $err_severity, $regs));
+        $out = "";
+        while($query_handle->fetch()) {
+            $out .= "$id. $timestamp Error Info: ";
+            $out .= "version=$version, ";
+            $out .= "soc_id=$soc_id, " if ($soc_id);
+            $out .= "socket_id=$socket_id, " if ($socket_id);
+            $out .= "nimbus_id=$nimbus_id, " if ($nimbus_id);
+            $out .= "module_id=$module_id, " if ($module_id);
+            $out .= "sub_module_id=$sub_module_id, " if ($sub_module_id);
+            $out .= "err_severity=$err_severity, \n" if ($err_severity);
+            $out .= "Error Registers: $regs\n\n" if ($regs);
+        }
+        if ($out ne "") {
+            print "HiSilicon Kunpeng920 OEM type1 error events:\n$out\n";
+        } else {
+            print "No HiSilicon Kunpeng920 OEM type1 errors.\n";
+        }
+        $query_handle->finish;
+
+        $query = "select id, timestamp, version, soc_id, socket_id, nimbus_id, module_id, sub_module_id, err_severity, regs_dump from hip08_oem_type2_event_v2 order by id, module_id, err_severity";
+        $query_handle = $dbh->prepare($query);
+        $query_handle->execute();
+        $query_handle->bind_columns(\($id, $timestamp, $version, $soc_id, $socket_id, $nimbus_id, $module_id, $sub_module_id, $err_severity, $regs));
+        $out = "";
+        while($query_handle->fetch()) {
+            $out .= "$id. $timestamp Error Info: ";
+            $out .= "version=$version, ";
+            $out .= "soc_id=$soc_id, " if ($soc_id);
+            $out .= "socket_id=$socket_id, " if ($socket_id);
+            $out .= "nimbus_id=$nimbus_id, " if ($nimbus_id);
+            $out .= "module_id=$module_id, " if ($module_id);
+            $out .= "sub_module_id=$sub_module_id, " if ($sub_module_id);
+            $out .= "err_severity=$err_severity, \n" if ($err_severity);
+            $out .= "Error Registers: $regs\n\n" if ($regs);
+        }
+        if ($out ne "") {
+            print "HiSilicon Kunpeng920 OEM type2 error events:\n$out\n";
+        } else {
+            print "No HiSilicon Kunpeng920 OEM type2 errors.\n";
+        }
+        $query_handle->finish;
+
+        $query = "select id, timestamp, version, soc_id, socket_id, nimbus_id, sub_module_id, core_id, port_id, err_severity, err_type, regs_dump from hip08_pcie_local_event_v2 order by id, sub_module_id, err_severity";
+        $query_handle = $dbh->prepare($query);
+        $query_handle->execute();
+        $query_handle->bind_columns(\($id, $timestamp, $version, $soc_id, $socket_id, $nimbus_id, $sub_module_id, $core_id, $port_id, $err_severity, $err_type, $regs));
+        $out = "";
+        while($query_handle->fetch()) {
+            $out .= "$id. $timestamp Error Info: ";
+            $out .= "version=$version, ";
+            $out .= "soc_id=$soc_id, " if ($soc_id);
+            $out .= "socket_id=$socket_id, " if ($socket_id);
+            $out .= "nimbus_id=$nimbus_id, " if ($nimbus_id);
+            $out .= "sub_module_id=$sub_module_id, " if ($sub_module_id);
+            $out .= "core_id=$core_id, " if ($core_id);
+            $out .= "port_id=$port_id, " if ($port_id);
+            $out .= "err_severity=$err_severity, " if ($err_severity);
+            $out .= "err_type=$err_type, \n" if ($err_type);
+            $out .= "Error Registers: $regs\n\n" if ($regs);
+        }
+        if ($out ne "") {
+            print "HiSilicon Kunpeng920 PCIe controller error events:\n$out\n";
+        } else {
+            print "No HiSilicon Kunpeng920 PCIe controller errors.\n";
+        }
+        $query_handle->finish;
+    }
+
     undef($dbh);
 }
 
 sub vendor_platforms
 {
         print "\nSupported platforms for the vendor-specific errors:\n";
+        print "\tHiSilicon Kunpeng920, platform-id=\"", HISILICON_KUNPENG_920, "\"\n";
+        print "\n";
 }
 
 sub log_msg   { print STDERR "$prog: ", @_ unless $conf{opt}{quiet}; }
-- 
2.17.1


  parent reply	other threads:[~2021-01-25 17:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 17:14 [PATCH v2 0/8] rasdaemon: add support for memory_failure events, Shiju Jose
2021-01-25 17:14 ` [PATCH v2 1/8] rasdaemon: add support for memory_failure events Shiju Jose
2021-01-25 17:14 ` [PATCH v2 2/8] rasdaemon: ras-mc-ctl: Modify ARM processor error summary log Shiju Jose
2021-01-25 17:14 ` [PATCH v2 3/8] rasdaemon: ras-mc-ctl: Add memory failure events Shiju Jose
2021-01-25 17:14 ` [PATCH v2 4/8] rasdaemon: ras-mc-ctl: Fix for exception when an event is not enabled Shiju Jose
2021-01-25 17:14 ` [PATCH v2 5/8] rasdaemon: ras-mc-ctl: Add support for the vendor-specific errors Shiju Jose
2021-01-25 17:14 ` Shiju Jose [this message]
2021-01-25 17:14 ` [PATCH v2 7/8] rasdaemon: ras-mc-ctl: Add support for HiSilicon Kunpeng9xx common errors Shiju Jose
2021-01-25 17:14 ` [PATCH v2 8/8] rasdaemon: Modify confiure.ac for Hisilicon Kunpeng errors Shiju Jose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210125171455.1886-7-shiju.jose@huawei.com \
    --to=shiju.jose@huawei.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linuxarm@openeuler.org \
    --cc=mchehab+huawei@kernel.org \
    --cc=tanxiaofei@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).