Skip to content

Commit

Permalink
LoongArch: Humanize the PRMD line when showing registers
Browse files Browse the repository at this point in the history
Example output looks like:

[   xx.xxxxxx]  PRMD: 00000004 (PPLV0 +PIE -PWE)

Signed-off-by: WANG Xuerui <[email protected]>
Signed-off-by: Huacai Chen <[email protected]>
  • Loading branch information
xen0n authored and chenhuacai committed May 1, 2023
1 parent efada2a commit ce7f0b1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion arch/loongarch/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ static void print_crmd(unsigned long x)
pr_cont(")\n");
}

static void print_prmd(unsigned long x)
{
printk(" PRMD: %08lx (", x);
print_plv_fragment("PPLV", (int) FIELD_GET(CSR_PRMD_PPLV, x));
print_bool_fragment("PIE", FIELD_GET(CSR_PRMD_PIE, x), false);
print_bool_fragment("PWE", FIELD_GET(CSR_PRMD_PWE, x), false);
pr_cont(")\n");
}

static void __show_regs(const struct pt_regs *regs)
{
const int field = 2 * sizeof(unsigned long);
Expand Down Expand Up @@ -244,7 +253,7 @@ static void __show_regs(const struct pt_regs *regs)

/* Print saved important CSRs */
print_crmd(regs->csr_crmd);
printk(" PRMD: %08lx\n", regs->csr_prmd);
print_prmd(regs->csr_prmd);
printk(" EUEN: %08lx\n", regs->csr_euen);
printk(" ECFG: %08lx\n", regs->csr_ecfg);
printk("ESTAT: %08lx\n", regs->csr_estat);
Expand Down

0 comments on commit ce7f0b1

Please sign in to comment.