From patchwork Fri Jan 25 01:02:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 215519 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 65C982C00C1 for ; Fri, 25 Jan 2013 12:03:37 +1100 (EST) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id EC5E72C007E; Fri, 25 Jan 2013 12:03:08 +1100 (EST) Received: by localhost.localdomain (Postfix, from userid 1000) id EA99FD42673; Fri, 25 Jan 2013 12:03:07 +1100 (EST) From: Michael Neuling To: Benjamin Herrenschmidt Subject: [PATCH 1/2] powerpc: Add length setting to set_dawr Date: Fri, 25 Jan 2013 12:02:58 +1100 Message-Id: <1359075779-27492-1-git-send-email-mikey@neuling.org> X-Mailer: git-send-email 1.7.10.4 Cc: Michael Neuling , linuxppc-dev@lists.ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Currently we set the length field in the DAWR to 0 which defaults it to one double word (64bits) which is the same as the DABR. Change this so that we can set it to longer values as supported by the DAWR. Signed-off-by: Michael Neuling --- arch/powerpc/kernel/process.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index bccc81b..f49a05f 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -420,7 +420,7 @@ static inline int set_dabr(struct arch_hw_breakpoint *brk) static inline int set_dawr(struct arch_hw_breakpoint *brk) { - unsigned long dawr, dawrx; + unsigned long dawr, dawrx, mrd; dawr = brk->address; @@ -430,6 +430,14 @@ static inline int set_dawr(struct arch_hw_breakpoint *brk) << (63 - 59); //* translate */ dawrx |= (brk->type & (HW_BRK_TYPE_PRIV_ALL)) \ >> 3; //* PRIM bits */ + /* dawr length is stored in field MDR bits 48:53. Matches range in + doublewords (64 bits) baised by -1 eg. 0b000000=1DW and + 0b111111=64DW. + brk->len is in bytes. + This aligns up to double word size, shifts and does the bias. + */ + mrd = ((brk->len + 7) >> 3) - 1; + dawrx |= (mrd & 0x3f) << (63 - 53); if (ppc_md.set_dawr) return ppc_md.set_dawr(dawr, dawrx);