aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include/asm
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-01-05 05:06:45 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-01-05 05:06:45 -0500
commit4352fc1b12fae4c753a063a2f162ddf9277af774 (patch)
tree686ca79f2e1c4dbe65e51cac2b14a8234069b0a0 /arch/sh/include/asm
parentc4761815ab49feca904776dec464046bc7138d3a (diff)
sh: Abstracted SH-4A UBC support on hw-breakpoint core.
This is the next big chunk of hw_breakpoint support. This decouples the SH-4A support from the core and moves it out in to its own stub, following many of the conventions established with the perf events layering. In addition to extending SH-4A support to encapsulate the remainder of the UBC channels, clock framework support for handling the UBC interface clock is added as well, allowing for dynamic clock gating. This also fixes up a regression introduced by the SIGTRAP handling that broke the ksym_tracer, to the extent that the current support works well with all of the ksym_tracer/ptrace/kgdb. The kprobes singlestep code will follow in turn. With this in place, the remaining UBC variants (SH-2A and SH-4) can now be trivially plugged in. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/include/asm')
-rw-r--r--arch/sh/include/asm/hw_breakpoint.h22
-rw-r--r--arch/sh/include/asm/processor_32.h4
2 files changed, 20 insertions, 6 deletions
diff --git a/arch/sh/include/asm/hw_breakpoint.h b/arch/sh/include/asm/hw_breakpoint.h
index 0f4a00f60058..7295d6290249 100644
--- a/arch/sh/include/asm/hw_breakpoint.h
+++ b/arch/sh/include/asm/hw_breakpoint.h
@@ -3,7 +3,6 @@
3 3
4#include <linux/kdebug.h> 4#include <linux/kdebug.h>
5#include <linux/types.h> 5#include <linux/types.h>
6#include <asm/ubc.h>
7 6
8#ifdef __KERNEL__ 7#ifdef __KERNEL__
9#define __ARCH_HW_BREAKPOINT_H 8#define __ARCH_HW_BREAKPOINT_H
@@ -11,7 +10,6 @@
11struct arch_hw_breakpoint { 10struct arch_hw_breakpoint {
12 char *name; /* Contains name of the symbol to set bkpt */ 11 char *name; /* Contains name of the symbol to set bkpt */
13 unsigned long address; 12 unsigned long address;
14 unsigned long asid;
15 u16 len; 13 u16 len;
16 u16 type; 14 u16 type;
17}; 15};
@@ -27,13 +25,28 @@ enum {
27 SH_BREAKPOINT_LEN_8 = (1 << 14), 25 SH_BREAKPOINT_LEN_8 = (1 << 14),
28}; 26};
29 27
30/* Total number of available UBC channels */ 28struct sh_ubc {
31#define HBP_NUM 1 /* XXX */ 29 const char *name;
30 unsigned int num_events;
31 unsigned int trap_nr;
32 void (*enable)(struct arch_hw_breakpoint *, int);
33 void (*disable)(struct arch_hw_breakpoint *, int);
34 void (*enable_all)(unsigned long);
35 void (*disable_all)(void);
36 unsigned long (*active_mask)(void);
37 unsigned long (*triggered_mask)(void);
38 void (*clear_triggered_mask)(unsigned long);
39 struct clk *clk; /* optional interface clock / MSTP bit */
40};
32 41
33struct perf_event; 42struct perf_event;
34struct task_struct; 43struct task_struct;
35struct pmu; 44struct pmu;
36 45
46/* Maximum number of UBC channels */
47#define HBP_NUM 2
48
49/* arch/sh/kernel/hw_breakpoint.c */
37extern int arch_check_va_in_userspace(unsigned long va, u16 hbp_len); 50extern int arch_check_va_in_userspace(unsigned long va, u16 hbp_len);
38extern int arch_validate_hwbkpt_settings(struct perf_event *bp, 51extern int arch_validate_hwbkpt_settings(struct perf_event *bp,
39 struct task_struct *tsk); 52 struct task_struct *tsk);
@@ -46,6 +59,7 @@ void hw_breakpoint_pmu_read(struct perf_event *bp);
46void hw_breakpoint_pmu_unthrottle(struct perf_event *bp); 59void hw_breakpoint_pmu_unthrottle(struct perf_event *bp);
47 60
48extern void arch_fill_perf_breakpoint(struct perf_event *bp); 61extern void arch_fill_perf_breakpoint(struct perf_event *bp);
62extern int register_sh_ubc(struct sh_ubc *);
49 63
50extern struct pmu perf_ops_bp; 64extern struct pmu perf_ops_bp;
51 65
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
index d60b28271a05..259112cecbdf 100644
--- a/arch/sh/include/asm/processor_32.h
+++ b/arch/sh/include/asm/processor_32.h
@@ -14,7 +14,7 @@
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/types.h> 15#include <asm/types.h>
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/ubc.h> 17#include <asm/hw_breakpoint.h>
18 18
19/* 19/*
20 * Default implementation of macro that returns current 20 * Default implementation of macro that returns current
@@ -102,7 +102,7 @@ struct thread_struct {
102 unsigned long pc; 102 unsigned long pc;
103 103
104 /* Save middle states of ptrace breakpoints */ 104 /* Save middle states of ptrace breakpoints */
105 struct perf_event *ptrace_bps[NR_UBC_CHANNELS]; 105 struct perf_event *ptrace_bps[HBP_NUM];
106 106
107 /* floating point info */ 107 /* floating point info */
108 union sh_fpu_union fpu; 108 union sh_fpu_union fpu;