Skip to content

Commit

Permalink
arm: Improve reporting of unhandled HYP exits
Browse files Browse the repository at this point in the history
Add a simple register dump and unify the reporting format. Specifically
useful to debug hypervisor crashes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
  • Loading branch information
jan-kiszka committed Jul 14, 2015
1 parent 9c2e5c0 commit 6089d65
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions hypervisor/arch/arm/control.c
Expand Up @@ -163,12 +163,17 @@ static void arch_suspend_self(struct per_cpu *cpu_data)
arch_cpu_tlb_flush(cpu_data);
}

static void arch_dump_exit(const char *reason)
static void arch_dump_exit(struct registers *regs, const char *reason)
{
unsigned long pc;
unsigned int n;

arm_read_banked_reg(ELR_hyp, pc);
panic_printk("Unhandled HYP %s exit at 0x%x\n", reason, pc);
for (n = 0; n < NUM_USR_REGS; n++)
panic_printk("r%d:%s 0x%08lx%s", n, n < 10 ? " " : "",
regs->usr[n], n % 4 == 3 ? "\n" : " ");
panic_printk("\n");
}

static void arch_dump_abt(bool is_data)
Expand All @@ -182,7 +187,7 @@ static void arch_dump_abt(bool is_data)
else
arm_read_sysreg(HIFAR, hxfar);

panic_printk(" paddr=0x%lx esr=0x%x\n", hxfar, esr);
panic_printk("Physical address: 0x%08lx ESR: 0x%08x\n", hxfar, esr);
}

struct registers* arch_handle_exit(struct per_cpu *cpu_data,
Expand All @@ -199,24 +204,24 @@ struct registers* arch_handle_exit(struct per_cpu *cpu_data,
break;

case EXIT_REASON_UNDEF:
arch_dump_exit("undef");
arch_dump_exit(regs, "undef");
panic_stop();
case EXIT_REASON_DABT:
arch_dump_exit("data abort");
arch_dump_exit(regs, "data abort");
arch_dump_abt(true);
panic_stop();
case EXIT_REASON_PABT:
arch_dump_exit("prefetch abort");
arch_dump_exit(regs, "prefetch abort");
arch_dump_abt(false);
panic_stop();
case EXIT_REASON_HVC:
arch_dump_exit("hvc");
arch_dump_exit(regs, "hvc");
panic_stop();
case EXIT_REASON_FIQ:
arch_dump_exit("fiq");
arch_dump_exit(regs, "fiq");
panic_stop();
default:
arch_dump_exit("unknown");
arch_dump_exit(regs, "unknown");
panic_stop();
}

Expand Down

0 comments on commit 6089d65

Please sign in to comment.