diff options
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/kernel/armksyms.c | 13 | ||||
-rw-r--r-- | arch/arm/kernel/asm-offsets.c | 3 | ||||
-rw-r--r-- | arch/arm/kernel/bios32.c | 6 | ||||
-rw-r--r-- | arch/arm/kernel/crunch-bits.S | 305 | ||||
-rw-r--r-- | arch/arm/kernel/crunch.c | 83 | ||||
-rw-r--r-- | arch/arm/kernel/entry-armv.S | 6 | ||||
-rw-r--r-- | arch/arm/kernel/ptrace.c | 36 | ||||
-rw-r--r-- | arch/arm/kernel/setup.c | 44 | ||||
-rw-r--r-- | arch/arm/kernel/signal.c | 39 | ||||
-rw-r--r-- | arch/arm/kernel/vmlinux.lds.S | 8 |
11 files changed, 531 insertions, 15 deletions
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index a601b8b55f35..7cffbaef064b 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile | |||
@@ -22,6 +22,9 @@ obj-$(CONFIG_PCI) += bios32.o | |||
22 | obj-$(CONFIG_SMP) += smp.o | 22 | obj-$(CONFIG_SMP) += smp.o |
23 | obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o | 23 | obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o |
24 | 24 | ||
25 | obj-$(CONFIG_CRUNCH) += crunch.o crunch-bits.o | ||
26 | AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312 | ||
27 | |||
25 | obj-$(CONFIG_IWMMXT) += iwmmxt.o | 28 | obj-$(CONFIG_IWMMXT) += iwmmxt.o |
26 | AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt | 29 | AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt |
27 | 30 | ||
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c index c49b5d4d7fca..da69e660574b 100644 --- a/arch/arm/kernel/armksyms.c +++ b/arch/arm/kernel/armksyms.c | |||
@@ -109,11 +109,13 @@ EXPORT_SYMBOL(memchr); | |||
109 | EXPORT_SYMBOL(__memzero); | 109 | EXPORT_SYMBOL(__memzero); |
110 | 110 | ||
111 | /* user mem (segment) */ | 111 | /* user mem (segment) */ |
112 | EXPORT_SYMBOL(__arch_copy_from_user); | 112 | EXPORT_SYMBOL(__strnlen_user); |
113 | EXPORT_SYMBOL(__arch_copy_to_user); | 113 | EXPORT_SYMBOL(__strncpy_from_user); |
114 | EXPORT_SYMBOL(__arch_clear_user); | 114 | |
115 | EXPORT_SYMBOL(__arch_strnlen_user); | 115 | #ifdef CONFIG_MMU |
116 | EXPORT_SYMBOL(__arch_strncpy_from_user); | 116 | EXPORT_SYMBOL(__copy_from_user); |
117 | EXPORT_SYMBOL(__copy_to_user); | ||
118 | EXPORT_SYMBOL(__clear_user); | ||
117 | 119 | ||
118 | EXPORT_SYMBOL(__get_user_1); | 120 | EXPORT_SYMBOL(__get_user_1); |
119 | EXPORT_SYMBOL(__get_user_2); | 121 | EXPORT_SYMBOL(__get_user_2); |
@@ -123,6 +125,7 @@ EXPORT_SYMBOL(__put_user_1); | |||
123 | EXPORT_SYMBOL(__put_user_2); | 125 | EXPORT_SYMBOL(__put_user_2); |
124 | EXPORT_SYMBOL(__put_user_4); | 126 | EXPORT_SYMBOL(__put_user_4); |
125 | EXPORT_SYMBOL(__put_user_8); | 127 | EXPORT_SYMBOL(__put_user_8); |
128 | #endif | ||
126 | 129 | ||
127 | /* crypto hash */ | 130 | /* crypto hash */ |
128 | EXPORT_SYMBOL(sha_transform); | 131 | EXPORT_SYMBOL(sha_transform); |
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c index 396efba9bacd..447ede5143a8 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c | |||
@@ -60,6 +60,9 @@ int main(void) | |||
60 | #ifdef CONFIG_IWMMXT | 60 | #ifdef CONFIG_IWMMXT |
61 | DEFINE(TI_IWMMXT_STATE, offsetof(struct thread_info, fpstate.iwmmxt)); | 61 | DEFINE(TI_IWMMXT_STATE, offsetof(struct thread_info, fpstate.iwmmxt)); |
62 | #endif | 62 | #endif |
63 | #ifdef CONFIG_CRUNCH | ||
64 | DEFINE(TI_CRUNCH_STATE, offsetof(struct thread_info, crunchstate)); | ||
65 | #endif | ||
63 | BLANK(); | 66 | BLANK(); |
64 | DEFINE(S_R0, offsetof(struct pt_regs, ARM_r0)); | 67 | DEFINE(S_R0, offsetof(struct pt_regs, ARM_r0)); |
65 | DEFINE(S_R1, offsetof(struct pt_regs, ARM_r1)); | 68 | DEFINE(S_R1, offsetof(struct pt_regs, ARM_r1)); |
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index 302fc1401547..45da06fc1ba1 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c | |||
@@ -304,7 +304,7 @@ static inline int pdev_bad_for_parity(struct pci_dev *dev) | |||
304 | static void __devinit | 304 | static void __devinit |
305 | pdev_fixup_device_resources(struct pci_sys_data *root, struct pci_dev *dev) | 305 | pdev_fixup_device_resources(struct pci_sys_data *root, struct pci_dev *dev) |
306 | { | 306 | { |
307 | unsigned long offset; | 307 | resource_size_t offset; |
308 | int i; | 308 | int i; |
309 | 309 | ||
310 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { | 310 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { |
@@ -634,9 +634,9 @@ char * __init pcibios_setup(char *str) | |||
634 | * which might be mirrored at 0x0100-0x03ff.. | 634 | * which might be mirrored at 0x0100-0x03ff.. |
635 | */ | 635 | */ |
636 | void pcibios_align_resource(void *data, struct resource *res, | 636 | void pcibios_align_resource(void *data, struct resource *res, |
637 | unsigned long size, unsigned long align) | 637 | resource_size_t size, resource_size_t align) |
638 | { | 638 | { |
639 | unsigned long start = res->start; | 639 | resource_size_t start = res->start; |
640 | 640 | ||
641 | if (res->flags & IORESOURCE_IO && start & 0x300) | 641 | if (res->flags & IORESOURCE_IO && start & 0x300) |
642 | start = (start + 0x3ff) & ~0x3ff; | 642 | start = (start + 0x3ff) & ~0x3ff; |
diff --git a/arch/arm/kernel/crunch-bits.S b/arch/arm/kernel/crunch-bits.S new file mode 100644 index 000000000000..a26886758c67 --- /dev/null +++ b/arch/arm/kernel/crunch-bits.S | |||
@@ -0,0 +1,305 @@ | |||
1 | /* | ||
2 | * arch/arm/kernel/crunch-bits.S | ||
3 | * Cirrus MaverickCrunch context switching and handling | ||
4 | * | ||
5 | * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | ||
6 | * | ||
7 | * Shamelessly stolen from the iWMMXt code by Nicolas Pitre, which is | ||
8 | * Copyright (c) 2003-2004, MontaVista Software, Inc. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include <linux/linkage.h> | ||
16 | #include <asm/ptrace.h> | ||
17 | #include <asm/thread_info.h> | ||
18 | #include <asm/asm-offsets.h> | ||
19 | #include <asm/arch/ep93xx-regs.h> | ||
20 | |||
21 | /* | ||
22 | * We can't use hex constants here due to a bug in gas. | ||
23 | */ | ||
24 | #define CRUNCH_MVDX0 0 | ||
25 | #define CRUNCH_MVDX1 8 | ||
26 | #define CRUNCH_MVDX2 16 | ||
27 | #define CRUNCH_MVDX3 24 | ||
28 | #define CRUNCH_MVDX4 32 | ||
29 | #define CRUNCH_MVDX5 40 | ||
30 | #define CRUNCH_MVDX6 48 | ||
31 | #define CRUNCH_MVDX7 56 | ||
32 | #define CRUNCH_MVDX8 64 | ||
33 | #define CRUNCH_MVDX9 72 | ||
34 | #define CRUNCH_MVDX10 80 | ||
35 | #define CRUNCH_MVDX11 88 | ||
36 | #define CRUNCH_MVDX12 96 | ||
37 | #define CRUNCH_MVDX13 104 | ||
38 | #define CRUNCH_MVDX14 112 | ||
39 | #define CRUNCH_MVDX15 120 | ||
40 | #define CRUNCH_MVAX0L 128 | ||
41 | #define CRUNCH_MVAX0M 132 | ||
42 | #define CRUNCH_MVAX0H 136 | ||
43 | #define CRUNCH_MVAX1L 140 | ||
44 | #define CRUNCH_MVAX1M 144 | ||
45 | #define CRUNCH_MVAX1H 148 | ||
46 | #define CRUNCH_MVAX2L 152 | ||
47 | #define CRUNCH_MVAX2M 156 | ||
48 | #define CRUNCH_MVAX2H 160 | ||
49 | #define CRUNCH_MVAX3L 164 | ||
50 | #define CRUNCH_MVAX3M 168 | ||
51 | #define CRUNCH_MVAX3H 172 | ||
52 | #define CRUNCH_DSPSC 176 | ||
53 | |||
54 | #define CRUNCH_SIZE 184 | ||
55 | |||
56 | .text | ||
57 | |||
58 | /* | ||
59 | * Lazy switching of crunch coprocessor context | ||
60 | * | ||
61 | * r10 = struct thread_info pointer | ||
62 | * r9 = ret_from_exception | ||
63 | * lr = undefined instr exit | ||
64 | * | ||
65 | * called from prefetch exception handler with interrupts disabled | ||
66 | */ | ||
67 | ENTRY(crunch_task_enable) | ||
68 | ldr r8, =(EP93XX_APB_VIRT_BASE + 0x00130000) @ syscon addr | ||
69 | |||
70 | ldr r1, [r8, #0x80] | ||
71 | tst r1, #0x00800000 @ access to crunch enabled? | ||
72 | movne pc, lr @ if so no business here | ||
73 | mov r3, #0xaa @ unlock syscon swlock | ||
74 | str r3, [r8, #0xc0] | ||
75 | orr r1, r1, #0x00800000 @ enable access to crunch | ||
76 | str r1, [r8, #0x80] | ||
77 | |||
78 | ldr r3, =crunch_owner | ||
79 | add r0, r10, #TI_CRUNCH_STATE @ get task crunch save area | ||
80 | ldr r2, [sp, #60] @ current task pc value | ||
81 | ldr r1, [r3] @ get current crunch owner | ||
82 | str r0, [r3] @ this task now owns crunch | ||
83 | sub r2, r2, #4 @ adjust pc back | ||
84 | str r2, [sp, #60] | ||
85 | |||
86 | ldr r2, [r8, #0x80] | ||
87 | mov r2, r2 @ flush out enable (@@@) | ||
88 | |||
89 | teq r1, #0 @ test for last ownership | ||
90 | mov lr, r9 @ normal exit from exception | ||
91 | beq crunch_load @ no owner, skip save | ||
92 | |||
93 | crunch_save: | ||
94 | cfstr64 mvdx0, [r1, #CRUNCH_MVDX0] @ save 64b registers | ||
95 | cfstr64 mvdx1, [r1, #CRUNCH_MVDX1] | ||
96 | cfstr64 mvdx2, [r1, #CRUNCH_MVDX2] | ||
97 | cfstr64 mvdx3, [r1, #CRUNCH_MVDX3] | ||
98 | cfstr64 mvdx4, [r1, #CRUNCH_MVDX4] | ||
99 | cfstr64 mvdx5, [r1, #CRUNCH_MVDX5] | ||
100 | cfstr64 mvdx6, [r1, #CRUNCH_MVDX6] | ||
101 | cfstr64 mvdx7, [r1, #CRUNCH_MVDX7] | ||
102 | cfstr64 mvdx8, [r1, #CRUNCH_MVDX8] | ||
103 | cfstr64 mvdx9, [r1, #CRUNCH_MVDX9] | ||
104 | cfstr64 mvdx10, [r1, #CRUNCH_MVDX10] | ||
105 | cfstr64 mvdx11, [r1, #CRUNCH_MVDX11] | ||
106 | cfstr64 mvdx12, [r1, #CRUNCH_MVDX12] | ||
107 | cfstr64 mvdx13, [r1, #CRUNCH_MVDX13] | ||
108 | cfstr64 mvdx14, [r1, #CRUNCH_MVDX14] | ||
109 | cfstr64 mvdx15, [r1, #CRUNCH_MVDX15] | ||
110 | |||
111 | #ifdef __ARMEB__ | ||
112 | #error fix me for ARMEB | ||
113 | #endif | ||
114 | |||
115 | cfmv32al mvfx0, mvax0 @ save 72b accumulators | ||
116 | cfstr32 mvfx0, [r1, #CRUNCH_MVAX0L] | ||
117 | cfmv32am mvfx0, mvax0 | ||
118 | cfstr32 mvfx0, [r1, #CRUNCH_MVAX0M] | ||
119 | cfmv32ah mvfx0, mvax0 | ||
120 | cfstr32 mvfx0, [r1, #CRUNCH_MVAX0H] | ||
121 | cfmv32al mvfx0, mvax1 | ||
122 | cfstr32 mvfx0, [r1, #CRUNCH_MVAX1L] | ||
123 | cfmv32am mvfx0, mvax1 | ||
124 | cfstr32 mvfx0, [r1, #CRUNCH_MVAX1M] | ||
125 | cfmv32ah mvfx0, mvax1 | ||
126 | cfstr32 mvfx0, [r1, #CRUNCH_MVAX1H] | ||
127 | cfmv32al mvfx0, mvax2 | ||
128 | cfstr32 mvfx0, [r1, #CRUNCH_MVAX2L] | ||
129 | cfmv32am mvfx0, mvax2 | ||
130 | cfstr32 mvfx0, [r1, #CRUNCH_MVAX2M] | ||
131 | cfmv32ah mvfx0, mvax2 | ||
132 | cfstr32 mvfx0, [r1, #CRUNCH_MVAX2H] | ||
133 | cfmv32al mvfx0, mvax3 | ||
134 | cfstr32 mvfx0, [r1, #CRUNCH_MVAX3L] | ||
135 | cfmv32am mvfx0, mvax3 | ||
136 | cfstr32 mvfx0, [r1, #CRUNCH_MVAX3M] | ||
137 | cfmv32ah mvfx0, mvax3 | ||
138 | cfstr32 mvfx0, [r1, #CRUNCH_MVAX3H] | ||
139 | |||
140 | cfmv32sc mvdx0, dspsc @ save status word | ||
141 | cfstr64 mvdx0, [r1, #CRUNCH_DSPSC] | ||
142 | |||
143 | teq r0, #0 @ anything to load? | ||
144 | cfldr64eq mvdx0, [r1, #CRUNCH_MVDX0] @ mvdx0 was clobbered | ||
145 | moveq pc, lr | ||
146 | |||
147 | crunch_load: | ||
148 | cfldr64 mvdx0, [r0, #CRUNCH_DSPSC] @ load status word | ||
149 | cfmvsc32 dspsc, mvdx0 | ||
150 | |||
151 | cfldr32 mvfx0, [r0, #CRUNCH_MVAX0L] @ load 72b accumulators | ||
152 | cfmval32 mvax0, mvfx0 | ||
153 | cfldr32 mvfx0, [r0, #CRUNCH_MVAX0M] | ||
154 | cfmvam32 mvax0, mvfx0 | ||
155 | cfldr32 mvfx0, [r0, #CRUNCH_MVAX0H] | ||
156 | cfmvah32 mvax0, mvfx0 | ||
157 | cfldr32 mvfx0, [r0, #CRUNCH_MVAX1L] | ||
158 | cfmval32 mvax1, mvfx0 | ||
159 | cfldr32 mvfx0, [r0, #CRUNCH_MVAX1M] | ||
160 | cfmvam32 mvax1, mvfx0 | ||
161 | cfldr32 mvfx0, [r0, #CRUNCH_MVAX1H] | ||
162 | cfmvah32 mvax1, mvfx0 | ||
163 | cfldr32 mvfx0, [r0, #CRUNCH_MVAX2L] | ||
164 | cfmval32 mvax2, mvfx0 | ||
165 | cfldr32 mvfx0, [r0, #CRUNCH_MVAX2M] | ||
166 | cfmvam32 mvax2, mvfx0 | ||
167 | cfldr32 mvfx0, [r0, #CRUNCH_MVAX2H] | ||
168 | cfmvah32 mvax2, mvfx0 | ||
169 | cfldr32 mvfx0, [r0, #CRUNCH_MVAX3L] | ||
170 | cfmval32 mvax3, mvfx0 | ||
171 | cfldr32 mvfx0, [r0, #CRUNCH_MVAX3M] | ||
172 | cfmvam32 mvax3, mvfx0 | ||
173 | cfldr32 mvfx0, [r0, #CRUNCH_MVAX3H] | ||
174 | cfmvah32 mvax3, mvfx0 | ||
175 | |||
176 | cfldr64 mvdx0, [r0, #CRUNCH_MVDX0] @ load 64b registers | ||
177 | cfldr64 mvdx1, [r0, #CRUNCH_MVDX1] | ||
178 | cfldr64 mvdx2, [r0, #CRUNCH_MVDX2] | ||
179 | cfldr64 mvdx3, [r0, #CRUNCH_MVDX3] | ||
180 | cfldr64 mvdx4, [r0, #CRUNCH_MVDX4] | ||
181 | cfldr64 mvdx5, [r0, #CRUNCH_MVDX5] | ||
182 | cfldr64 mvdx6, [r0, #CRUNCH_MVDX6] | ||
183 | cfldr64 mvdx7, [r0, #CRUNCH_MVDX7] | ||
184 | cfldr64 mvdx8, [r0, #CRUNCH_MVDX8] | ||
185 | cfldr64 mvdx9, [r0, #CRUNCH_MVDX9] | ||
186 | cfldr64 mvdx10, [r0, #CRUNCH_MVDX10] | ||
187 | cfldr64 mvdx11, [r0, #CRUNCH_MVDX11] | ||
188 | cfldr64 mvdx12, [r0, #CRUNCH_MVDX12] | ||
189 | cfldr64 mvdx13, [r0, #CRUNCH_MVDX13] | ||
190 | cfldr64 mvdx14, [r0, #CRUNCH_MVDX14] | ||
191 | cfldr64 mvdx15, [r0, #CRUNCH_MVDX15] | ||
192 | |||
193 | mov pc, lr | ||
194 | |||
195 | /* | ||
196 | * Back up crunch regs to save area and disable access to them | ||
197 | * (mainly for gdb or sleep mode usage) | ||
198 | * | ||
199 | * r0 = struct thread_info pointer of target task or NULL for any | ||
200 | */ | ||
201 | ENTRY(crunch_task_disable) | ||
202 | stmfd sp!, {r4, r5, lr} | ||
203 | |||
204 | mrs ip, cpsr | ||
205 | orr r2, ip, #PSR_I_BIT @ disable interrupts | ||
206 | msr cpsr_c, r2 | ||
207 | |||
208 | ldr r4, =(EP93XX_APB_VIRT_BASE + 0x00130000) @ syscon addr | ||
209 | |||
210 | ldr r3, =crunch_owner | ||
211 | add r2, r0, #TI_CRUNCH_STATE @ get task crunch save area | ||
212 | ldr r1, [r3] @ get current crunch owner | ||
213 | teq r1, #0 @ any current owner? | ||
214 | beq 1f @ no: quit | ||
215 | teq r0, #0 @ any owner? | ||
216 | teqne r1, r2 @ or specified one? | ||
217 | bne 1f @ no: quit | ||
218 | |||
219 | ldr r5, [r4, #0x80] @ enable access to crunch | ||
220 | mov r2, #0xaa | ||
221 | str r2, [r4, #0xc0] | ||
222 | orr r5, r5, #0x00800000 | ||
223 | str r5, [r4, #0x80] | ||
224 | |||
225 | mov r0, #0 @ nothing to load | ||
226 | str r0, [r3] @ no more current owner | ||
227 | ldr r2, [r4, #0x80] @ flush out enable (@@@) | ||
228 | mov r2, r2 | ||
229 | bl crunch_save | ||
230 | |||
231 | mov r2, #0xaa @ disable access to crunch | ||
232 | str r2, [r4, #0xc0] | ||
233 | bic r5, r5, #0x00800000 | ||
234 | str r5, [r4, #0x80] | ||
235 | ldr r5, [r4, #0x80] @ flush out enable (@@@) | ||
236 | mov r5, r5 | ||
237 | |||
238 | 1: msr cpsr_c, ip @ restore interrupt mode | ||
239 | ldmfd sp!, {r4, r5, pc} | ||
240 | |||
241 | /* | ||
242 | * Copy crunch state to given memory address | ||
243 | * | ||
244 | * r0 = struct thread_info pointer of target task | ||
245 | * r1 = memory address where to store crunch state | ||
246 | * | ||
247 | * this is called mainly in the creation of signal stack frames | ||
248 | */ | ||
249 | ENTRY(crunch_task_copy) | ||
250 | mrs ip, cpsr | ||
251 | orr r2, ip, #PSR_I_BIT @ disable interrupts | ||
252 | msr cpsr_c, r2 | ||
253 | |||
254 | ldr r3, =crunch_owner | ||
255 | add r2, r0, #TI_CRUNCH_STATE @ get task crunch save area | ||
256 | ldr r3, [r3] @ get current crunch owner | ||
257 | teq r2, r3 @ does this task own it... | ||
258 | beq 1f | ||
259 | |||
260 | @ current crunch values are in the task save area | ||
261 | msr cpsr_c, ip @ restore interrupt mode | ||
262 | mov r0, r1 | ||
263 | mov r1, r2 | ||
264 | mov r2, #CRUNCH_SIZE | ||
265 | b memcpy | ||
266 | |||
267 | 1: @ this task owns crunch regs -- grab a copy from there | ||
268 | mov r0, #0 @ nothing to load | ||
269 | mov r3, lr @ preserve return address | ||
270 | bl crunch_save | ||
271 | msr cpsr_c, ip @ restore interrupt mode | ||
272 | mov pc, r3 | ||
273 | |||
274 | /* | ||
275 | * Restore crunch state from given memory address | ||
276 | * | ||
277 | * r0 = struct thread_info pointer of target task | ||
278 | * r1 = memory address where to get crunch state from | ||
279 | * | ||
280 | * this is used to restore crunch state when unwinding a signal stack frame | ||
281 | */ | ||
282 | ENTRY(crunch_task_restore) | ||
283 | mrs ip, cpsr | ||
284 | orr r2, ip, #PSR_I_BIT @ disable interrupts | ||
285 | msr cpsr_c, r2 | ||
286 | |||
287 | ldr r3, =crunch_owner | ||
288 | add r2, r0, #TI_CRUNCH_STATE @ get task crunch save area | ||
289 | ldr r3, [r3] @ get current crunch owner | ||
290 | teq r2, r3 @ does this task own it... | ||
291 | beq 1f | ||
292 | |||
293 | @ this task doesn't own crunch regs -- use its save area | ||
294 | msr cpsr_c, ip @ restore interrupt mode | ||
295 | mov r0, r2 | ||
296 | mov r2, #CRUNCH_SIZE | ||
297 | b memcpy | ||
298 | |||
299 | 1: @ this task owns crunch regs -- load them directly | ||
300 | mov r0, r1 | ||
301 | mov r1, #0 @ nothing to save | ||
302 | mov r3, lr @ preserve return address | ||
303 | bl crunch_load | ||
304 | msr cpsr_c, ip @ restore interrupt mode | ||
305 | mov pc, r3 | ||
diff --git a/arch/arm/kernel/crunch.c b/arch/arm/kernel/crunch.c new file mode 100644 index 000000000000..748175921f9b --- /dev/null +++ b/arch/arm/kernel/crunch.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * arch/arm/kernel/crunch.c | ||
3 | * Cirrus MaverickCrunch context switching and handling | ||
4 | * | ||
5 | * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/config.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/signal.h> | ||
17 | #include <linux/sched.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <asm/arch/ep93xx-regs.h> | ||
20 | #include <asm/thread_notify.h> | ||
21 | #include <asm/io.h> | ||
22 | |||
23 | struct crunch_state *crunch_owner; | ||
24 | |||
25 | void crunch_task_release(struct thread_info *thread) | ||
26 | { | ||
27 | local_irq_disable(); | ||
28 | if (crunch_owner == &thread->crunchstate) | ||
29 | crunch_owner = NULL; | ||
30 | local_irq_enable(); | ||
31 | } | ||
32 | |||
33 | static int crunch_enabled(u32 devcfg) | ||
34 | { | ||
35 | return !!(devcfg & EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE); | ||
36 | } | ||
37 | |||
38 | static int crunch_do(struct notifier_block *self, unsigned long cmd, void *t) | ||
39 | { | ||
40 | struct thread_info *thread = (struct thread_info *)t; | ||
41 | struct crunch_state *crunch_state; | ||
42 | u32 devcfg; | ||
43 | |||
44 | crunch_state = &thread->crunchstate; | ||
45 | |||
46 | switch (cmd) { | ||
47 | case THREAD_NOTIFY_FLUSH: | ||
48 | memset(crunch_state, 0, sizeof(*crunch_state)); | ||
49 | |||
50 | /* | ||
51 | * FALLTHROUGH: Ensure we don't try to overwrite our newly | ||
52 | * initialised state information on the first fault. | ||
53 | */ | ||
54 | |||
55 | case THREAD_NOTIFY_RELEASE: | ||
56 | crunch_task_release(thread); | ||
57 | break; | ||
58 | |||
59 | case THREAD_NOTIFY_SWITCH: | ||
60 | devcfg = __raw_readl(EP93XX_SYSCON_DEVICE_CONFIG); | ||
61 | if (crunch_enabled(devcfg) || crunch_owner == crunch_state) { | ||
62 | devcfg ^= EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE; | ||
63 | __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK); | ||
64 | __raw_writel(devcfg, EP93XX_SYSCON_DEVICE_CONFIG); | ||
65 | } | ||
66 | break; | ||
67 | } | ||
68 | |||
69 | return NOTIFY_DONE; | ||
70 | } | ||
71 | |||
72 | static struct notifier_block crunch_notifier_block = { | ||
73 | .notifier_call = crunch_do, | ||
74 | }; | ||
75 | |||
76 | static int __init crunch_init(void) | ||
77 | { | ||
78 | thread_register_notifier(&crunch_notifier_block); | ||
79 | |||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | late_initcall(crunch_init); | ||
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 86c92523a346..6423a38839b8 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S | |||
@@ -492,9 +492,15 @@ call_fpe: | |||
492 | b do_fpe @ CP#1 (FPE) | 492 | b do_fpe @ CP#1 (FPE) |
493 | b do_fpe @ CP#2 (FPE) | 493 | b do_fpe @ CP#2 (FPE) |
494 | mov pc, lr @ CP#3 | 494 | mov pc, lr @ CP#3 |
495 | #ifdef CONFIG_CRUNCH | ||
496 | b crunch_task_enable @ CP#4 (MaverickCrunch) | ||
497 | b crunch_task_enable @ CP#5 (MaverickCrunch) | ||
498 | b crunch_task_enable @ CP#6 (MaverickCrunch) | ||
499 | #else | ||
495 | mov pc, lr @ CP#4 | 500 | mov pc, lr @ CP#4 |
496 | mov pc, lr @ CP#5 | 501 | mov pc, lr @ CP#5 |
497 | mov pc, lr @ CP#6 | 502 | mov pc, lr @ CP#6 |
503 | #endif | ||
498 | mov pc, lr @ CP#7 | 504 | mov pc, lr @ CP#7 |
499 | mov pc, lr @ CP#8 | 505 | mov pc, lr @ CP#8 |
500 | mov pc, lr @ CP#9 | 506 | mov pc, lr @ CP#9 |
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index a1d1b2906e8d..c40bdc770054 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
@@ -634,6 +634,32 @@ static int ptrace_setwmmxregs(struct task_struct *tsk, void __user *ufp) | |||
634 | 634 | ||
635 | #endif | 635 | #endif |
636 | 636 | ||
637 | #ifdef CONFIG_CRUNCH | ||
638 | /* | ||
639 | * Get the child Crunch state. | ||
640 | */ | ||
641 | static int ptrace_getcrunchregs(struct task_struct *tsk, void __user *ufp) | ||
642 | { | ||
643 | struct thread_info *thread = task_thread_info(tsk); | ||
644 | |||
645 | crunch_task_disable(thread); /* force it to ram */ | ||
646 | return copy_to_user(ufp, &thread->crunchstate, CRUNCH_SIZE) | ||
647 | ? -EFAULT : 0; | ||
648 | } | ||
649 | |||
650 | /* | ||
651 | * Set the child Crunch state. | ||
652 | */ | ||
653 | static int ptrace_setcrunchregs(struct task_struct *tsk, void __user *ufp) | ||
654 | { | ||
655 | struct thread_info *thread = task_thread_info(tsk); | ||
656 | |||
657 | crunch_task_release(thread); /* force a reload */ | ||
658 | return copy_from_user(&thread->crunchstate, ufp, CRUNCH_SIZE) | ||
659 | ? -EFAULT : 0; | ||
660 | } | ||
661 | #endif | ||
662 | |||
637 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) | 663 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
638 | { | 664 | { |
639 | unsigned long tmp; | 665 | unsigned long tmp; |
@@ -765,6 +791,16 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
765 | child->ptrace_message = data; | 791 | child->ptrace_message = data; |
766 | break; | 792 | break; |
767 | 793 | ||
794 | #ifdef CONFIG_CRUNCH | ||
795 | case PTRACE_GETCRUNCHREGS: | ||
796 | ret = ptrace_getcrunchregs(child, (void __user *)data); | ||
797 | break; | ||
798 | |||
799 | case PTRACE_SETCRUNCHREGS: | ||
800 | ret = ptrace_setcrunchregs(child, (void __user *)data); | ||
801 | break; | ||
802 | #endif | ||
803 | |||
768 | default: | 804 | default: |
769 | ret = ptrace_request(child, request, addr, data); | 805 | ret = ptrace_request(child, request, addr, data); |
770 | break; | 806 | break; |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 9fc9af88c60c..6bdf70def01f 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -119,9 +119,24 @@ DEFINE_PER_CPU(struct cpuinfo_arm, cpu_data); | |||
119 | * Standard memory resources | 119 | * Standard memory resources |
120 | */ | 120 | */ |
121 | static struct resource mem_res[] = { | 121 | static struct resource mem_res[] = { |
122 | { "Video RAM", 0, 0, IORESOURCE_MEM }, | 122 | { |
123 | { "Kernel text", 0, 0, IORESOURCE_MEM }, | 123 | .name = "Video RAM", |
124 | { "Kernel data", 0, 0, IORESOURCE_MEM } | 124 | .start = 0, |
125 | .end = 0, | ||
126 | .flags = IORESOURCE_MEM | ||
127 | }, | ||
128 | { | ||
129 | .name = "Kernel text", | ||
130 | .start = 0, | ||
131 | .end = 0, | ||
132 | .flags = IORESOURCE_MEM | ||
133 | }, | ||
134 | { | ||
135 | .name = "Kernel data", | ||
136 | .start = 0, | ||
137 | .end = 0, | ||
138 | .flags = IORESOURCE_MEM | ||
139 | } | ||
125 | }; | 140 | }; |
126 | 141 | ||
127 | #define video_ram mem_res[0] | 142 | #define video_ram mem_res[0] |
@@ -129,9 +144,24 @@ static struct resource mem_res[] = { | |||
129 | #define kernel_data mem_res[2] | 144 | #define kernel_data mem_res[2] |
130 | 145 | ||
131 | static struct resource io_res[] = { | 146 | static struct resource io_res[] = { |
132 | { "reserved", 0x3bc, 0x3be, IORESOURCE_IO | IORESOURCE_BUSY }, | 147 | { |
133 | { "reserved", 0x378, 0x37f, IORESOURCE_IO | IORESOURCE_BUSY }, | 148 | .name = "reserved", |
134 | { "reserved", 0x278, 0x27f, IORESOURCE_IO | IORESOURCE_BUSY } | 149 | .start = 0x3bc, |
150 | .end = 0x3be, | ||
151 | .flags = IORESOURCE_IO | IORESOURCE_BUSY | ||
152 | }, | ||
153 | { | ||
154 | .name = "reserved", | ||
155 | .start = 0x378, | ||
156 | .end = 0x37f, | ||
157 | .flags = IORESOURCE_IO | IORESOURCE_BUSY | ||
158 | }, | ||
159 | { | ||
160 | .name = "reserved", | ||
161 | .start = 0x278, | ||
162 | .end = 0x27f, | ||
163 | .flags = IORESOURCE_IO | IORESOURCE_BUSY | ||
164 | } | ||
135 | }; | 165 | }; |
136 | 166 | ||
137 | #define lp0 io_res[0] | 167 | #define lp0 io_res[0] |
@@ -808,7 +838,7 @@ static int __init topology_init(void) | |||
808 | int cpu; | 838 | int cpu; |
809 | 839 | ||
810 | for_each_possible_cpu(cpu) | 840 | for_each_possible_cpu(cpu) |
811 | register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu, NULL); | 841 | register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu); |
812 | 842 | ||
813 | return 0; | 843 | return 0; |
814 | } | 844 | } |
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 1ce05ec086c6..83a8d3c95eb3 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
@@ -132,6 +132,37 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, | |||
132 | return ret; | 132 | return ret; |
133 | } | 133 | } |
134 | 134 | ||
135 | #ifdef CONFIG_CRUNCH | ||
136 | static int preserve_crunch_context(struct crunch_sigframe *frame) | ||
137 | { | ||
138 | char kbuf[sizeof(*frame) + 8]; | ||
139 | struct crunch_sigframe *kframe; | ||
140 | |||
141 | /* the crunch context must be 64 bit aligned */ | ||
142 | kframe = (struct crunch_sigframe *)((unsigned long)(kbuf + 8) & ~7); | ||
143 | kframe->magic = CRUNCH_MAGIC; | ||
144 | kframe->size = CRUNCH_STORAGE_SIZE; | ||
145 | crunch_task_copy(current_thread_info(), &kframe->storage); | ||
146 | return __copy_to_user(frame, kframe, sizeof(*frame)); | ||
147 | } | ||
148 | |||
149 | static int restore_crunch_context(struct crunch_sigframe *frame) | ||
150 | { | ||
151 | char kbuf[sizeof(*frame) + 8]; | ||
152 | struct crunch_sigframe *kframe; | ||
153 | |||
154 | /* the crunch context must be 64 bit aligned */ | ||
155 | kframe = (struct crunch_sigframe *)((unsigned long)(kbuf + 8) & ~7); | ||
156 | if (__copy_from_user(kframe, frame, sizeof(*frame))) | ||
157 | return -1; | ||
158 | if (kframe->magic != CRUNCH_MAGIC || | ||
159 | kframe->size != CRUNCH_STORAGE_SIZE) | ||
160 | return -1; | ||
161 | crunch_task_restore(current_thread_info(), &kframe->storage); | ||
162 | return 0; | ||
163 | } | ||
164 | #endif | ||
165 | |||
135 | #ifdef CONFIG_IWMMXT | 166 | #ifdef CONFIG_IWMMXT |
136 | 167 | ||
137 | static int preserve_iwmmxt_context(struct iwmmxt_sigframe *frame) | 168 | static int preserve_iwmmxt_context(struct iwmmxt_sigframe *frame) |
@@ -214,6 +245,10 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf) | |||
214 | err |= !valid_user_regs(regs); | 245 | err |= !valid_user_regs(regs); |
215 | 246 | ||
216 | aux = (struct aux_sigframe __user *) sf->uc.uc_regspace; | 247 | aux = (struct aux_sigframe __user *) sf->uc.uc_regspace; |
248 | #ifdef CONFIG_CRUNCH | ||
249 | if (err == 0) | ||
250 | err |= restore_crunch_context(&aux->crunch); | ||
251 | #endif | ||
217 | #ifdef CONFIG_IWMMXT | 252 | #ifdef CONFIG_IWMMXT |
218 | if (err == 0 && test_thread_flag(TIF_USING_IWMMXT)) | 253 | if (err == 0 && test_thread_flag(TIF_USING_IWMMXT)) |
219 | err |= restore_iwmmxt_context(&aux->iwmmxt); | 254 | err |= restore_iwmmxt_context(&aux->iwmmxt); |
@@ -333,6 +368,10 @@ setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set) | |||
333 | err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set)); | 368 | err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set)); |
334 | 369 | ||
335 | aux = (struct aux_sigframe __user *) sf->uc.uc_regspace; | 370 | aux = (struct aux_sigframe __user *) sf->uc.uc_regspace; |
371 | #ifdef CONFIG_CRUNCH | ||
372 | if (err == 0) | ||
373 | err |= preserve_crunch_context(&aux->crunch); | ||
374 | #endif | ||
336 | #ifdef CONFIG_IWMMXT | 375 | #ifdef CONFIG_IWMMXT |
337 | if (err == 0 && test_thread_flag(TIF_USING_IWMMXT)) | 376 | if (err == 0 && test_thread_flag(TIF_USING_IWMMXT)) |
338 | err |= preserve_iwmmxt_context(&aux->iwmmxt); | 377 | err |= preserve_iwmmxt_context(&aux->iwmmxt); |
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 2b254e88595c..2df9688a7028 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S | |||
@@ -80,6 +80,10 @@ SECTIONS | |||
80 | *(.exit.text) | 80 | *(.exit.text) |
81 | *(.exit.data) | 81 | *(.exit.data) |
82 | *(.exitcall.exit) | 82 | *(.exitcall.exit) |
83 | #ifndef CONFIG_MMU | ||
84 | *(.fixup) | ||
85 | *(__ex_table) | ||
86 | #endif | ||
83 | } | 87 | } |
84 | 88 | ||
85 | .text : { /* Real text segment */ | 89 | .text : { /* Real text segment */ |
@@ -87,7 +91,9 @@ SECTIONS | |||
87 | *(.text) | 91 | *(.text) |
88 | SCHED_TEXT | 92 | SCHED_TEXT |
89 | LOCK_TEXT | 93 | LOCK_TEXT |
94 | #ifdef CONFIG_MMU | ||
90 | *(.fixup) | 95 | *(.fixup) |
96 | #endif | ||
91 | *(.gnu.warning) | 97 | *(.gnu.warning) |
92 | *(.rodata) | 98 | *(.rodata) |
93 | *(.rodata.*) | 99 | *(.rodata.*) |
@@ -142,7 +148,9 @@ SECTIONS | |||
142 | */ | 148 | */ |
143 | . = ALIGN(32); | 149 | . = ALIGN(32); |
144 | __start___ex_table = .; | 150 | __start___ex_table = .; |
151 | #ifdef CONFIG_MMU | ||
145 | *(__ex_table) | 152 | *(__ex_table) |
153 | #endif | ||
146 | __stop___ex_table = .; | 154 | __stop___ex_table = .; |
147 | 155 | ||
148 | /* | 156 | /* |