aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2013-01-24 10:02:59 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-01-28 19:35:08 -0500
commit4ae7ebe9522a9e3626e28b4d268dae712738573d (patch)
treee71928a561fc2db543e88211b6b0747c10abb9cd /arch
parent05d694ea0daa2e442191a2128aaec78635823f08 (diff)
powerpc: Change hardware breakpoint to allow longer ranges
Change the hardware breakpoint code so that we can support wider ranged breakpoints. This means both ptrace and perf hardware breakpoints can use upto 512 byte long breakpoints when using the DAWR and only 8 byte when using the DABR. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/include/asm/hw_breakpoint.h2
-rw-r--r--arch/powerpc/kernel/hw_breakpoint.c12
2 files changed, 10 insertions, 4 deletions
diff --git a/arch/powerpc/include/asm/hw_breakpoint.h b/arch/powerpc/include/asm/hw_breakpoint.h
index 96437e5014e1..eb0f4ac75c4c 100644
--- a/arch/powerpc/include/asm/hw_breakpoint.h
+++ b/arch/powerpc/include/asm/hw_breakpoint.h
@@ -57,8 +57,6 @@ struct pmu;
57struct perf_sample_data; 57struct perf_sample_data;
58 58
59#define HW_BREAKPOINT_ALIGN 0x7 59#define HW_BREAKPOINT_ALIGN 0x7
60/* Maximum permissible length of any HW Breakpoint */
61#define HW_BREAKPOINT_LEN 0x8
62 60
63extern int hw_breakpoint_slots(int type); 61extern int hw_breakpoint_slots(int type);
64extern int arch_bp_generic_fields(int type, int *gen_bp_type); 62extern int arch_bp_generic_fields(int type, int *gen_bp_type);
diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
index 2a3e8dd547ec..a949bdfc9623 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -142,7 +142,7 @@ int arch_bp_generic_fields(int type, int *gen_bp_type)
142 */ 142 */
143int arch_validate_hwbkpt_settings(struct perf_event *bp) 143int arch_validate_hwbkpt_settings(struct perf_event *bp)
144{ 144{
145 int ret = -EINVAL; 145 int ret = -EINVAL, length_max;
146 struct arch_hw_breakpoint *info = counter_arch_bp(bp); 146 struct arch_hw_breakpoint *info = counter_arch_bp(bp);
147 147
148 if (!bp) 148 if (!bp)
@@ -171,8 +171,16 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
171 * HW_BREAKPOINT_ALIGN by rounding off to the lower address, the 171 * HW_BREAKPOINT_ALIGN by rounding off to the lower address, the
172 * 'symbolsize' should satisfy the check below. 172 * 'symbolsize' should satisfy the check below.
173 */ 173 */
174 length_max = 8; /* DABR */
175 if (cpu_has_feature(CPU_FTR_DAWR)) {
176 length_max = 512 ; /* 64 doublewords */
177 /* DAWR region can't cross 512 boundary */
178 if ((bp->attr.bp_addr >> 10) !=
179 ((bp->attr.bp_addr + bp->attr.bp_len) >> 10))
180 return -EINVAL;
181 }
174 if (info->len > 182 if (info->len >
175 (HW_BREAKPOINT_LEN - (info->address & HW_BREAKPOINT_ALIGN))) 183 (length_max - (info->address & HW_BREAKPOINT_ALIGN)))
176 return -EINVAL; 184 return -EINVAL;
177 return 0; 185 return 0;
178} 186}