summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/process.c
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2012-12-20 14:06:45 +0000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-01-10 17:01:47 +1100
commitbf99de36e48678c61adb697496e0364c610bbbfc (patch)
tree3598bcc7ecb662054703a98929d794a542c5c834 /arch/powerpc/kernel/process.c
parent9422de3e953d0e60eb95f5430a9dd803eec1c6d7 (diff)
downloadblackbird-op-linux-bf99de36e48678c61adb697496e0364c610bbbfc.tar.gz
blackbird-op-linux-bf99de36e48678c61adb697496e0364c610bbbfc.zip
powerpc: Add the DAWR support to the set_break()
This adds DAWR supoprt to the set_break(). It does both bare metal and PAPR versions of setting the DAWR. There is still some work we can do to make full use of the watchpoint but that will come later. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/process.c')
-rw-r--r--arch/powerpc/kernel/process.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index c16c1c2abeea..8d56452e1dbd 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -407,10 +407,33 @@ static inline int set_dabr(struct arch_hw_breakpoint *brk)
return __set_dabr(dabr, dabrx);
}
+static inline int set_dawr(struct arch_hw_breakpoint *brk)
+{
+ unsigned long dawr, dawrx;
+
+ dawr = brk->address;
+
+ dawrx = (brk->type & (HW_BRK_TYPE_READ | HW_BRK_TYPE_WRITE)) \
+ << (63 - 58); //* read/write bits */
+ dawrx |= ((brk->type & (HW_BRK_TYPE_TRANSLATE)) >> 2) \
+ << (63 - 59); //* translate */
+ dawrx |= (brk->type & (HW_BRK_TYPE_PRIV_ALL)) \
+ >> 3; //* PRIM bits */
+
+ if (ppc_md.set_dawr)
+ return ppc_md.set_dawr(dawr, dawrx);
+ mtspr(SPRN_DAWR, dawr);
+ mtspr(SPRN_DAWRX, dawrx);
+ return 0;
+}
+
int set_break(struct arch_hw_breakpoint *brk)
{
__get_cpu_var(current_brk) = *brk;
+ if (cpu_has_feature(CPU_FTR_DAWR))
+ return set_dawr(brk);
+
return set_dabr(brk);
}
OpenPOWER on IntegriCloud