From: Xiongwei Song <sxwjean@me.com>
To: mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org,
christophe.leroy@csgroup.eu, npiggin@gmail.com,
ravi.bangoria@linux.ibm.com, mikey@neuling.org,
aneesh.kumar@linux.ibm.com, 0x7f454c46@gmail.com
Cc: Xiongwei Song <sxwjean@gmail.com>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] powerpc: Make the code in __show_regs nice-looking
Date: Thu, 22 Apr 2021 23:10:21 +0800 [thread overview]
Message-ID: <20210422151022.17868-1-sxwjean@me.com> (raw)
From: Xiongwei Song <sxwjean@gmail.com>
Create a new function named interrupt_detail_printable to judge which
interrupts can print esr/dsisr register.
Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
---
arch/powerpc/kernel/process.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 89e34aa273e2..5c3830837f3a 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1453,9 +1453,23 @@ static void print_msr_bits(unsigned long val)
#define REGS_PER_LINE 8
#endif
+static bool interrupt_detail_printable(int trap)
+{
+ switch (trap) {
+ case INTERRUPT_MACHINE_CHECK:
+ case INTERRUPT_DATA_STORAGE:
+ case INTERRUPT_ALIGNMENT:
+ return true;
+ default:
+ return false;
+ }
+
+ return false;
+}
+
static void __show_regs(struct pt_regs *regs)
{
- int i, trap;
+ int i;
printk("NIP: "REG" LR: "REG" CTR: "REG"\n",
regs->nip, regs->link, regs->ctr);
@@ -1464,12 +1478,9 @@ static void __show_regs(struct pt_regs *regs)
printk("MSR: "REG" ", regs->msr);
print_msr_bits(regs->msr);
pr_cont(" CR: %08lx XER: %08lx\n", regs->ccr, regs->xer);
- trap = TRAP(regs);
if (!trap_is_syscall(regs) && cpu_has_feature(CPU_FTR_CFAR))
pr_cont("CFAR: "REG" ", regs->orig_gpr3);
- if (trap == INTERRUPT_MACHINE_CHECK ||
- trap == INTERRUPT_DATA_STORAGE ||
- trap == INTERRUPT_ALIGNMENT) {
+ if (interrupt_detail_printable(TRAP(regs))) {
if (IS_ENABLED(CONFIG_4xx) || IS_ENABLED(CONFIG_BOOKE))
pr_cont("DEAR: "REG" ESR: "REG" ", regs->dar, regs->dsisr);
else
--
2.17.1
next reply other threads:[~2021-04-22 15:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-22 15:10 Xiongwei Song [this message]
2021-04-22 15:10 ` [PATCH 2/2] powerpc: Print esr register when hitting Program Interrupt Xiongwei Song
2021-04-22 15:29 ` Christophe Leroy
2021-04-22 16:49 ` Christophe Leroy
2021-04-24 14:21 ` Xiongwei Song
2021-04-24 13:51 ` Xiongwei Song
2021-04-22 15:27 ` [PATCH 1/2] powerpc: Make the code in __show_regs nice-looking Christophe Leroy
2021-04-24 14:36 ` Xiongwei Song
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=20210422151022.17868-1-sxwjean@me.com \
--to=sxwjean@me.com \
--cc=0x7f454c46@gmail.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=paulus@samba.org \
--cc=ravi.bangoria@linux.ibm.com \
--cc=sxwjean@gmail.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