diff options
author | Will Deacon <will.deacon@arm.com> | 2010-11-24 12:45:49 -0500 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2010-12-06 06:55:56 -0500 |
commit | 7d99331e4793b52d488e911876ef11d843c6c8c9 (patch) | |
tree | 0b9d7e659ed21a56c166303772043afcdf9da61a | |
parent | ac88e07122fc0eb5cbad403be97ef02c317a06b7 (diff) |
ARM: hw_breakpoint: reset control registers in hotplug path
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>
-rw-r--r-- | arch/arm/kernel/hw_breakpoint.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c index 793959ec8982..515a3c44c118 100644 --- a/arch/arm/kernel/hw_breakpoint.c +++ b/arch/arm/kernel/hw_breakpoint.c | |||
@@ -764,7 +764,7 @@ out: | |||
764 | /* | 764 | /* |
765 | * One-time initialisation. | 765 | * One-time initialisation. |
766 | */ | 766 | */ |
767 | static void __init reset_ctrl_regs(void *unused) | 767 | static void reset_ctrl_regs(void *unused) |
768 | { | 768 | { |
769 | int i; | 769 | int i; |
770 | 770 | ||
@@ -799,6 +799,18 @@ static void __init reset_ctrl_regs(void *unused) | |||
799 | } | 799 | } |
800 | } | 800 | } |
801 | 801 | ||
802 | static int __cpuinit dbg_reset_notify(struct notifier_block *self, | ||
803 | unsigned long action, void *cpu) | ||
804 | { | ||
805 | if (action == CPU_ONLINE) | ||
806 | smp_call_function_single((int)cpu, reset_ctrl_regs, NULL, 1); | ||
807 | return NOTIFY_OK; | ||
808 | } | ||
809 | |||
810 | static struct notifier_block __cpuinitdata dbg_reset_nb = { | ||
811 | .notifier_call = dbg_reset_notify, | ||
812 | }; | ||
813 | |||
802 | static int __init arch_hw_breakpoint_init(void) | 814 | static int __init arch_hw_breakpoint_init(void) |
803 | { | 815 | { |
804 | int ret = 0; | 816 | int ret = 0; |
@@ -846,6 +858,8 @@ static int __init arch_hw_breakpoint_init(void) | |||
846 | hook_ifault_code(2, hw_breakpoint_pending, SIGTRAP, TRAP_HWBKPT, | 858 | hook_ifault_code(2, hw_breakpoint_pending, SIGTRAP, TRAP_HWBKPT, |
847 | "breakpoint debug exception"); | 859 | "breakpoint debug exception"); |
848 | 860 | ||
861 | /* Register hotplug notifier. */ | ||
862 | register_cpu_notifier(&dbg_reset_nb); | ||
849 | out: | 863 | out: |
850 | return ret; | 864 | return ret; |
851 | } | 865 | } |