aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mm')
-rw-r--r--arch/arm/mm/blockops.c3
-rw-r--r--arch/arm/mm/fault.c75
-rw-r--r--arch/arm/mm/init.c73
-rw-r--r--arch/arm/mm/mm-armv.c89
-rw-r--r--arch/arm/mm/proc-arm1020.S4
-rw-r--r--arch/arm/mm/proc-arm1020e.S4
6 files changed, 120 insertions, 128 deletions
diff --git a/arch/arm/mm/blockops.c b/arch/arm/mm/blockops.c
index 806c6eeb1b0c..4f5ee2d08996 100644
--- a/arch/arm/mm/blockops.c
+++ b/arch/arm/mm/blockops.c
@@ -25,13 +25,14 @@ blk_flush_kern_dcache_page(void *kaddr)
25{ 25{
26 asm( 26 asm(
27 "add r1, r0, %0 \n\ 27 "add r1, r0, %0 \n\
28 sub r1, r1, %1 \n\
281: .word 0xec401f0e @ mcrr p15, 0, r0, r1, c14, 0 @ blocking \n\ 291: .word 0xec401f0e @ mcrr p15, 0, r0, r1, c14, 0 @ blocking \n\
29 mov r0, #0 \n\ 30 mov r0, #0 \n\
30 mcr p15, 0, r0, c7, c5, 0 \n\ 31 mcr p15, 0, r0, c7, c5, 0 \n\
31 mcr p15, 0, r0, c7, c10, 4 \n\ 32 mcr p15, 0, r0, c7, c10, 4 \n\
32 mov pc, lr" 33 mov pc, lr"
33 : 34 :
34 : "I" (PAGE_SIZE)); 35 : "I" (PAGE_SIZE), "I" (L1_CACHE_BYTES));
35} 36}
36 37
37/* 38/*
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index e25b4fd8412c..65bfe84b6d67 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -372,49 +372,50 @@ do_bad(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
372static struct fsr_info { 372static struct fsr_info {
373 int (*fn)(unsigned long addr, unsigned int fsr, struct pt_regs *regs); 373 int (*fn)(unsigned long addr, unsigned int fsr, struct pt_regs *regs);
374 int sig; 374 int sig;
375 int code;
375 const char *name; 376 const char *name;
376} fsr_info[] = { 377} fsr_info[] = {
377 /* 378 /*
378 * The following are the standard ARMv3 and ARMv4 aborts. ARMv5 379 * The following are the standard ARMv3 and ARMv4 aborts. ARMv5
379 * defines these to be "precise" aborts. 380 * defines these to be "precise" aborts.
380 */ 381 */
381 { do_bad, SIGSEGV, "vector exception" }, 382 { do_bad, SIGSEGV, 0, "vector exception" },
382 { do_bad, SIGILL, "alignment exception" }, 383 { do_bad, SIGILL, BUS_ADRALN, "alignment exception" },
383 { do_bad, SIGKILL, "terminal exception" }, 384 { do_bad, SIGKILL, 0, "terminal exception" },
384 { do_bad, SIGILL, "alignment exception" }, 385 { do_bad, SIGILL, BUS_ADRALN, "alignment exception" },
385 { do_bad, SIGBUS, "external abort on linefetch" }, 386 { do_bad, SIGBUS, 0, "external abort on linefetch" },
386 { do_translation_fault, SIGSEGV, "section translation fault" }, 387 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "section translation fault" },
387 { do_bad, SIGBUS, "external abort on linefetch" }, 388 { do_bad, SIGBUS, 0, "external abort on linefetch" },
388 { do_page_fault, SIGSEGV, "page translation fault" }, 389 { do_page_fault, SIGSEGV, SEGV_MAPERR, "page translation fault" },
389 { do_bad, SIGBUS, "external abort on non-linefetch" }, 390 { do_bad, SIGBUS, 0, "external abort on non-linefetch" },
390 { do_bad, SIGSEGV, "section domain fault" }, 391 { do_bad, SIGSEGV, SEGV_ACCERR, "section domain fault" },
391 { do_bad, SIGBUS, "external abort on non-linefetch" }, 392 { do_bad, SIGBUS, 0, "external abort on non-linefetch" },
392 { do_bad, SIGSEGV, "page domain fault" }, 393 { do_bad, SIGSEGV, SEGV_ACCERR, "page domain fault" },
393 { do_bad, SIGBUS, "external abort on translation" }, 394 { do_bad, SIGBUS, 0, "external abort on translation" },
394 { do_sect_fault, SIGSEGV, "section permission fault" }, 395 { do_sect_fault, SIGSEGV, SEGV_ACCERR, "section permission fault" },
395 { do_bad, SIGBUS, "external abort on translation" }, 396 { do_bad, SIGBUS, 0, "external abort on translation" },
396 { do_page_fault, SIGSEGV, "page permission fault" }, 397 { do_page_fault, SIGSEGV, SEGV_ACCERR, "page permission fault" },
397 /* 398 /*
398 * The following are "imprecise" aborts, which are signalled by bit 399 * The following are "imprecise" aborts, which are signalled by bit
399 * 10 of the FSR, and may not be recoverable. These are only 400 * 10 of the FSR, and may not be recoverable. These are only
400 * supported if the CPU abort handler supports bit 10. 401 * supported if the CPU abort handler supports bit 10.
401 */ 402 */
402 { do_bad, SIGBUS, "unknown 16" }, 403 { do_bad, SIGBUS, 0, "unknown 16" },
403 { do_bad, SIGBUS, "unknown 17" }, 404 { do_bad, SIGBUS, 0, "unknown 17" },
404 { do_bad, SIGBUS, "unknown 18" }, 405 { do_bad, SIGBUS, 0, "unknown 18" },
405 { do_bad, SIGBUS, "unknown 19" }, 406 { do_bad, SIGBUS, 0, "unknown 19" },
406 { do_bad, SIGBUS, "lock abort" }, /* xscale */ 407 { do_bad, SIGBUS, 0, "lock abort" }, /* xscale */
407 { do_bad, SIGBUS, "unknown 21" }, 408 { do_bad, SIGBUS, 0, "unknown 21" },
408 { do_bad, SIGBUS, "imprecise external abort" }, /* xscale */ 409 { do_bad, SIGBUS, BUS_OBJERR, "imprecise external abort" }, /* xscale */
409 { do_bad, SIGBUS, "unknown 23" }, 410 { do_bad, SIGBUS, 0, "unknown 23" },
410 { do_bad, SIGBUS, "dcache parity error" }, /* xscale */ 411 { do_bad, SIGBUS, 0, "dcache parity error" }, /* xscale */
411 { do_bad, SIGBUS, "unknown 25" }, 412 { do_bad, SIGBUS, 0, "unknown 25" },
412 { do_bad, SIGBUS, "unknown 26" }, 413 { do_bad, SIGBUS, 0, "unknown 26" },
413 { do_bad, SIGBUS, "unknown 27" }, 414 { do_bad, SIGBUS, 0, "unknown 27" },
414 { do_bad, SIGBUS, "unknown 28" }, 415 { do_bad, SIGBUS, 0, "unknown 28" },
415 { do_bad, SIGBUS, "unknown 29" }, 416 { do_bad, SIGBUS, 0, "unknown 29" },
416 { do_bad, SIGBUS, "unknown 30" }, 417 { do_bad, SIGBUS, 0, "unknown 30" },
417 { do_bad, SIGBUS, "unknown 31" } 418 { do_bad, SIGBUS, 0, "unknown 31" }
418}; 419};
419 420
420void __init 421void __init
@@ -435,15 +436,19 @@ asmlinkage void
435do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs) 436do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
436{ 437{
437 const struct fsr_info *inf = fsr_info + (fsr & 15) + ((fsr & (1 << 10)) >> 6); 438 const struct fsr_info *inf = fsr_info + (fsr & 15) + ((fsr & (1 << 10)) >> 6);
439 struct siginfo info;
438 440
439 if (!inf->fn(addr, fsr, regs)) 441 if (!inf->fn(addr, fsr, regs))
440 return; 442 return;
441 443
442 printk(KERN_ALERT "Unhandled fault: %s (0x%03x) at 0x%08lx\n", 444 printk(KERN_ALERT "Unhandled fault: %s (0x%03x) at 0x%08lx\n",
443 inf->name, fsr, addr); 445 inf->name, fsr, addr);
444 force_sig(inf->sig, current); 446
445 show_pte(current->mm, addr); 447 info.si_signo = inf->sig;
446 die_if_kernel("Oops", regs, 0); 448 info.si_errno = 0;
449 info.si_code = inf->code;
450 info.si_addr = (void __user *)addr;
451 notify_die("", regs, &info, fsr, 0);
447} 452}
448 453
449asmlinkage void 454asmlinkage void
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index c08710b1ff02..edffa47a4b2a 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -437,7 +437,7 @@ void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc)
437 memtable_init(mi); 437 memtable_init(mi);
438 if (mdesc->map_io) 438 if (mdesc->map_io)
439 mdesc->map_io(); 439 mdesc->map_io();
440 flush_tlb_all(); 440 local_flush_tlb_all();
441 441
442 /* 442 /*
443 * initialise the zones within each node 443 * initialise the zones within each node
@@ -522,6 +522,69 @@ static inline void free_area(unsigned long addr, unsigned long end, char *s)
522 printk(KERN_INFO "Freeing %s memory: %dK\n", s, size); 522 printk(KERN_INFO "Freeing %s memory: %dK\n", s, size);
523} 523}
524 524
525static inline void
526free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn)
527{
528 struct page *start_pg, *end_pg;
529 unsigned long pg, pgend;
530
531 /*
532 * Convert start_pfn/end_pfn to a struct page pointer.
533 */
534 start_pg = pfn_to_page(start_pfn);
535 end_pg = pfn_to_page(end_pfn);
536
537 /*
538 * Convert to physical addresses, and
539 * round start upwards and end downwards.
540 */
541 pg = PAGE_ALIGN(__pa(start_pg));
542 pgend = __pa(end_pg) & PAGE_MASK;
543
544 /*
545 * If there are free pages between these,
546 * free the section of the memmap array.
547 */
548 if (pg < pgend)
549 free_bootmem_node(NODE_DATA(node), pg, pgend - pg);
550}
551
552/*
553 * The mem_map array can get very big. Free the unused area of the memory map.
554 */
555static void __init free_unused_memmap_node(int node, struct meminfo *mi)
556{
557 unsigned long bank_start, prev_bank_end = 0;
558 unsigned int i;
559
560 /*
561 * [FIXME] This relies on each bank being in address order. This
562 * may not be the case, especially if the user has provided the
563 * information on the command line.
564 */
565 for (i = 0; i < mi->nr_banks; i++) {
566 if (mi->bank[i].size == 0 || mi->bank[i].node != node)
567 continue;
568
569 bank_start = mi->bank[i].start >> PAGE_SHIFT;
570 if (bank_start < prev_bank_end) {
571 printk(KERN_ERR "MEM: unordered memory banks. "
572 "Not freeing memmap.\n");
573 break;
574 }
575
576 /*
577 * If we had a previous bank, and there is a space
578 * between the current bank and the previous, free it.
579 */
580 if (prev_bank_end && prev_bank_end != bank_start)
581 free_memmap(node, prev_bank_end, bank_start);
582
583 prev_bank_end = (mi->bank[i].start +
584 mi->bank[i].size) >> PAGE_SHIFT;
585 }
586}
587
525/* 588/*
526 * mem_init() marks the free areas in the mem_map and tells us how much 589 * mem_init() marks the free areas in the mem_map and tells us how much
527 * memory is free. This is done after various parts of the system have 590 * memory is free. This is done after various parts of the system have
@@ -540,16 +603,12 @@ void __init mem_init(void)
540 max_mapnr = virt_to_page(high_memory) - mem_map; 603 max_mapnr = virt_to_page(high_memory) - mem_map;
541#endif 604#endif
542 605
543 /*
544 * We may have non-contiguous memory.
545 */
546 if (meminfo.nr_banks != 1)
547 create_memmap_holes(&meminfo);
548
549 /* this will put all unused low memory onto the freelists */ 606 /* this will put all unused low memory onto the freelists */
550 for_each_online_node(node) { 607 for_each_online_node(node) {
551 pg_data_t *pgdat = NODE_DATA(node); 608 pg_data_t *pgdat = NODE_DATA(node);
552 609
610 free_unused_memmap_node(node, &meminfo);
611
553 if (pgdat->node_spanned_pages != 0) 612 if (pgdat->node_spanned_pages != 0)
554 totalram_pages += free_all_bootmem_node(pgdat); 613 totalram_pages += free_all_bootmem_node(pgdat);
555 } 614 }
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
index 2c2b93d77d43..c3bd503b43a2 100644
--- a/arch/arm/mm/mm-armv.c
+++ b/arch/arm/mm/mm-armv.c
@@ -169,7 +169,14 @@ pgd_t *get_pgd_slow(struct mm_struct *mm)
169 169
170 memzero(new_pgd, FIRST_KERNEL_PGD_NR * sizeof(pgd_t)); 170 memzero(new_pgd, FIRST_KERNEL_PGD_NR * sizeof(pgd_t));
171 171
172 /*
173 * Copy over the kernel and IO PGD entries
174 */
172 init_pgd = pgd_offset_k(0); 175 init_pgd = pgd_offset_k(0);
176 memcpy(new_pgd + FIRST_KERNEL_PGD_NR, init_pgd + FIRST_KERNEL_PGD_NR,
177 (PTRS_PER_PGD - FIRST_KERNEL_PGD_NR) * sizeof(pgd_t));
178
179 clean_dcache_area(new_pgd, PTRS_PER_PGD * sizeof(pgd_t));
173 180
174 if (!vectors_high()) { 181 if (!vectors_high()) {
175 /* 182 /*
@@ -198,14 +205,6 @@ pgd_t *get_pgd_slow(struct mm_struct *mm)
198 spin_unlock(&mm->page_table_lock); 205 spin_unlock(&mm->page_table_lock);
199 } 206 }
200 207
201 /*
202 * Copy over the kernel and IO PGD entries
203 */
204 memcpy(new_pgd + FIRST_KERNEL_PGD_NR, init_pgd + FIRST_KERNEL_PGD_NR,
205 (PTRS_PER_PGD - FIRST_KERNEL_PGD_NR) * sizeof(pgd_t));
206
207 clean_dcache_area(new_pgd, PTRS_PER_PGD * sizeof(pgd_t));
208
209 return new_pgd; 208 return new_pgd;
210 209
211no_pte: 210no_pte:
@@ -683,7 +682,7 @@ void __init memtable_init(struct meminfo *mi)
683 } 682 }
684 683
685 flush_cache_all(); 684 flush_cache_all();
686 flush_tlb_all(); 685 local_flush_tlb_all();
687 686
688 top_pmd = pmd_off_k(0xffff0000); 687 top_pmd = pmd_off_k(0xffff0000);
689} 688}
@@ -698,75 +697,3 @@ void __init iotable_init(struct map_desc *io_desc, int nr)
698 for (i = 0; i < nr; i++) 697 for (i = 0; i < nr; i++)
699 create_mapping(io_desc + i); 698 create_mapping(io_desc + i);
700} 699}
701
702static inline void
703free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn)
704{
705 struct page *start_pg, *end_pg;
706 unsigned long pg, pgend;
707
708 /*
709 * Convert start_pfn/end_pfn to a struct page pointer.
710 */
711 start_pg = pfn_to_page(start_pfn);
712 end_pg = pfn_to_page(end_pfn);
713
714 /*
715 * Convert to physical addresses, and
716 * round start upwards and end downwards.
717 */
718 pg = PAGE_ALIGN(__pa(start_pg));
719 pgend = __pa(end_pg) & PAGE_MASK;
720
721 /*
722 * If there are free pages between these,
723 * free the section of the memmap array.
724 */
725 if (pg < pgend)
726 free_bootmem_node(NODE_DATA(node), pg, pgend - pg);
727}
728
729static inline void free_unused_memmap_node(int node, struct meminfo *mi)
730{
731 unsigned long bank_start, prev_bank_end = 0;
732 unsigned int i;
733
734 /*
735 * [FIXME] This relies on each bank being in address order. This
736 * may not be the case, especially if the user has provided the
737 * information on the command line.
738 */
739 for (i = 0; i < mi->nr_banks; i++) {
740 if (mi->bank[i].size == 0 || mi->bank[i].node != node)
741 continue;
742
743 bank_start = mi->bank[i].start >> PAGE_SHIFT;
744 if (bank_start < prev_bank_end) {
745 printk(KERN_ERR "MEM: unordered memory banks. "
746 "Not freeing memmap.\n");
747 break;
748 }
749
750 /*
751 * If we had a previous bank, and there is a space
752 * between the current bank and the previous, free it.
753 */
754 if (prev_bank_end && prev_bank_end != bank_start)
755 free_memmap(node, prev_bank_end, bank_start);
756
757 prev_bank_end = PAGE_ALIGN(mi->bank[i].start +
758 mi->bank[i].size) >> PAGE_SHIFT;
759 }
760}
761
762/*
763 * The mem_map array can get very big. Free
764 * the unused area of the memory map.
765 */
766void __init create_memmap_holes(struct meminfo *mi)
767{
768 int node;
769
770 for_each_online_node(node)
771 free_unused_memmap_node(node, mi);
772}
diff --git a/arch/arm/mm/proc-arm1020.S b/arch/arm/mm/proc-arm1020.S
index 1f325231b9e4..5c0ae5260d1c 100644
--- a/arch/arm/mm/proc-arm1020.S
+++ b/arch/arm/mm/proc-arm1020.S
@@ -445,14 +445,14 @@ __arm1020_setup:
445 /* 445 /*
446 * R 446 * R
447 * .RVI ZFRS BLDP WCAM 447 * .RVI ZFRS BLDP WCAM
448 * .0.1 1001 ..11 0101 /* FIXME: why no V bit? */ 448 * .011 1001 ..11 0101
449 */ 449 */
450 .type arm1020_cr1_clear, #object 450 .type arm1020_cr1_clear, #object
451 .type arm1020_cr1_set, #object 451 .type arm1020_cr1_set, #object
452arm1020_cr1_clear: 452arm1020_cr1_clear:
453 .word 0x593f 453 .word 0x593f
454arm1020_cr1_set: 454arm1020_cr1_set:
455 .word 0x1935 455 .word 0x3935
456 456
457 __INITDATA 457 __INITDATA
458 458
diff --git a/arch/arm/mm/proc-arm1020e.S b/arch/arm/mm/proc-arm1020e.S
index 142a2c2d6f0b..d69389c4d4ba 100644
--- a/arch/arm/mm/proc-arm1020e.S
+++ b/arch/arm/mm/proc-arm1020e.S
@@ -427,14 +427,14 @@ __arm1020e_setup:
427 /* 427 /*
428 * R 428 * R
429 * .RVI ZFRS BLDP WCAM 429 * .RVI ZFRS BLDP WCAM
430 * .0.1 1001 ..11 0101 /* FIXME: why no V bit? */ 430 * .011 1001 ..11 0101
431 */ 431 */
432 .type arm1020e_cr1_clear, #object 432 .type arm1020e_cr1_clear, #object
433 .type arm1020e_cr1_set, #object 433 .type arm1020e_cr1_set, #object
434arm1020e_cr1_clear: 434arm1020e_cr1_clear:
435 .word 0x5f3f 435 .word 0x5f3f
436arm1020e_cr1_set: 436arm1020e_cr1_set:
437 .word 0x1935 437 .word 0x3935
438 438
439 __INITDATA 439 __INITDATA
440 440