aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include/asm
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-11-09 02:27:40 -0500
committerPaul Mundt <lethal@linux-sh.org>2009-12-08 01:02:27 -0500
commit09a072947791088b88ae15111cf68fc5aaaf758d (patch)
tree510728ca3d3906a352cfc673e7f3e38e471165b4 /arch/sh/include/asm
parent6ec22f9b037fc0c2e00ddb7023fad279c365324d (diff)
sh: hw-breakpoints: Add preliminary support for SH-4A UBC.
This adds preliminary support for the SH-4A UBC to the hw-breakpoints API. Presently only a single channel is implemented, and the ptrace interface still needs to be converted. This is the first step to cleaning up the long-standing UBC mess, making the UBC more generally accessible, and finally making it SMP safe. An additional abstraction will be layered on top of this as with the perf events code to permit the various CPU families to wire up support for their own specific UBCs, as many variations exist. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/include/asm')
-rw-r--r--arch/sh/include/asm/Kbuild4
-rw-r--r--arch/sh/include/asm/hw_breakpoint.h53
-rw-r--r--arch/sh/include/asm/kdebug.h2
-rw-r--r--arch/sh/include/asm/processor_32.h8
-rw-r--r--arch/sh/include/asm/system.h2
-rw-r--r--arch/sh/include/asm/thread_info.h2
-rw-r--r--arch/sh/include/asm/ubc.h8
7 files changed, 70 insertions, 9 deletions
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index e121c30f797d..46cb93477bcb 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -1,6 +1,8 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += cachectl.h cpu-features.h 3header-y += cachectl.h
4header-y += cpu-features.h
5header-y += hw_breakpoint.h
4 6
5unifdef-y += unistd_32.h 7unifdef-y += unistd_32.h
6unifdef-y += unistd_64.h 8unifdef-y += unistd_64.h
diff --git a/arch/sh/include/asm/hw_breakpoint.h b/arch/sh/include/asm/hw_breakpoint.h
new file mode 100644
index 000000000000..0f4a00f60058
--- /dev/null
+++ b/arch/sh/include/asm/hw_breakpoint.h
@@ -0,0 +1,53 @@
1#ifndef __ASM_SH_HW_BREAKPOINT_H
2#define __ASM_SH_HW_BREAKPOINT_H
3
4#include <linux/kdebug.h>
5#include <linux/types.h>
6#include <asm/ubc.h>
7
8#ifdef __KERNEL__
9#define __ARCH_HW_BREAKPOINT_H
10
11struct arch_hw_breakpoint {
12 char *name; /* Contains name of the symbol to set bkpt */
13 unsigned long address;
14 unsigned long asid;
15 u16 len;
16 u16 type;
17};
18
19enum {
20 SH_BREAKPOINT_READ = (1 << 1),
21 SH_BREAKPOINT_WRITE = (1 << 2),
22 SH_BREAKPOINT_RW = SH_BREAKPOINT_READ | SH_BREAKPOINT_WRITE,
23
24 SH_BREAKPOINT_LEN_1 = (1 << 12),
25 SH_BREAKPOINT_LEN_2 = (1 << 13),
26 SH_BREAKPOINT_LEN_4 = SH_BREAKPOINT_LEN_1 | SH_BREAKPOINT_LEN_2,
27 SH_BREAKPOINT_LEN_8 = (1 << 14),
28};
29
30/* Total number of available UBC channels */
31#define HBP_NUM 1 /* XXX */
32
33struct perf_event;
34struct task_struct;
35struct pmu;
36
37extern int arch_check_va_in_userspace(unsigned long va, u16 hbp_len);
38extern int arch_validate_hwbkpt_settings(struct perf_event *bp,
39 struct task_struct *tsk);
40extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
41 unsigned long val, void *data);
42
43int arch_install_hw_breakpoint(struct perf_event *bp);
44void arch_uninstall_hw_breakpoint(struct perf_event *bp);
45void hw_breakpoint_pmu_read(struct perf_event *bp);
46void hw_breakpoint_pmu_unthrottle(struct perf_event *bp);
47
48extern void arch_fill_perf_breakpoint(struct perf_event *bp);
49
50extern struct pmu perf_ops_bp;
51
52#endif /* __KERNEL__ */
53#endif /* __ASM_SH_HW_BREAKPOINT_H */
diff --git a/arch/sh/include/asm/kdebug.h b/arch/sh/include/asm/kdebug.h
index 985219f9759e..5f6d2e9ccb7c 100644
--- a/arch/sh/include/asm/kdebug.h
+++ b/arch/sh/include/asm/kdebug.h
@@ -6,6 +6,8 @@ enum die_val {
6 DIE_TRAP, 6 DIE_TRAP,
7 DIE_NMI, 7 DIE_NMI,
8 DIE_OOPS, 8 DIE_OOPS,
9 DIE_BREAKPOINT,
10 DIE_SSTEP,
9}; 11};
10 12
11#endif /* __ASM_SH_KDEBUG_H */ 13#endif /* __ASM_SH_KDEBUG_H */
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
index 9a8714945dc9..f4b54040dbc3 100644
--- a/arch/sh/include/asm/processor_32.h
+++ b/arch/sh/include/asm/processor_32.h
@@ -14,6 +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 18
18/* 19/*
19 * Default implementation of macro that returns current 20 * Default implementation of macro that returns current
@@ -99,8 +100,8 @@ struct thread_struct {
99 unsigned long sp; 100 unsigned long sp;
100 unsigned long pc; 101 unsigned long pc;
101 102
102 /* Hardware debugging registers */ 103 /* Save middle states of ptrace breakpoints */
103 unsigned long ubc_pc; 104 struct perf_event *ptrace_bps[NR_UBC_CHANNELS];
104 105
105 /* floating point info */ 106 /* floating point info */
106 union sh_fpu_union fpu; 107 union sh_fpu_union fpu;
@@ -111,9 +112,6 @@ struct thread_struct {
111#endif 112#endif
112}; 113};
113 114
114/* Count of active tasks with UBC settings */
115extern int ubc_usercnt;
116
117#define INIT_THREAD { \ 115#define INIT_THREAD { \
118 .sp = sizeof(init_stack) + (long) &init_stack, \ 116 .sp = sizeof(init_stack) + (long) &init_stack, \
119} 117}
diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h
index b5c5acdc8c0e..1014da8b3ed3 100644
--- a/arch/sh/include/asm/system.h
+++ b/arch/sh/include/asm/system.h
@@ -144,8 +144,6 @@ void per_cpu_trap_init(void);
144void default_idle(void); 144void default_idle(void);
145void cpu_idle_wait(void); 145void cpu_idle_wait(void);
146 146
147asmlinkage void break_point_trap(void);
148
149#ifdef CONFIG_SUPERH32 147#ifdef CONFIG_SUPERH32
150#define BUILD_TRAP_HANDLER(name) \ 148#define BUILD_TRAP_HANDLER(name) \
151asmlinkage void name##_trap_handler(unsigned long r4, unsigned long r5, \ 149asmlinkage void name##_trap_handler(unsigned long r4, unsigned long r5, \
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index bdeb9d46d17d..8ab9145bf50b 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -117,6 +117,7 @@ extern void free_thread_info(struct thread_info *ti);
117#define TIF_SECCOMP 6 /* secure computing */ 117#define TIF_SECCOMP 6 /* secure computing */
118#define TIF_NOTIFY_RESUME 7 /* callback before returning to user */ 118#define TIF_NOTIFY_RESUME 7 /* callback before returning to user */
119#define TIF_SYSCALL_TRACEPOINT 8 /* for ftrace syscall instrumentation */ 119#define TIF_SYSCALL_TRACEPOINT 8 /* for ftrace syscall instrumentation */
120#define TIF_DEBUG 9 /* uses UBC */
120#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 121#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
121#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 122#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
122#define TIF_MEMDIE 18 123#define TIF_MEMDIE 18
@@ -131,6 +132,7 @@ extern void free_thread_info(struct thread_info *ti);
131#define _TIF_SECCOMP (1 << TIF_SECCOMP) 132#define _TIF_SECCOMP (1 << TIF_SECCOMP)
132#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 133#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
133#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) 134#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
135#define _TIF_DEBUG (1 << TIF_DEBUG)
134#define _TIF_USEDFPU (1 << TIF_USEDFPU) 136#define _TIF_USEDFPU (1 << TIF_USEDFPU)
135#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 137#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
136#define _TIF_FREEZE (1 << TIF_FREEZE) 138#define _TIF_FREEZE (1 << TIF_FREEZE)
diff --git a/arch/sh/include/asm/ubc.h b/arch/sh/include/asm/ubc.h
index 4ca4b7717371..dd7878197b6e 100644
--- a/arch/sh/include/asm/ubc.h
+++ b/arch/sh/include/asm/ubc.h
@@ -10,8 +10,8 @@
10 */ 10 */
11#ifndef __ASM_SH_UBC_H 11#ifndef __ASM_SH_UBC_H
12#define __ASM_SH_UBC_H 12#define __ASM_SH_UBC_H
13#ifdef __KERNEL__
14 13
14#ifdef __KERNEL__
15#include <cpu/ubc.h> 15#include <cpu/ubc.h>
16 16
17/* User Break Controller */ 17/* User Break Controller */
@@ -60,6 +60,12 @@
60#define BRCR_UBDE (1 << 0) 60#define BRCR_UBDE (1 << 0)
61#endif 61#endif
62 62
63/*
64 * All SH parts have 2 UBC channels. I defy any hardware designer to
65 * invalidate this assertion.
66 */
67#define NR_UBC_CHANNELS 2
68
63#ifndef __ASSEMBLY__ 69#ifndef __ASSEMBLY__
64/* arch/sh/kernel/cpu/ubc.S */ 70/* arch/sh/kernel/cpu/ubc.S */
65extern void ubc_sleep(void); 71extern void ubc_sleep(void);