diff options
author | Arnd Bergmann <arnd@arndb.de> | 2011-10-31 09:11:34 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2011-10-31 09:11:34 -0400 |
commit | 09fa31a322c8f03871a741cd1d26e5ca04aacbbd (patch) | |
tree | acdad13d7c332978a91231c4f34b6320a1c7ceb6 /arch/arm/mm | |
parent | 2b228e8cf33dbdd323dd4a05a973c6bd45c44133 (diff) | |
parent | f37a53cc5d8a8fb199e41386d125d8c2ed9e54ef (diff) |
Merge branch 'dt/gic' into highbank/soc
Conflicts:
arch/arm/Kconfig
Diffstat (limited to 'arch/arm/mm')
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 45 | ||||
-rw-r--r-- | arch/arm/mm/fault.c | 1 | ||||
-rw-r--r-- | arch/arm/mm/init.c | 9 | ||||
-rw-r--r-- | arch/arm/mm/mmu.c | 8 | ||||
-rw-r--r-- | arch/arm/mm/proc-arm920.S | 21 | ||||
-rw-r--r-- | arch/arm/mm/proc-arm926.S | 21 | ||||
-rw-r--r-- | arch/arm/mm/proc-sa1100.S | 25 | ||||
-rw-r--r-- | arch/arm/mm/proc-v6.S | 44 | ||||
-rw-r--r-- | arch/arm/mm/proc-v7.S | 50 | ||||
-rw-r--r-- | arch/arm/mm/proc-xsc3.S | 28 | ||||
-rw-r--r-- | arch/arm/mm/proc-xscale.S | 25 |
11 files changed, 131 insertions, 146 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index c3ff82f92d9c..01f5987eb1ad 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -18,12 +18,14 @@ | |||
18 | #include <linux/device.h> | 18 | #include <linux/device.h> |
19 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
20 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
21 | #include <linux/slab.h> | ||
21 | 22 | ||
22 | #include <asm/memory.h> | 23 | #include <asm/memory.h> |
23 | #include <asm/highmem.h> | 24 | #include <asm/highmem.h> |
24 | #include <asm/cacheflush.h> | 25 | #include <asm/cacheflush.h> |
25 | #include <asm/tlbflush.h> | 26 | #include <asm/tlbflush.h> |
26 | #include <asm/sizes.h> | 27 | #include <asm/sizes.h> |
28 | #include <asm/mach/arch.h> | ||
27 | 29 | ||
28 | #include "mm.h" | 30 | #include "mm.h" |
29 | 31 | ||
@@ -117,26 +119,37 @@ static void __dma_free_buffer(struct page *page, size_t size) | |||
117 | } | 119 | } |
118 | 120 | ||
119 | #ifdef CONFIG_MMU | 121 | #ifdef CONFIG_MMU |
120 | /* Sanity check size */ | ||
121 | #if (CONSISTENT_DMA_SIZE % SZ_2M) | ||
122 | #error "CONSISTENT_DMA_SIZE must be multiple of 2MiB" | ||
123 | #endif | ||
124 | 122 | ||
125 | #define CONSISTENT_OFFSET(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT) | 123 | |
126 | #define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PGDIR_SHIFT) | 124 | #define CONSISTENT_OFFSET(x) (((unsigned long)(x) - consistent_base) >> PAGE_SHIFT) |
127 | #define NUM_CONSISTENT_PTES (CONSISTENT_DMA_SIZE >> PGDIR_SHIFT) | 125 | #define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - consistent_base) >> PGDIR_SHIFT) |
128 | 126 | ||
129 | /* | 127 | /* |
130 | * These are the page tables (2MB each) covering uncached, DMA consistent allocations | 128 | * These are the page tables (2MB each) covering uncached, DMA consistent allocations |
131 | */ | 129 | */ |
132 | static pte_t *consistent_pte[NUM_CONSISTENT_PTES]; | 130 | static pte_t **consistent_pte; |
131 | |||
132 | #define DEFAULT_CONSISTENT_DMA_SIZE SZ_2M | ||
133 | |||
134 | unsigned long consistent_base = CONSISTENT_END - DEFAULT_CONSISTENT_DMA_SIZE; | ||
135 | |||
136 | void __init init_consistent_dma_size(unsigned long size) | ||
137 | { | ||
138 | unsigned long base = CONSISTENT_END - ALIGN(size, SZ_2M); | ||
139 | |||
140 | BUG_ON(consistent_pte); /* Check we're called before DMA region init */ | ||
141 | BUG_ON(base < VMALLOC_END); | ||
142 | |||
143 | /* Grow region to accommodate specified size */ | ||
144 | if (base < consistent_base) | ||
145 | consistent_base = base; | ||
146 | } | ||
133 | 147 | ||
134 | #include "vmregion.h" | 148 | #include "vmregion.h" |
135 | 149 | ||
136 | static struct arm_vmregion_head consistent_head = { | 150 | static struct arm_vmregion_head consistent_head = { |
137 | .vm_lock = __SPIN_LOCK_UNLOCKED(&consistent_head.vm_lock), | 151 | .vm_lock = __SPIN_LOCK_UNLOCKED(&consistent_head.vm_lock), |
138 | .vm_list = LIST_HEAD_INIT(consistent_head.vm_list), | 152 | .vm_list = LIST_HEAD_INIT(consistent_head.vm_list), |
139 | .vm_start = CONSISTENT_BASE, | ||
140 | .vm_end = CONSISTENT_END, | 153 | .vm_end = CONSISTENT_END, |
141 | }; | 154 | }; |
142 | 155 | ||
@@ -155,7 +168,17 @@ static int __init consistent_init(void) | |||
155 | pmd_t *pmd; | 168 | pmd_t *pmd; |
156 | pte_t *pte; | 169 | pte_t *pte; |
157 | int i = 0; | 170 | int i = 0; |
158 | u32 base = CONSISTENT_BASE; | 171 | unsigned long base = consistent_base; |
172 | unsigned long num_ptes = (CONSISTENT_END - base) >> PGDIR_SHIFT; | ||
173 | |||
174 | consistent_pte = kmalloc(num_ptes * sizeof(pte_t), GFP_KERNEL); | ||
175 | if (!consistent_pte) { | ||
176 | pr_err("%s: no memory\n", __func__); | ||
177 | return -ENOMEM; | ||
178 | } | ||
179 | |||
180 | pr_debug("DMA memory: 0x%08lx - 0x%08lx:\n", base, CONSISTENT_END); | ||
181 | consistent_head.vm_start = base; | ||
159 | 182 | ||
160 | do { | 183 | do { |
161 | pgd = pgd_offset(&init_mm, base); | 184 | pgd = pgd_offset(&init_mm, base); |
@@ -198,7 +221,7 @@ __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot) | |||
198 | size_t align; | 221 | size_t align; |
199 | int bit; | 222 | int bit; |
200 | 223 | ||
201 | if (!consistent_pte[0]) { | 224 | if (!consistent_pte) { |
202 | printk(KERN_ERR "%s: not initialised\n", __func__); | 225 | printk(KERN_ERR "%s: not initialised\n", __func__); |
203 | dump_stack(); | 226 | dump_stack(); |
204 | return NULL; | 227 | return NULL; |
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 3b5ea68acbb8..aa33949fef60 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
21 | #include <linux/perf_event.h> | 21 | #include <linux/perf_event.h> |
22 | 22 | ||
23 | #include <asm/exception.h> | ||
23 | #include <asm/system.h> | 24 | #include <asm/system.h> |
24 | #include <asm/pgtable.h> | 25 | #include <asm/pgtable.h> |
25 | #include <asm/tlbflush.h> | 26 | #include <asm/tlbflush.h> |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index cc7e2d8be9aa..34409a08ba0d 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -653,9 +653,6 @@ void __init mem_init(void) | |||
653 | " ITCM : 0x%08lx - 0x%08lx (%4ld kB)\n" | 653 | " ITCM : 0x%08lx - 0x%08lx (%4ld kB)\n" |
654 | #endif | 654 | #endif |
655 | " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" | 655 | " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" |
656 | #ifdef CONFIG_MMU | ||
657 | " DMA : 0x%08lx - 0x%08lx (%4ld MB)\n" | ||
658 | #endif | ||
659 | " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" | 656 | " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" |
660 | " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n" | 657 | " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n" |
661 | #ifdef CONFIG_HIGHMEM | 658 | #ifdef CONFIG_HIGHMEM |
@@ -674,9 +671,6 @@ void __init mem_init(void) | |||
674 | MLK(ITCM_OFFSET, (unsigned long) itcm_end), | 671 | MLK(ITCM_OFFSET, (unsigned long) itcm_end), |
675 | #endif | 672 | #endif |
676 | MLK(FIXADDR_START, FIXADDR_TOP), | 673 | MLK(FIXADDR_START, FIXADDR_TOP), |
677 | #ifdef CONFIG_MMU | ||
678 | MLM(CONSISTENT_BASE, CONSISTENT_END), | ||
679 | #endif | ||
680 | MLM(VMALLOC_START, VMALLOC_END), | 674 | MLM(VMALLOC_START, VMALLOC_END), |
681 | MLM(PAGE_OFFSET, (unsigned long)high_memory), | 675 | MLM(PAGE_OFFSET, (unsigned long)high_memory), |
682 | #ifdef CONFIG_HIGHMEM | 676 | #ifdef CONFIG_HIGHMEM |
@@ -699,9 +693,6 @@ void __init mem_init(void) | |||
699 | * be detected at build time already. | 693 | * be detected at build time already. |
700 | */ | 694 | */ |
701 | #ifdef CONFIG_MMU | 695 | #ifdef CONFIG_MMU |
702 | BUILD_BUG_ON(VMALLOC_END > CONSISTENT_BASE); | ||
703 | BUG_ON(VMALLOC_END > CONSISTENT_BASE); | ||
704 | |||
705 | BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR); | 696 | BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR); |
706 | BUG_ON(TASK_SIZE > MODULES_VADDR); | 697 | BUG_ON(TASK_SIZE > MODULES_VADDR); |
707 | #endif | 698 | #endif |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 594d677b92c8..ea9c9f3e48bf 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -273,6 +273,14 @@ static struct mem_type mem_types[] = { | |||
273 | .prot_l1 = PMD_TYPE_TABLE, | 273 | .prot_l1 = PMD_TYPE_TABLE, |
274 | .domain = DOMAIN_KERNEL, | 274 | .domain = DOMAIN_KERNEL, |
275 | }, | 275 | }, |
276 | [MT_MEMORY_SO] = { | ||
277 | .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | | ||
278 | L_PTE_MT_UNCACHED, | ||
279 | .prot_l1 = PMD_TYPE_TABLE, | ||
280 | .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_S | | ||
281 | PMD_SECT_UNCACHED | PMD_SECT_XN, | ||
282 | .domain = DOMAIN_KERNEL, | ||
283 | }, | ||
276 | }; | 284 | }; |
277 | 285 | ||
278 | const struct mem_type *get_mem_type(unsigned int type) | 286 | const struct mem_type *get_mem_type(unsigned int type) |
diff --git a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S index 2e6849b41f66..88fb3d9e0640 100644 --- a/arch/arm/mm/proc-arm920.S +++ b/arch/arm/mm/proc-arm920.S | |||
@@ -379,31 +379,26 @@ ENTRY(cpu_arm920_set_pte_ext) | |||
379 | 379 | ||
380 | /* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ | 380 | /* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ |
381 | .globl cpu_arm920_suspend_size | 381 | .globl cpu_arm920_suspend_size |
382 | .equ cpu_arm920_suspend_size, 4 * 4 | 382 | .equ cpu_arm920_suspend_size, 4 * 3 |
383 | #ifdef CONFIG_PM_SLEEP | 383 | #ifdef CONFIG_PM_SLEEP |
384 | ENTRY(cpu_arm920_do_suspend) | 384 | ENTRY(cpu_arm920_do_suspend) |
385 | stmfd sp!, {r4 - r7, lr} | 385 | stmfd sp!, {r4 - r6, lr} |
386 | mrc p15, 0, r4, c13, c0, 0 @ PID | 386 | mrc p15, 0, r4, c13, c0, 0 @ PID |
387 | mrc p15, 0, r5, c3, c0, 0 @ Domain ID | 387 | mrc p15, 0, r5, c3, c0, 0 @ Domain ID |
388 | mrc p15, 0, r6, c2, c0, 0 @ TTB address | 388 | mrc p15, 0, r6, c1, c0, 0 @ Control register |
389 | mrc p15, 0, r7, c1, c0, 0 @ Control register | 389 | stmia r0, {r4 - r6} |
390 | stmia r0, {r4 - r7} | 390 | ldmfd sp!, {r4 - r6, pc} |
391 | ldmfd sp!, {r4 - r7, pc} | ||
392 | ENDPROC(cpu_arm920_do_suspend) | 391 | ENDPROC(cpu_arm920_do_suspend) |
393 | 392 | ||
394 | ENTRY(cpu_arm920_do_resume) | 393 | ENTRY(cpu_arm920_do_resume) |
395 | mov ip, #0 | 394 | mov ip, #0 |
396 | mcr p15, 0, ip, c8, c7, 0 @ invalidate I+D TLBs | 395 | mcr p15, 0, ip, c8, c7, 0 @ invalidate I+D TLBs |
397 | mcr p15, 0, ip, c7, c7, 0 @ invalidate I+D caches | 396 | mcr p15, 0, ip, c7, c7, 0 @ invalidate I+D caches |
398 | ldmia r0, {r4 - r7} | 397 | ldmia r0, {r4 - r6} |
399 | mcr p15, 0, r4, c13, c0, 0 @ PID | 398 | mcr p15, 0, r4, c13, c0, 0 @ PID |
400 | mcr p15, 0, r5, c3, c0, 0 @ Domain ID | 399 | mcr p15, 0, r5, c3, c0, 0 @ Domain ID |
401 | mcr p15, 0, r6, c2, c0, 0 @ TTB address | 400 | mcr p15, 0, r1, c2, c0, 0 @ TTB address |
402 | mov r0, r7 @ control register | 401 | mov r0, r6 @ control register |
403 | mov r2, r6, lsr #14 @ get TTB0 base | ||
404 | mov r2, r2, lsl #14 | ||
405 | ldr r3, =PMD_TYPE_SECT | PMD_SECT_BUFFERABLE | \ | ||
406 | PMD_SECT_CACHEABLE | PMD_BIT4 | PMD_SECT_AP_WRITE | ||
407 | b cpu_resume_mmu | 402 | b cpu_resume_mmu |
408 | ENDPROC(cpu_arm920_do_resume) | 403 | ENDPROC(cpu_arm920_do_resume) |
409 | #endif | 404 | #endif |
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S index cd8f79c3a282..9f8fd91f918a 100644 --- a/arch/arm/mm/proc-arm926.S +++ b/arch/arm/mm/proc-arm926.S | |||
@@ -394,31 +394,26 @@ ENTRY(cpu_arm926_set_pte_ext) | |||
394 | 394 | ||
395 | /* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ | 395 | /* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ |
396 | .globl cpu_arm926_suspend_size | 396 | .globl cpu_arm926_suspend_size |
397 | .equ cpu_arm926_suspend_size, 4 * 4 | 397 | .equ cpu_arm926_suspend_size, 4 * 3 |
398 | #ifdef CONFIG_PM_SLEEP | 398 | #ifdef CONFIG_PM_SLEEP |
399 | ENTRY(cpu_arm926_do_suspend) | 399 | ENTRY(cpu_arm926_do_suspend) |
400 | stmfd sp!, {r4 - r7, lr} | 400 | stmfd sp!, {r4 - r6, lr} |
401 | mrc p15, 0, r4, c13, c0, 0 @ PID | 401 | mrc p15, 0, r4, c13, c0, 0 @ PID |
402 | mrc p15, 0, r5, c3, c0, 0 @ Domain ID | 402 | mrc p15, 0, r5, c3, c0, 0 @ Domain ID |
403 | mrc p15, 0, r6, c2, c0, 0 @ TTB address | 403 | mrc p15, 0, r6, c1, c0, 0 @ Control register |
404 | mrc p15, 0, r7, c1, c0, 0 @ Control register | 404 | stmia r0, {r4 - r6} |
405 | stmia r0, {r4 - r7} | 405 | ldmfd sp!, {r4 - r6, pc} |
406 | ldmfd sp!, {r4 - r7, pc} | ||
407 | ENDPROC(cpu_arm926_do_suspend) | 406 | ENDPROC(cpu_arm926_do_suspend) |
408 | 407 | ||
409 | ENTRY(cpu_arm926_do_resume) | 408 | ENTRY(cpu_arm926_do_resume) |
410 | mov ip, #0 | 409 | mov ip, #0 |
411 | mcr p15, 0, ip, c8, c7, 0 @ invalidate I+D TLBs | 410 | mcr p15, 0, ip, c8, c7, 0 @ invalidate I+D TLBs |
412 | mcr p15, 0, ip, c7, c7, 0 @ invalidate I+D caches | 411 | mcr p15, 0, ip, c7, c7, 0 @ invalidate I+D caches |
413 | ldmia r0, {r4 - r7} | 412 | ldmia r0, {r4 - r6} |
414 | mcr p15, 0, r4, c13, c0, 0 @ PID | 413 | mcr p15, 0, r4, c13, c0, 0 @ PID |
415 | mcr p15, 0, r5, c3, c0, 0 @ Domain ID | 414 | mcr p15, 0, r5, c3, c0, 0 @ Domain ID |
416 | mcr p15, 0, r6, c2, c0, 0 @ TTB address | 415 | mcr p15, 0, r1, c2, c0, 0 @ TTB address |
417 | mov r0, r7 @ control register | 416 | mov r0, r6 @ control register |
418 | mov r2, r6, lsr #14 @ get TTB0 base | ||
419 | mov r2, r2, lsl #14 | ||
420 | ldr r3, =PMD_TYPE_SECT | PMD_SECT_BUFFERABLE | \ | ||
421 | PMD_SECT_CACHEABLE | PMD_BIT4 | PMD_SECT_AP_WRITE | ||
422 | b cpu_resume_mmu | 417 | b cpu_resume_mmu |
423 | ENDPROC(cpu_arm926_do_resume) | 418 | ENDPROC(cpu_arm926_do_resume) |
424 | #endif | 419 | #endif |
diff --git a/arch/arm/mm/proc-sa1100.S b/arch/arm/mm/proc-sa1100.S index 69e7f2ef7384..7d91545d089b 100644 --- a/arch/arm/mm/proc-sa1100.S +++ b/arch/arm/mm/proc-sa1100.S | |||
@@ -168,20 +168,19 @@ ENTRY(cpu_sa1100_set_pte_ext) | |||
168 | mov pc, lr | 168 | mov pc, lr |
169 | 169 | ||
170 | .globl cpu_sa1100_suspend_size | 170 | .globl cpu_sa1100_suspend_size |
171 | .equ cpu_sa1100_suspend_size, 4*4 | 171 | .equ cpu_sa1100_suspend_size, 4 * 3 |
172 | #ifdef CONFIG_PM_SLEEP | 172 | #ifdef CONFIG_PM_SLEEP |
173 | ENTRY(cpu_sa1100_do_suspend) | 173 | ENTRY(cpu_sa1100_do_suspend) |
174 | stmfd sp!, {r4 - r7, lr} | 174 | stmfd sp!, {r4 - r6, lr} |
175 | mrc p15, 0, r4, c3, c0, 0 @ domain ID | 175 | mrc p15, 0, r4, c3, c0, 0 @ domain ID |
176 | mrc p15, 0, r5, c2, c0, 0 @ translation table base addr | 176 | mrc p15, 0, r5, c13, c0, 0 @ PID |
177 | mrc p15, 0, r6, c13, c0, 0 @ PID | 177 | mrc p15, 0, r6, c1, c0, 0 @ control reg |
178 | mrc p15, 0, r7, c1, c0, 0 @ control reg | 178 | stmia r0, {r4 - r6} @ store cp regs |
179 | stmia r0, {r4 - r7} @ store cp regs | 179 | ldmfd sp!, {r4 - r6, pc} |
180 | ldmfd sp!, {r4 - r7, pc} | ||
181 | ENDPROC(cpu_sa1100_do_suspend) | 180 | ENDPROC(cpu_sa1100_do_suspend) |
182 | 181 | ||
183 | ENTRY(cpu_sa1100_do_resume) | 182 | ENTRY(cpu_sa1100_do_resume) |
184 | ldmia r0, {r4 - r7} @ load cp regs | 183 | ldmia r0, {r4 - r6} @ load cp regs |
185 | mov ip, #0 | 184 | mov ip, #0 |
186 | mcr p15, 0, ip, c8, c7, 0 @ flush I+D TLBs | 185 | mcr p15, 0, ip, c8, c7, 0 @ flush I+D TLBs |
187 | mcr p15, 0, ip, c7, c7, 0 @ flush I&D cache | 186 | mcr p15, 0, ip, c7, c7, 0 @ flush I&D cache |
@@ -189,13 +188,9 @@ ENTRY(cpu_sa1100_do_resume) | |||
189 | mcr p15, 0, ip, c9, c0, 5 @ allow user space to use RB | 188 | mcr p15, 0, ip, c9, c0, 5 @ allow user space to use RB |
190 | 189 | ||
191 | mcr p15, 0, r4, c3, c0, 0 @ domain ID | 190 | mcr p15, 0, r4, c3, c0, 0 @ domain ID |
192 | mcr p15, 0, r5, c2, c0, 0 @ translation table base addr | 191 | mcr p15, 0, r1, c2, c0, 0 @ translation table base addr |
193 | mcr p15, 0, r6, c13, c0, 0 @ PID | 192 | mcr p15, 0, r5, c13, c0, 0 @ PID |
194 | mov r0, r7 @ control register | 193 | mov r0, r6 @ control register |
195 | mov r2, r5, lsr #14 @ get TTB0 base | ||
196 | mov r2, r2, lsl #14 | ||
197 | ldr r3, =PMD_TYPE_SECT | PMD_SECT_BUFFERABLE | \ | ||
198 | PMD_SECT_CACHEABLE | PMD_SECT_AP_WRITE | ||
199 | b cpu_resume_mmu | 194 | b cpu_resume_mmu |
200 | ENDPROC(cpu_sa1100_do_resume) | 195 | ENDPROC(cpu_sa1100_do_resume) |
201 | #endif | 196 | #endif |
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S index a923aa0fd00d..d061d2fa5506 100644 --- a/arch/arm/mm/proc-v6.S +++ b/arch/arm/mm/proc-v6.S | |||
@@ -128,20 +128,18 @@ ENTRY(cpu_v6_set_pte_ext) | |||
128 | 128 | ||
129 | /* Suspend/resume support: taken from arch/arm/mach-s3c64xx/sleep.S */ | 129 | /* Suspend/resume support: taken from arch/arm/mach-s3c64xx/sleep.S */ |
130 | .globl cpu_v6_suspend_size | 130 | .globl cpu_v6_suspend_size |
131 | .equ cpu_v6_suspend_size, 4 * 8 | 131 | .equ cpu_v6_suspend_size, 4 * 6 |
132 | #ifdef CONFIG_PM_SLEEP | 132 | #ifdef CONFIG_PM_SLEEP |
133 | ENTRY(cpu_v6_do_suspend) | 133 | ENTRY(cpu_v6_do_suspend) |
134 | stmfd sp!, {r4 - r11, lr} | 134 | stmfd sp!, {r4 - r9, lr} |
135 | mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID | 135 | mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID |
136 | mrc p15, 0, r5, c13, c0, 1 @ Context ID | 136 | mrc p15, 0, r5, c3, c0, 0 @ Domain ID |
137 | mrc p15, 0, r6, c3, c0, 0 @ Domain ID | 137 | mrc p15, 0, r6, c2, c0, 1 @ Translation table base 1 |
138 | mrc p15, 0, r7, c2, c0, 0 @ Translation table base 0 | 138 | mrc p15, 0, r7, c1, c0, 1 @ auxiliary control register |
139 | mrc p15, 0, r8, c2, c0, 1 @ Translation table base 1 | 139 | mrc p15, 0, r8, c1, c0, 2 @ co-processor access control |
140 | mrc p15, 0, r9, c1, c0, 1 @ auxiliary control register | 140 | mrc p15, 0, r9, c1, c0, 0 @ control register |
141 | mrc p15, 0, r10, c1, c0, 2 @ co-processor access control | 141 | stmia r0, {r4 - r9} |
142 | mrc p15, 0, r11, c1, c0, 0 @ control register | 142 | ldmfd sp!, {r4- r9, pc} |
143 | stmia r0, {r4 - r11} | ||
144 | ldmfd sp!, {r4- r11, pc} | ||
145 | ENDPROC(cpu_v6_do_suspend) | 143 | ENDPROC(cpu_v6_do_suspend) |
146 | 144 | ||
147 | ENTRY(cpu_v6_do_resume) | 145 | ENTRY(cpu_v6_do_resume) |
@@ -150,25 +148,21 @@ ENTRY(cpu_v6_do_resume) | |||
150 | mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache | 148 | mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache |
151 | mcr p15, 0, ip, c7, c15, 0 @ clean+invalidate cache | 149 | mcr p15, 0, ip, c7, c15, 0 @ clean+invalidate cache |
152 | mcr p15, 0, ip, c7, c10, 4 @ drain write buffer | 150 | mcr p15, 0, ip, c7, c10, 4 @ drain write buffer |
153 | ldmia r0, {r4 - r11} | 151 | mcr p15, 0, ip, c13, c0, 1 @ set reserved context ID |
152 | ldmia r0, {r4 - r9} | ||
154 | mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID | 153 | mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID |
155 | mcr p15, 0, r5, c13, c0, 1 @ Context ID | 154 | mcr p15, 0, r5, c3, c0, 0 @ Domain ID |
156 | mcr p15, 0, r6, c3, c0, 0 @ Domain ID | 155 | ALT_SMP(orr r1, r1, #TTB_FLAGS_SMP) |
157 | mcr p15, 0, r7, c2, c0, 0 @ Translation table base 0 | 156 | ALT_UP(orr r1, r1, #TTB_FLAGS_UP) |
158 | mcr p15, 0, r8, c2, c0, 1 @ Translation table base 1 | 157 | mcr p15, 0, r1, c2, c0, 0 @ Translation table base 0 |
159 | mcr p15, 0, r9, c1, c0, 1 @ auxiliary control register | 158 | mcr p15, 0, r6, c2, c0, 1 @ Translation table base 1 |
160 | mcr p15, 0, r10, c1, c0, 2 @ co-processor access control | 159 | mcr p15, 0, r7, c1, c0, 1 @ auxiliary control register |
160 | mcr p15, 0, r8, c1, c0, 2 @ co-processor access control | ||
161 | mcr p15, 0, ip, c2, c0, 2 @ TTB control register | 161 | mcr p15, 0, ip, c2, c0, 2 @ TTB control register |
162 | mcr p15, 0, ip, c7, c5, 4 @ ISB | 162 | mcr p15, 0, ip, c7, c5, 4 @ ISB |
163 | mov r0, r11 @ control register | 163 | mov r0, r9 @ control register |
164 | mov r2, r7, lsr #14 @ get TTB0 base | ||
165 | mov r2, r2, lsl #14 | ||
166 | ldr r3, cpu_resume_l1_flags | ||
167 | b cpu_resume_mmu | 164 | b cpu_resume_mmu |
168 | ENDPROC(cpu_v6_do_resume) | 165 | ENDPROC(cpu_v6_do_resume) |
169 | cpu_resume_l1_flags: | ||
170 | ALT_SMP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_FLAGS_SMP) | ||
171 | ALT_UP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_FLAGS_UP) | ||
172 | #endif | 166 | #endif |
173 | 167 | ||
174 | string cpu_v6_name, "ARMv6-compatible processor" | 168 | string cpu_v6_name, "ARMv6-compatible processor" |
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index 9049c0764db2..6af366ce0165 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
@@ -217,56 +217,50 @@ ENDPROC(cpu_v7_set_pte_ext) | |||
217 | 217 | ||
218 | /* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */ | 218 | /* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */ |
219 | .globl cpu_v7_suspend_size | 219 | .globl cpu_v7_suspend_size |
220 | .equ cpu_v7_suspend_size, 4 * 9 | 220 | .equ cpu_v7_suspend_size, 4 * 7 |
221 | #ifdef CONFIG_PM_SLEEP | 221 | #ifdef CONFIG_PM_SLEEP |
222 | ENTRY(cpu_v7_do_suspend) | 222 | ENTRY(cpu_v7_do_suspend) |
223 | stmfd sp!, {r4 - r11, lr} | 223 | stmfd sp!, {r4 - r10, lr} |
224 | mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID | 224 | mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID |
225 | mrc p15, 0, r5, c13, c0, 1 @ Context ID | 225 | mrc p15, 0, r5, c13, c0, 3 @ User r/o thread ID |
226 | mrc p15, 0, r6, c13, c0, 3 @ User r/o thread ID | 226 | stmia r0!, {r4 - r5} |
227 | stmia r0!, {r4 - r6} | ||
228 | mrc p15, 0, r6, c3, c0, 0 @ Domain ID | 227 | mrc p15, 0, r6, c3, c0, 0 @ Domain ID |
229 | mrc p15, 0, r7, c2, c0, 0 @ TTB 0 | 228 | mrc p15, 0, r7, c2, c0, 1 @ TTB 1 |
230 | mrc p15, 0, r8, c2, c0, 1 @ TTB 1 | 229 | mrc p15, 0, r8, c1, c0, 0 @ Control register |
231 | mrc p15, 0, r9, c1, c0, 0 @ Control register | 230 | mrc p15, 0, r9, c1, c0, 1 @ Auxiliary control register |
232 | mrc p15, 0, r10, c1, c0, 1 @ Auxiliary control register | 231 | mrc p15, 0, r10, c1, c0, 2 @ Co-processor access control |
233 | mrc p15, 0, r11, c1, c0, 2 @ Co-processor access control | 232 | stmia r0, {r6 - r10} |
234 | stmia r0, {r6 - r11} | 233 | ldmfd sp!, {r4 - r10, pc} |
235 | ldmfd sp!, {r4 - r11, pc} | ||
236 | ENDPROC(cpu_v7_do_suspend) | 234 | ENDPROC(cpu_v7_do_suspend) |
237 | 235 | ||
238 | ENTRY(cpu_v7_do_resume) | 236 | ENTRY(cpu_v7_do_resume) |
239 | mov ip, #0 | 237 | mov ip, #0 |
240 | mcr p15, 0, ip, c8, c7, 0 @ invalidate TLBs | 238 | mcr p15, 0, ip, c8, c7, 0 @ invalidate TLBs |
241 | mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache | 239 | mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache |
242 | ldmia r0!, {r4 - r6} | 240 | mcr p15, 0, ip, c13, c0, 1 @ set reserved context ID |
241 | ldmia r0!, {r4 - r5} | ||
243 | mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID | 242 | mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID |
244 | mcr p15, 0, r5, c13, c0, 1 @ Context ID | 243 | mcr p15, 0, r5, c13, c0, 3 @ User r/o thread ID |
245 | mcr p15, 0, r6, c13, c0, 3 @ User r/o thread ID | 244 | ldmia r0, {r6 - r10} |
246 | ldmia r0, {r6 - r11} | ||
247 | mcr p15, 0, r6, c3, c0, 0 @ Domain ID | 245 | mcr p15, 0, r6, c3, c0, 0 @ Domain ID |
248 | mcr p15, 0, r7, c2, c0, 0 @ TTB 0 | 246 | ALT_SMP(orr r1, r1, #TTB_FLAGS_SMP) |
249 | mcr p15, 0, r8, c2, c0, 1 @ TTB 1 | 247 | ALT_UP(orr r1, r1, #TTB_FLAGS_UP) |
248 | mcr p15, 0, r1, c2, c0, 0 @ TTB 0 | ||
249 | mcr p15, 0, r7, c2, c0, 1 @ TTB 1 | ||
250 | mcr p15, 0, ip, c2, c0, 2 @ TTB control register | 250 | mcr p15, 0, ip, c2, c0, 2 @ TTB control register |
251 | mrc p15, 0, r4, c1, c0, 1 @ Read Auxiliary control register | 251 | mrc p15, 0, r4, c1, c0, 1 @ Read Auxiliary control register |
252 | teq r4, r10 @ Is it already set? | 252 | teq r4, r9 @ Is it already set? |
253 | mcrne p15, 0, r10, c1, c0, 1 @ No, so write it | 253 | mcrne p15, 0, r9, c1, c0, 1 @ No, so write it |
254 | mcr p15, 0, r11, c1, c0, 2 @ Co-processor access control | 254 | mcr p15, 0, r10, c1, c0, 2 @ Co-processor access control |
255 | ldr r4, =PRRR @ PRRR | 255 | ldr r4, =PRRR @ PRRR |
256 | ldr r5, =NMRR @ NMRR | 256 | ldr r5, =NMRR @ NMRR |
257 | mcr p15, 0, r4, c10, c2, 0 @ write PRRR | 257 | mcr p15, 0, r4, c10, c2, 0 @ write PRRR |
258 | mcr p15, 0, r5, c10, c2, 1 @ write NMRR | 258 | mcr p15, 0, r5, c10, c2, 1 @ write NMRR |
259 | isb | 259 | isb |
260 | dsb | 260 | dsb |
261 | mov r0, r9 @ control register | 261 | mov r0, r8 @ control register |
262 | mov r2, r7, lsr #14 @ get TTB0 base | ||
263 | mov r2, r2, lsl #14 | ||
264 | ldr r3, cpu_resume_l1_flags | ||
265 | b cpu_resume_mmu | 262 | b cpu_resume_mmu |
266 | ENDPROC(cpu_v7_do_resume) | 263 | ENDPROC(cpu_v7_do_resume) |
267 | cpu_resume_l1_flags: | ||
268 | ALT_SMP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_FLAGS_SMP) | ||
269 | ALT_UP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_FLAGS_UP) | ||
270 | #endif | 264 | #endif |
271 | 265 | ||
272 | __CPUINIT | 266 | __CPUINIT |
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S index 755e1bf22681..abf0507a08ae 100644 --- a/arch/arm/mm/proc-xsc3.S +++ b/arch/arm/mm/proc-xsc3.S | |||
@@ -406,24 +406,23 @@ ENTRY(cpu_xsc3_set_pte_ext) | |||
406 | .align | 406 | .align |
407 | 407 | ||
408 | .globl cpu_xsc3_suspend_size | 408 | .globl cpu_xsc3_suspend_size |
409 | .equ cpu_xsc3_suspend_size, 4 * 7 | 409 | .equ cpu_xsc3_suspend_size, 4 * 6 |
410 | #ifdef CONFIG_PM_SLEEP | 410 | #ifdef CONFIG_PM_SLEEP |
411 | ENTRY(cpu_xsc3_do_suspend) | 411 | ENTRY(cpu_xsc3_do_suspend) |
412 | stmfd sp!, {r4 - r10, lr} | 412 | stmfd sp!, {r4 - r9, lr} |
413 | mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode | 413 | mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode |
414 | mrc p15, 0, r5, c15, c1, 0 @ CP access reg | 414 | mrc p15, 0, r5, c15, c1, 0 @ CP access reg |
415 | mrc p15, 0, r6, c13, c0, 0 @ PID | 415 | mrc p15, 0, r6, c13, c0, 0 @ PID |
416 | mrc p15, 0, r7, c3, c0, 0 @ domain ID | 416 | mrc p15, 0, r7, c3, c0, 0 @ domain ID |
417 | mrc p15, 0, r8, c2, c0, 0 @ translation table base addr | 417 | mrc p15, 0, r8, c1, c0, 1 @ auxiliary control reg |
418 | mrc p15, 0, r9, c1, c0, 1 @ auxiliary control reg | 418 | mrc p15, 0, r9, c1, c0, 0 @ control reg |
419 | mrc p15, 0, r10, c1, c0, 0 @ control reg | ||
420 | bic r4, r4, #2 @ clear frequency change bit | 419 | bic r4, r4, #2 @ clear frequency change bit |
421 | stmia r0, {r4 - r10} @ store cp regs | 420 | stmia r0, {r4 - r9} @ store cp regs |
422 | ldmia sp!, {r4 - r10, pc} | 421 | ldmia sp!, {r4 - r9, pc} |
423 | ENDPROC(cpu_xsc3_do_suspend) | 422 | ENDPROC(cpu_xsc3_do_suspend) |
424 | 423 | ||
425 | ENTRY(cpu_xsc3_do_resume) | 424 | ENTRY(cpu_xsc3_do_resume) |
426 | ldmia r0, {r4 - r10} @ load cp regs | 425 | ldmia r0, {r4 - r9} @ load cp regs |
427 | mov ip, #0 | 426 | mov ip, #0 |
428 | mcr p15, 0, ip, c7, c7, 0 @ invalidate I & D caches, BTB | 427 | mcr p15, 0, ip, c7, c7, 0 @ invalidate I & D caches, BTB |
429 | mcr p15, 0, ip, c7, c10, 4 @ drain write (&fill) buffer | 428 | mcr p15, 0, ip, c7, c10, 4 @ drain write (&fill) buffer |
@@ -433,15 +432,10 @@ ENTRY(cpu_xsc3_do_resume) | |||
433 | mcr p15, 0, r5, c15, c1, 0 @ CP access reg | 432 | mcr p15, 0, r5, c15, c1, 0 @ CP access reg |
434 | mcr p15, 0, r6, c13, c0, 0 @ PID | 433 | mcr p15, 0, r6, c13, c0, 0 @ PID |
435 | mcr p15, 0, r7, c3, c0, 0 @ domain ID | 434 | mcr p15, 0, r7, c3, c0, 0 @ domain ID |
436 | mcr p15, 0, r8, c2, c0, 0 @ translation table base addr | 435 | orr r1, r1, #0x18 @ cache the page table in L2 |
437 | mcr p15, 0, r9, c1, c0, 1 @ auxiliary control reg | 436 | mcr p15, 0, r1, c2, c0, 0 @ translation table base addr |
438 | 437 | mcr p15, 0, r8, c1, c0, 1 @ auxiliary control reg | |
439 | @ temporarily map resume_turn_on_mmu into the page table, | 438 | mov r0, r9 @ control register |
440 | @ otherwise prefetch abort occurs after MMU is turned on | ||
441 | mov r0, r10 @ control register | ||
442 | mov r2, r8, lsr #14 @ get TTB0 base | ||
443 | mov r2, r2, lsl #14 | ||
444 | ldr r3, =0x542e @ section flags | ||
445 | b cpu_resume_mmu | 439 | b cpu_resume_mmu |
446 | ENDPROC(cpu_xsc3_do_resume) | 440 | ENDPROC(cpu_xsc3_do_resume) |
447 | #endif | 441 | #endif |
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S index fbc06e55b87a..3277904bebaf 100644 --- a/arch/arm/mm/proc-xscale.S +++ b/arch/arm/mm/proc-xscale.S | |||
@@ -520,24 +520,23 @@ ENTRY(cpu_xscale_set_pte_ext) | |||
520 | .align | 520 | .align |
521 | 521 | ||
522 | .globl cpu_xscale_suspend_size | 522 | .globl cpu_xscale_suspend_size |
523 | .equ cpu_xscale_suspend_size, 4 * 7 | 523 | .equ cpu_xscale_suspend_size, 4 * 6 |
524 | #ifdef CONFIG_PM_SLEEP | 524 | #ifdef CONFIG_PM_SLEEP |
525 | ENTRY(cpu_xscale_do_suspend) | 525 | ENTRY(cpu_xscale_do_suspend) |
526 | stmfd sp!, {r4 - r10, lr} | 526 | stmfd sp!, {r4 - r9, lr} |
527 | mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode | 527 | mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode |
528 | mrc p15, 0, r5, c15, c1, 0 @ CP access reg | 528 | mrc p15, 0, r5, c15, c1, 0 @ CP access reg |
529 | mrc p15, 0, r6, c13, c0, 0 @ PID | 529 | mrc p15, 0, r6, c13, c0, 0 @ PID |
530 | mrc p15, 0, r7, c3, c0, 0 @ domain ID | 530 | mrc p15, 0, r7, c3, c0, 0 @ domain ID |
531 | mrc p15, 0, r8, c2, c0, 0 @ translation table base addr | 531 | mrc p15, 0, r8, c1, c1, 0 @ auxiliary control reg |
532 | mrc p15, 0, r9, c1, c1, 0 @ auxiliary control reg | 532 | mrc p15, 0, r9, c1, c0, 0 @ control reg |
533 | mrc p15, 0, r10, c1, c0, 0 @ control reg | ||
534 | bic r4, r4, #2 @ clear frequency change bit | 533 | bic r4, r4, #2 @ clear frequency change bit |
535 | stmia r0, {r4 - r10} @ store cp regs | 534 | stmia r0, {r4 - r9} @ store cp regs |
536 | ldmfd sp!, {r4 - r10, pc} | 535 | ldmfd sp!, {r4 - r9, pc} |
537 | ENDPROC(cpu_xscale_do_suspend) | 536 | ENDPROC(cpu_xscale_do_suspend) |
538 | 537 | ||
539 | ENTRY(cpu_xscale_do_resume) | 538 | ENTRY(cpu_xscale_do_resume) |
540 | ldmia r0, {r4 - r10} @ load cp regs | 539 | ldmia r0, {r4 - r9} @ load cp regs |
541 | mov ip, #0 | 540 | mov ip, #0 |
542 | mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs | 541 | mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs |
543 | mcr p15, 0, ip, c7, c7, 0 @ invalidate I & D caches, BTB | 542 | mcr p15, 0, ip, c7, c7, 0 @ invalidate I & D caches, BTB |
@@ -545,13 +544,9 @@ ENTRY(cpu_xscale_do_resume) | |||
545 | mcr p15, 0, r5, c15, c1, 0 @ CP access reg | 544 | mcr p15, 0, r5, c15, c1, 0 @ CP access reg |
546 | mcr p15, 0, r6, c13, c0, 0 @ PID | 545 | mcr p15, 0, r6, c13, c0, 0 @ PID |
547 | mcr p15, 0, r7, c3, c0, 0 @ domain ID | 546 | mcr p15, 0, r7, c3, c0, 0 @ domain ID |
548 | mcr p15, 0, r8, c2, c0, 0 @ translation table base addr | 547 | mcr p15, 0, r1, c2, c0, 0 @ translation table base addr |
549 | mcr p15, 0, r9, c1, c1, 0 @ auxiliary control reg | 548 | mcr p15, 0, r8, c1, c1, 0 @ auxiliary control reg |
550 | mov r0, r10 @ control register | 549 | mov r0, r9 @ control register |
551 | mov r2, r8, lsr #14 @ get TTB0 base | ||
552 | mov r2, r2, lsl #14 | ||
553 | ldr r3, =PMD_TYPE_SECT | PMD_SECT_BUFFERABLE | \ | ||
554 | PMD_SECT_CACHEABLE | PMD_SECT_AP_WRITE | ||
555 | b cpu_resume_mmu | 550 | b cpu_resume_mmu |
556 | ENDPROC(cpu_xscale_do_resume) | 551 | ENDPROC(cpu_xscale_do_resume) |
557 | #endif | 552 | #endif |