From: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
To: linuxppc-dev@ozlabs.org, mpe@ellerman.id.au
Cc: stewart@linux.vnet.ibm.com, joel@jms.id.au
Subject: [PATCH V3 2/2] powerpc/xmon: add command to dump OPAL msglog
Date: Thu, 11 Feb 2016 18:36:20 +1100 [thread overview]
Message-ID: <1455176180-19670-2-git-send-email-andrew.donnellan@au1.ibm.com> (raw)
In-Reply-To: <1455176180-19670-1-git-send-email-andrew.donnellan@au1.ibm.com>
Add the 'do' command to dump the OPAL msglog in xmon.
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
---
arch/powerpc/xmon/xmon.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 07a8508..48b75ae 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -47,6 +47,11 @@
#include <asm/debug.h>
#include <asm/hw_breakpoint.h>
+#ifdef CONFIG_PPC_POWERNV
+#include <asm/opal.h>
+#include <asm/firmware.h>
+#endif
+
#ifdef CONFIG_PPC64
#include <asm/hvcall.h>
#include <asm/paca.h>
@@ -119,6 +124,11 @@ static void dump(void);
static void prdump(unsigned long, long);
static int ppc_inst_dump(unsigned long, long, int);
static void dump_log_buf(void);
+
+#ifdef CONFIG_PPC_POWERNV
+static void dump_opal_msglog(void);
+#endif
+
static void backtrace(struct pt_regs *);
static void excprint(struct pt_regs *);
static void prregs(struct pt_regs *);
@@ -202,6 +212,10 @@ Commands:\n\
df dump float values\n\
dd dump double values\n\
dl dump the kernel log buffer\n"
+#ifdef CONFIG_PPC_POWERNV
+ "\
+ do dump the OPAL message log\n"
+#endif
#ifdef CONFIG_PPC64
"\
dp[#] dump paca for current cpu, or cpu #\n\
@@ -2253,6 +2267,12 @@ dump(void)
last_cmd = "di\n";
} else if (c == 'l') {
dump_log_buf();
+ } else if (c == 'o') {
+#ifdef CONFIG_PPC_POWERNV
+ dump_opal_msglog();
+#else
+ printf("Machine is not running OPAL firmware.\n");
+#endif
} else if (c == 'r') {
scanhex(&ndump);
if (ndump == 0)
@@ -2395,6 +2415,46 @@ dump_log_buf(void)
catch_memory_errors = 0;
}
+#ifdef CONFIG_PPC_POWERNV
+void
+dump_opal_msglog(void)
+{
+ unsigned char buf[128];
+ ssize_t res;
+ loff_t pos = 0;
+
+ if (!firmware_has_feature(FW_FEATURE_OPAL)) {
+ printf("Machine is not running OPAL firmware.\n");
+ return;
+ }
+
+ if (setjmp(bus_error_jmp) != 0) {
+ printf("Error dumping OPAL msglog!\n");
+ return;
+ }
+
+ catch_memory_errors = 1;
+ sync();
+
+ xmon_start_pagination();
+ while ((res = opal_msglog_copy(buf, pos, sizeof(buf) - 1))) {
+ if (res < 0) {
+ printf("Error dumping OPAL msglog! Error: %zd\n", res);
+ break;
+ }
+ buf[res] = '\0';
+ printf("%s", buf);
+ pos += res;
+ }
+ xmon_end_pagination();
+
+ sync();
+ /* wait a little while to see if we get a machine check */
+ __delay(200);
+ catch_memory_errors = 0;
+}
+#endif
+
/*
* Memory operations - move, set, print differences
*/
--
Andrew Donnellan Software Engineer, OzLabs
andrew.donnellan@au1.ibm.com Australia Development Lab, Canberra
+61 2 6201 8874 (work) IBM Australia Limited
next prev parent reply other threads:[~2016-02-11 7:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-09 7:17 [PATCH V2 1/2] powerpc/powernv: new function to access OPAL msglog Andrew Donnellan
2016-02-09 7:17 ` [PATCH V2 2/2] powerpc/xmon: add command to dump " Andrew Donnellan
2016-02-11 14:15 ` Denis Kirjanov
2016-02-17 12:41 ` [V2,2/2] " Michael Ellerman
2016-02-11 6:32 ` [PATCH V2 1/2] powerpc/powernv: new function to access " Stewart Smith
2016-02-11 7:14 ` Joel Stanley
2016-02-11 7:31 ` Andrew Donnellan
2016-02-11 7:36 ` [PATCH V3 " Andrew Donnellan
2016-02-11 7:36 ` Andrew Donnellan [this message]
2016-02-11 22:30 ` Joel Stanley
2016-02-17 12:41 ` [V2,1/2] " Michael Ellerman
2016-02-18 1:17 ` Andrew Donnellan
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=1455176180-19670-2-git-send-email-andrew.donnellan@au1.ibm.com \
--to=andrew.donnellan@au1.ibm.com \
--cc=joel@jms.id.au \
--cc=linuxppc-dev@ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=stewart@linux.vnet.ibm.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).