All of lore.kernel.org
 help / color / mirror / Atom feed
From: WANG Xuerui <kernel@xen0n.name>
To: Huacai Chen <chenhuacai@kernel.org>
Cc: loongarch@lists.linux.dev, WANG Xuerui <git@xen0n.name>
Subject: [PATCH v2 09/11] LoongArch: Humanize the ECFG line when showing registers
Date: Thu, 29 Dec 2022 13:33:04 +0800	[thread overview]
Message-ID: <20221229053306.3285457-10-kernel@xen0n.name> (raw)
In-Reply-To: <20221229053306.3285457-1-kernel@xen0n.name>

From: WANG Xuerui <git@xen0n.name>

Example output looks like:

[   xx.xxxxxx]  ecfg: 00071c1c (VS=7 LIE=2-4,10-12)

Signed-off-by: WANG Xuerui <git@xen0n.name>
---
 arch/loongarch/kernel/traps.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/arch/loongarch/kernel/traps.c b/arch/loongarch/kernel/traps.c
index a43f95631cea..2b26e610cc8f 100644
--- a/arch/loongarch/kernel/traps.c
+++ b/arch/loongarch/kernel/traps.c
@@ -187,6 +187,12 @@ static void print_memory_type_fragment(const char *key, unsigned long val)
 	}
 }
 
+static void print_intr_fragment(const char *key, unsigned long val)
+{
+	/* e.g. "LIE=0-1,3,5-7" */
+	pr_cont(" %s=%*pbl", key, EXCCODE_INT_NUM, &val);
+}
+
 static void print_crmd(unsigned long x)
 {
 	pr_cont(" crmd: %08lx (", x);
@@ -219,6 +225,13 @@ static void print_euen(unsigned long x)
 	pr_cont(")\n");
 }
 
+static void print_ecfg(unsigned long x)
+{
+	pr_cont(" ecfg: %08lx (VS=%d", x, (int) FIELD_GET(CSR_ECFG_VS, x));
+	print_intr_fragment("LIE", FIELD_GET(CSR_ECFG_IM, x));
+	pr_cont(")\n");
+}
+
 static void __show_regs(const struct pt_regs *regs)
 {
 	const int field = 2 * sizeof(unsigned long);
@@ -260,7 +273,7 @@ static void __show_regs(const struct pt_regs *regs)
 	print_crmd(regs->csr_crmd);
 	print_prmd(regs->csr_prmd);
 	print_euen(regs->csr_euen);
-	pr_cont(" ecfg: %08lx\n", regs->csr_ecfg);
+	print_ecfg(regs->csr_ecfg);
 	pr_cont("estat: %08lx\n", regs->csr_estat);
 
 	exccode = ((regs->csr_estat) & CSR_ESTAT_EXC) >> CSR_ESTAT_EXC_SHIFT;
-- 
2.38.1


  parent reply	other threads:[~2022-12-29  5:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-29  5:32 [PATCH v2 00/11] LoongArch: Better backtraces WANG Xuerui
2022-12-29  5:32 ` [PATCH v2 01/11] LoongArch: Clean up the architectural interrupt definitions WANG Xuerui
2022-12-29  5:32 ` [PATCH v2 02/11] LoongArch: Add exception subcode definitions for the watchpoint exception WANG Xuerui
2022-12-29  5:32 ` [PATCH v2 03/11] LoongArch: Print GPRs with ABI names when showing registers WANG Xuerui
2022-12-29  5:32 ` [PATCH v2 04/11] LoongArch: Print symbol info for PC and $ra only for kernel-mode contexts WANG Xuerui
2022-12-29  5:33 ` [PATCH v2 05/11] LoongArch: Fix format of CSR lines during show_regs WANG Xuerui
2022-12-29  5:33 ` [PATCH v2 06/11] LoongArch: Humanize the CRMD line when showing registers WANG Xuerui
2022-12-29  5:33 ` [PATCH v2 07/11] LoongArch: Humanize the PRMD " WANG Xuerui
2022-12-29  5:33 ` [PATCH v2 08/11] LoongArch: Humanize the EUEN " WANG Xuerui
2022-12-29  5:33 ` WANG Xuerui [this message]
2022-12-29  5:33 ` [PATCH v2 10/11] LoongArch: Humanize the ESTAT " WANG Xuerui
2022-12-29  5:33 ` [PATCH v2 11/11] LoongArch: Use lowercase ISA manual names for BADV and CPUCFG.PRID lines in show_regs WANG Xuerui
2023-01-01  9:51 ` [PATCH v2 00/11] LoongArch: Better backtraces Huacai Chen

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=20221229053306.3285457-10-kernel@xen0n.name \
    --to=kernel@xen0n.name \
    --cc=chenhuacai@kernel.org \
    --cc=git@xen0n.name \
    --cc=loongarch@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.