Skip to content

Commit

Permalink
ARM: hw_breakpoint: reset control registers in hotplug path
Browse files Browse the repository at this point in the history
The ARMv7 debug architecture doesn't make any guarantees about the
contents of debug control registers following a debug logic reset.

This patch ensures that we reset the control registers when a cpu
comes ONLINE (for example, with hotplug) so that when we enable
monitor mode while inserting a breakpoint we won't exhibit random
behaviour.

Signed-off-by: Will Deacon <will.deacon@arm.com>
  • Loading branch information
Will Deacon committed Dec 6, 2010
1 parent ac88e07 commit 7d99331
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion arch/arm/kernel/hw_breakpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr,
/*
* One-time initialisation.
*/
static void __init reset_ctrl_regs(void *unused)
static void reset_ctrl_regs(void *unused)
{
int i;

Expand Down Expand Up @@ -799,6 +799,18 @@ static void __init reset_ctrl_regs(void *unused)
}
}

static int __cpuinit dbg_reset_notify(struct notifier_block *self,
unsigned long action, void *cpu)
{
if (action == CPU_ONLINE)
smp_call_function_single((int)cpu, reset_ctrl_regs, NULL, 1);
return NOTIFY_OK;
}

static struct notifier_block __cpuinitdata dbg_reset_nb = {
.notifier_call = dbg_reset_notify,
};

static int __init arch_hw_breakpoint_init(void)
{
int ret = 0;
Expand Down Expand Up @@ -846,6 +858,8 @@ static int __init arch_hw_breakpoint_init(void)
hook_ifault_code(2, hw_breakpoint_pending, SIGTRAP, TRAP_HWBKPT,
"breakpoint debug exception");

/* Register hotplug notifier. */
register_cpu_notifier(&dbg_reset_nb);
out:
return ret;
}
Expand Down

0 comments on commit 7d99331

Please sign in to comment.