aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/blackfin/include')
-rw-r--r--arch/blackfin/include/asm/ipipe.h8
-rw-r--r--arch/blackfin/include/asm/irqflags.h273
-rw-r--r--arch/blackfin/include/asm/mmu_context.h8
-rw-r--r--arch/blackfin/include/asm/system.h4
4 files changed, 149 insertions, 144 deletions
diff --git a/arch/blackfin/include/asm/ipipe.h b/arch/blackfin/include/asm/ipipe.h
index d3b40449ca0e..40f94a704c02 100644
--- a/arch/blackfin/include/asm/ipipe.h
+++ b/arch/blackfin/include/asm/ipipe.h
@@ -49,7 +49,7 @@
49#define prepare_arch_switch(next) \ 49#define prepare_arch_switch(next) \
50do { \ 50do { \
51 ipipe_schedule_notify(current, next); \ 51 ipipe_schedule_notify(current, next); \
52 local_irq_disable_hw(); \ 52 hard_local_irq_disable(); \
53} while (0) 53} while (0)
54 54
55#define task_hijacked(p) \ 55#define task_hijacked(p) \
@@ -57,7 +57,7 @@ do { \
57 int __x__ = __ipipe_root_domain_p; \ 57 int __x__ = __ipipe_root_domain_p; \
58 __clear_bit(IPIPE_SYNC_FLAG, &ipipe_root_cpudom_var(status)); \ 58 __clear_bit(IPIPE_SYNC_FLAG, &ipipe_root_cpudom_var(status)); \
59 if (__x__) \ 59 if (__x__) \
60 local_irq_enable_hw(); \ 60 hard_local_irq_enable(); \
61 !__x__; \ 61 !__x__; \
62 }) 62 })
63 63
@@ -167,7 +167,7 @@ static inline unsigned long __ipipe_ffnz(unsigned long ul)
167#define __ipipe_run_isr(ipd, irq) \ 167#define __ipipe_run_isr(ipd, irq) \
168 do { \ 168 do { \
169 if (!__ipipe_pipeline_head_p(ipd)) \ 169 if (!__ipipe_pipeline_head_p(ipd)) \
170 local_irq_enable_hw(); \ 170 hard_local_irq_enable(); \
171 if (ipd == ipipe_root_domain) { \ 171 if (ipd == ipipe_root_domain) { \
172 if (unlikely(ipipe_virtual_irq_p(irq))) { \ 172 if (unlikely(ipipe_virtual_irq_p(irq))) { \
173 irq_enter(); \ 173 irq_enter(); \
@@ -183,7 +183,7 @@ static inline unsigned long __ipipe_ffnz(unsigned long ul)
183 __ipipe_run_irqtail(); \ 183 __ipipe_run_irqtail(); \
184 __set_bit(IPIPE_SYNC_FLAG, &ipipe_cpudom_var(ipd, status)); \ 184 __set_bit(IPIPE_SYNC_FLAG, &ipipe_cpudom_var(ipd, status)); \
185 } \ 185 } \
186 local_irq_disable_hw(); \ 186 hard_local_irq_disable(); \
187 } while (0) 187 } while (0)
188 188
189#define __ipipe_syscall_watched_p(p, sc) \ 189#define __ipipe_syscall_watched_p(p, sc) \
diff --git a/arch/blackfin/include/asm/irqflags.h b/arch/blackfin/include/asm/irqflags.h
index 813a1af3e865..41c4d70544ef 100644
--- a/arch/blackfin/include/asm/irqflags.h
+++ b/arch/blackfin/include/asm/irqflags.h
@@ -8,6 +8,8 @@
8#ifndef __ASM_BFIN_IRQFLAGS_H__ 8#ifndef __ASM_BFIN_IRQFLAGS_H__
9#define __ASM_BFIN_IRQFLAGS_H__ 9#define __ASM_BFIN_IRQFLAGS_H__
10 10
11#include <mach/blackfin.h>
12
11#ifdef CONFIG_SMP 13#ifdef CONFIG_SMP
12# include <asm/pda.h> 14# include <asm/pda.h>
13# include <asm/processor.h> 15# include <asm/processor.h>
@@ -31,54 +33,108 @@ static inline unsigned long bfin_cli(void)
31 return flags; 33 return flags;
32} 34}
33 35
34#ifdef CONFIG_IPIPE
35
36#include <linux/compiler.h>
37#include <linux/ipipe_base.h>
38#include <linux/ipipe_trace.h>
39
40#ifdef CONFIG_DEBUG_HWERR 36#ifdef CONFIG_DEBUG_HWERR
41# define bfin_no_irqs 0x3f 37# define bfin_no_irqs 0x3f
42#else 38#else
43# define bfin_no_irqs 0x1f 39# define bfin_no_irqs 0x1f
44#endif 40#endif
45 41
46#define raw_local_irq_disable() \ 42/*****************************************************************************/
47 do { \ 43/*
48 ipipe_check_context(ipipe_root_domain); \ 44 * Hard, untraced CPU interrupt flag manipulation and access.
49 __ipipe_stall_root(); \ 45 */
50 barrier(); \ 46static inline void __hard_local_irq_disable(void)
51 } while (0) 47{
48 bfin_cli();
49}
50
51static inline void __hard_local_irq_enable(void)
52{
53 bfin_sti(bfin_irq_flags);
54}
55
56static inline unsigned long hard_local_save_flags(void)
57{
58 return bfin_read_IMASK();
59}
52 60
53#define raw_local_irq_enable() \ 61static inline unsigned long __hard_local_irq_save(void)
54 do { \ 62{
55 barrier(); \ 63 unsigned long flags;
56 ipipe_check_context(ipipe_root_domain); \ 64 flags = bfin_cli();
57 __ipipe_unstall_root(); \ 65#ifdef CONFIG_DEBUG_HWERR
58 } while (0) 66 bfin_sti(0x3f);
67#endif
68 return flags;
69}
70
71static inline int hard_irqs_disabled_flags(unsigned long flags)
72{
73 return (flags & ~0x3f) == 0;
74}
75
76static inline int hard_irqs_disabled(void)
77{
78 unsigned long flags = hard_local_save_flags();
79 return hard_irqs_disabled_flags(flags);
80}
81
82static inline void __hard_local_irq_restore(unsigned long flags)
83{
84 if (!hard_irqs_disabled_flags(flags))
85 __hard_local_irq_enable();
86}
87
88/*****************************************************************************/
89/*
90 * Interrupt pipe handling.
91 */
92#ifdef CONFIG_IPIPE
93
94#include <linux/compiler.h>
95#include <linux/ipipe_base.h>
96#include <linux/ipipe_trace.h>
97
98/*
99 * Interrupt pipe interface to linux/irqflags.h.
100 */
101static inline void arch_local_irq_disable(void)
102{
103 ipipe_check_context(ipipe_root_domain);
104 __ipipe_stall_root();
105 barrier();
106}
59 107
60#define raw_local_save_flags_ptr(x) \ 108static inline void arch_local_irq_enable(void)
61 do { \ 109{
62 *(x) = __ipipe_test_root() ? bfin_no_irqs : bfin_irq_flags; \ 110 barrier();
63 } while (0) 111 ipipe_check_context(ipipe_root_domain);
112 __ipipe_unstall_root();
113}
64 114
65#define raw_local_save_flags(x) raw_local_save_flags_ptr(&(x)) 115static inline unsigned long arch_local_save_flags(void)
116{
117 return __ipipe_test_root() ? bfin_no_irqs : bfin_irq_flags;
118}
66 119
67#define raw_irqs_disabled_flags(x) ((x) == bfin_no_irqs) 120static inline int arch_irqs_disabled_flags(unsigned long flags)
121{
122 return flags == bfin_no_irqs;
123}
68 124
69#define raw_local_irq_save_ptr(x) \ 125static inline void arch_local_irq_save_ptr(unsigned long *_flags)
70 do { \ 126{
71 *(x) = __ipipe_test_and_stall_root() ? bfin_no_irqs : bfin_irq_flags; \ 127 x = __ipipe_test_and_stall_root() ? bfin_no_irqs : bfin_irq_flags;
72 barrier(); \ 128 barrier();
73 } while (0) 129}
74 130
75#define raw_local_irq_save(x) \ 131static inline unsigned long arch_local_irq_save(void)
76 do { \ 132{
77 ipipe_check_context(ipipe_root_domain); \ 133 ipipe_check_context(ipipe_root_domain);
78 raw_local_irq_save_ptr(&(x)); \ 134 return __hard_local_irq_save();
79 } while (0) 135}
80 136
81static inline unsigned long raw_mangle_irq_bits(int virt, unsigned long real) 137static inline unsigned long arch_mangle_irq_bits(int virt, unsigned long real)
82{ 138{
83 /* 139 /*
84 * Merge virtual and real interrupt mask bits into a single 140 * Merge virtual and real interrupt mask bits into a single
@@ -87,130 +143,79 @@ static inline unsigned long raw_mangle_irq_bits(int virt, unsigned long real)
87 return (real & ~(1 << 31)) | ((virt != 0) << 31); 143 return (real & ~(1 << 31)) | ((virt != 0) << 31);
88} 144}
89 145
90static inline int raw_demangle_irq_bits(unsigned long *x) 146static inline int arch_demangle_irq_bits(unsigned long *x)
91{ 147{
92 int virt = (*x & (1 << 31)) != 0; 148 int virt = (*x & (1 << 31)) != 0;
93 *x &= ~(1L << 31); 149 *x &= ~(1L << 31);
94 return virt; 150 return virt;
95} 151}
96 152
97static inline void local_irq_disable_hw_notrace(void) 153/*
154 * Interface to various arch routines that may be traced.
155 */
156#ifdef CONFIG_IPIPE_TRACE_IRQSOFF
157static inline void hard_local_irq_disable(void)
98{ 158{
99 bfin_cli(); 159 if (!hard_irqs_disabled()) {
160 __hard_local_irq_disable();
161 ipipe_trace_begin(0x80000000);
162 }
100} 163}
101 164
102static inline void local_irq_enable_hw_notrace(void) 165static inline void hard_local_irq_enable(void)
103{ 166{
104 bfin_sti(bfin_irq_flags); 167 if (hard_irqs_disabled()) {
168 ipipe_trace_end(0x80000000);
169 __hard_local_irq_enable();
170 }
105} 171}
106 172
107#define local_save_flags_hw(flags) \ 173static inline unsigned long hard_local_irq_save(void)
108 do { \
109 (flags) = bfin_read_IMASK(); \
110 } while (0)
111
112#define irqs_disabled_flags_hw(flags) (((flags) & ~0x3f) == 0)
113
114#define irqs_disabled_hw() \
115 ({ \
116 unsigned long flags; \
117 local_save_flags_hw(flags); \
118 irqs_disabled_flags_hw(flags); \
119 })
120
121static inline void local_irq_save_ptr_hw(unsigned long *flags)
122{ 174{
123 *flags = bfin_cli(); 175 unsigned long flags = hard_local_save_flags();
124#ifdef CONFIG_DEBUG_HWERR 176 if (!hard_irqs_disabled_flags(flags)) {
125 bfin_sti(0x3f); 177 __hard_local_irq_disable();
126#endif 178 ipipe_trace_begin(0x80000001);
179 }
180 return flags;
127} 181}
128 182
129#define local_irq_save_hw_notrace(flags) \ 183static inline void hard_local_irq_restore(unsigned long flags)
130 do { \
131 local_irq_save_ptr_hw(&(flags)); \
132 } while (0)
133
134static inline void local_irq_restore_hw_notrace(unsigned long flags)
135{ 184{
136 if (!irqs_disabled_flags_hw(flags)) 185 if (!hard_irqs_disabled_flags(flags)) {
137 local_irq_enable_hw_notrace(); 186 ipipe_trace_end(0x80000001);
187 __hard_local_irq_enable();
188 }
138} 189}
139 190
140#ifdef CONFIG_IPIPE_TRACE_IRQSOFF
141# define local_irq_disable_hw() \
142 do { \
143 if (!irqs_disabled_hw()) { \
144 local_irq_disable_hw_notrace(); \
145 ipipe_trace_begin(0x80000000); \
146 } \
147 } while (0)
148# define local_irq_enable_hw() \
149 do { \
150 if (irqs_disabled_hw()) { \
151 ipipe_trace_end(0x80000000); \
152 local_irq_enable_hw_notrace(); \
153 } \
154 } while (0)
155# define local_irq_save_hw(flags) \
156 do { \
157 local_save_flags_hw(flags); \
158 if (!irqs_disabled_flags_hw(flags)) { \
159 local_irq_disable_hw_notrace(); \
160 ipipe_trace_begin(0x80000001); \
161 } \
162 } while (0)
163# define local_irq_restore_hw(flags) \
164 do { \
165 if (!irqs_disabled_flags_hw(flags)) { \
166 ipipe_trace_end(0x80000001); \
167 local_irq_enable_hw_notrace(); \
168 } \
169 } while (0)
170#else /* !CONFIG_IPIPE_TRACE_IRQSOFF */ 191#else /* !CONFIG_IPIPE_TRACE_IRQSOFF */
171# define local_irq_disable_hw() local_irq_disable_hw_notrace() 192# define hard_local_irq_disable() __hard_local_irq_disable()
172# define local_irq_enable_hw() local_irq_enable_hw_notrace() 193# define hard_local_irq_enable() __hard_local_irq_enable()
173# define local_irq_save_hw(flags) local_irq_save_hw_notrace(flags) 194# define hard_local_irq_save() __hard_local_irq_save()
174# define local_irq_restore_hw(flags) local_irq_restore_hw_notrace(flags) 195# define hard_local_irq_restore(flags) __hard_local_irq_restore(flags)
175#endif /* !CONFIG_IPIPE_TRACE_IRQSOFF */ 196#endif /* !CONFIG_IPIPE_TRACE_IRQSOFF */
176 197
177#else /* CONFIG_IPIPE */ 198#else /* CONFIG_IPIPE */
178 199
179static inline void raw_local_irq_disable(void) 200/*
180{ 201 * Direct interface to linux/irqflags.h.
181 bfin_cli(); 202 */
182} 203#define arch_local_save_flags() hard_local_save_flags()
183static inline void raw_local_irq_enable(void) 204#define arch_local_irq_save(flags) __hard_local_irq_save()
184{ 205#define arch_local_irq_restore(flags) __hard_local_irq_restore(flags)
185 bfin_sti(bfin_irq_flags); 206#define arch_local_irq_enable() __hard_local_irq_enable()
186} 207#define arch_local_irq_disable() __hard_local_irq_disable()
187 208#define arch_irqs_disabled_flags(flags) hard_irqs_disabled_flags(flags)
188#define raw_local_save_flags(flags) do { (flags) = bfin_read_IMASK(); } while (0) 209#define arch_irqs_disabled() hard_irqs_disabled()
189
190#define raw_irqs_disabled_flags(flags) (((flags) & ~0x3f) == 0)
191 210
192static inline unsigned long __raw_local_irq_save(void) 211/*
193{ 212 * Interface to various arch routines that may be traced.
194 unsigned long flags = bfin_cli(); 213 */
195#ifdef CONFIG_DEBUG_HWERR 214#define hard_local_irq_save() __hard_local_irq_save()
196 bfin_sti(0x3f); 215#define hard_local_irq_restore(flags) __hard_local_irq_restore(flags)
197#endif 216#define hard_local_irq_enable() __hard_local_irq_enable()
198 return flags; 217#define hard_local_irq_disable() __hard_local_irq_disable()
199}
200#define raw_local_irq_save(flags) do { (flags) = __raw_local_irq_save(); } while (0)
201 218
202#define local_irq_save_hw(flags) raw_local_irq_save(flags)
203#define local_irq_restore_hw(flags) raw_local_irq_restore(flags)
204#define local_irq_enable_hw() raw_local_irq_enable()
205#define local_irq_disable_hw() raw_local_irq_disable()
206#define irqs_disabled_hw() irqs_disabled()
207 219
208#endif /* !CONFIG_IPIPE */ 220#endif /* !CONFIG_IPIPE */
209
210static inline void raw_local_irq_restore(unsigned long flags)
211{
212 if (!raw_irqs_disabled_flags(flags))
213 raw_local_irq_enable();
214}
215
216#endif 221#endif
diff --git a/arch/blackfin/include/asm/mmu_context.h b/arch/blackfin/include/asm/mmu_context.h
index e1a9b4624f91..3828c70e7a2e 100644
--- a/arch/blackfin/include/asm/mmu_context.h
+++ b/arch/blackfin/include/asm/mmu_context.h
@@ -97,8 +97,8 @@ static inline void __switch_mm(struct mm_struct *prev_mm, struct mm_struct *next
97} 97}
98 98
99#ifdef CONFIG_IPIPE 99#ifdef CONFIG_IPIPE
100#define lock_mm_switch(flags) local_irq_save_hw_cond(flags) 100#define lock_mm_switch(flags) flags = hard_local_irq_save_cond()
101#define unlock_mm_switch(flags) local_irq_restore_hw_cond(flags) 101#define unlock_mm_switch(flags) hard_local_irq_restore_cond(flags)
102#else 102#else
103#define lock_mm_switch(flags) do { (void)(flags); } while (0) 103#define lock_mm_switch(flags) do { (void)(flags); } while (0)
104#define unlock_mm_switch(flags) do { (void)(flags); } while (0) 104#define unlock_mm_switch(flags) do { (void)(flags); } while (0)
@@ -205,9 +205,9 @@ static inline void destroy_context(struct mm_struct *mm)
205} 205}
206 206
207#define ipipe_mm_switch_protect(flags) \ 207#define ipipe_mm_switch_protect(flags) \
208 local_irq_save_hw_cond(flags) 208 flags = hard_local_irq_save_cond()
209 209
210#define ipipe_mm_switch_unprotect(flags) \ 210#define ipipe_mm_switch_unprotect(flags) \
211 local_irq_restore_hw_cond(flags) 211 hard_local_irq_restore_cond(flags)
212 212
213#endif 213#endif
diff --git a/arch/blackfin/include/asm/system.h b/arch/blackfin/include/asm/system.h
index dde19b1d25f5..19e2c7c3e63a 100644
--- a/arch/blackfin/include/asm/system.h
+++ b/arch/blackfin/include/asm/system.h
@@ -117,7 +117,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
117 unsigned long tmp = 0; 117 unsigned long tmp = 0;
118 unsigned long flags; 118 unsigned long flags;
119 119
120 local_irq_save_hw(flags); 120 flags = hard_local_irq_save();
121 121
122 switch (size) { 122 switch (size) {
123 case 1: 123 case 1:
@@ -139,7 +139,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
139 : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory"); 139 : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory");
140 break; 140 break;
141 } 141 }
142 local_irq_restore_hw(flags); 142 hard_local_irq_restore(flags);
143 return tmp; 143 return tmp;
144} 144}
145 145