Skip to content

Commit 5e3e784

Browse files
xen0nchenhuacai
authored andcommitted
LoongArch: Humanize the ECFG line when showing registers
Example output looks like: [ xx.xxxxxx] ECFG: 00071c1c (LIE=2-4,10-12 VS=7) Signed-off-by: WANG Xuerui <git@xen0n.name> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 9718d96 commit 5e3e784

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

arch/loongarch/kernel/traps.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ static void print_memory_type_fragment(const char *key, unsigned long val)
189189
pr_cont(" %s=%s", key, humanized_type);
190190
}
191191

192+
static void print_intr_fragment(const char *key, unsigned long val)
193+
{
194+
/* e.g. "LIE=0-1,3,5-7" */
195+
pr_cont("%s=%*pbl", key, EXCCODE_INT_NUM, &val);
196+
}
197+
192198
static void print_crmd(unsigned long x)
193199
{
194200
printk(" CRMD: %08lx (", x);
@@ -221,6 +227,13 @@ static void print_euen(unsigned long x)
221227
pr_cont(")\n");
222228
}
223229

230+
static void print_ecfg(unsigned long x)
231+
{
232+
printk(" ECFG: %08lx (", x);
233+
print_intr_fragment("LIE", FIELD_GET(CSR_ECFG_IM, x));
234+
pr_cont(" VS=%d)\n", (int) FIELD_GET(CSR_ECFG_VS, x));
235+
}
236+
224237
static void __show_regs(const struct pt_regs *regs)
225238
{
226239
const int field = 2 * sizeof(unsigned long);
@@ -265,7 +278,7 @@ static void __show_regs(const struct pt_regs *regs)
265278
print_crmd(regs->csr_crmd);
266279
print_prmd(regs->csr_prmd);
267280
print_euen(regs->csr_euen);
268-
printk(" ECFG: %08lx\n", regs->csr_ecfg);
281+
print_ecfg(regs->csr_ecfg);
269282
printk("ESTAT: %08lx\n", regs->csr_estat);
270283

271284
exccode = ((regs->csr_estat) & CSR_ESTAT_EXC) >> CSR_ESTAT_EXC_SHIFT;

0 commit comments

Comments
 (0)