linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 02/11] ARM: hw_breakpoint: reset control registers in hotplug path
Date: Thu,  2 Dec 2010 13:45:53 +0000	[thread overview]
Message-ID: <1291297562-8052-3-git-send-email-will.deacon@arm.com> (raw)
In-Reply-To: <1291297562-8052-1-git-send-email-will.deacon@arm.com>

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>
---
 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 793959e..515a3c4 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -764,7 +764,7 @@ out:
 /*
  * One-time initialisation.
  */
-static void __init reset_ctrl_regs(void *unused)
+static void reset_ctrl_regs(void *unused)
 {
 	int i;
 
@@ -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;
@@ -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;
 }
-- 
1.7.0.4

  parent reply	other threads:[~2010-12-02 13:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02 13:45 [PATCH 00/11] ARM: hw_breakpoint: fixes and improvements (v3) Will Deacon
2010-12-02 13:45 ` [PATCH 01/11] ARM: hw_breakpoint: ensure OS lock is clear before writing to debug registers Will Deacon
2010-12-02 13:45 ` Will Deacon [this message]
2010-12-02 13:45 ` [PATCH 03/11] ARM: hw_breakpoint: correct and simplify alignment fixup code Will Deacon
2010-12-02 13:45 ` [PATCH 04/11] ARM: hw_breakpoint: disable preemption during debug exception handling Will Deacon
2010-12-02 13:45 ` [PATCH 05/11] ARM: hw_breakpoint: don't advertise reserved breakpoints Will Deacon
2010-12-02 13:45 ` [PATCH 06/11] ARM: hw_breakpoint: do not allocate new breakpoints with preemption disabled Will Deacon
2010-12-02 13:45 ` [PATCH 07/11] ARM: hw_breakpoint: unify single-stepping code for watchpoints and breakpoints Will Deacon
2010-12-02 13:45 ` [PATCH 08/11] ARM: hw_breakpoint: disallow per-cpu breakpoints without overflow handler Will Deacon
2010-12-02 13:46 ` [PATCH 09/11] ARM: ptrace: fix style issue with hw_breakpoint interface Will Deacon
2010-12-02 13:46 ` [PATCH 10/11] ARM: hw_breakpoint: fix warnings generated by sparse Will Deacon
2010-12-02 14:30   ` Russell King - ARM Linux
2010-12-02 14:33     ` Will Deacon
2010-12-02 13:46 ` [PATCH 11/11] ARM: hw_breakpoint: do not fail initcall if monitor mode is disabled Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1291297562-8052-3-git-send-email-will.deacon@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).