diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-08-27 19:17:07 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-08-27 19:17:07 -0700 |
commit | b30a72a7edfc64c8929104d5c2178aca489aa559 (patch) | |
tree | 2b26c155c318d08d946bd2d70cf815dcdb29a243 /arch/arm/mm/mmu.c | |
parent | f1c5d30e1d79bbfb60eaf189db862d3cb2bcac92 (diff) | |
parent | c1b362e3b4d331a63915b268a33207311a439d60 (diff) | |
download | blackbird-op-linux-b30a72a7edfc64c8929104d5c2178aca489aa559.tar.gz blackbird-op-linux-b30a72a7edfc64c8929104d5c2178aca489aa559.zip |
Merge branch 'x86/urgent' into x86/cpu
Conflicts:
arch/x86/kernel/cpu/cyrix.c
Diffstat (limited to 'arch/arm/mm/mmu.c')
-rw-r--r-- | arch/arm/mm/mmu.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 2d6d682c206a..25d9a11eb617 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -568,6 +568,55 @@ void __init iotable_init(struct map_desc *io_desc, int nr) create_mapping(io_desc + i); } +static int __init check_membank_valid(struct membank *mb) +{ + /* + * Check whether this memory region has non-zero size. + */ + if (mb->size == 0) + return 0; + + /* + * Check whether this memory region would entirely overlap + * the vmalloc area. + */ + if (phys_to_virt(mb->start) >= VMALLOC_MIN) { + printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx " + "(vmalloc region overlap).\n", + mb->start, mb->start + mb->size - 1); + return 0; + } + + /* + * Check whether this memory region would partially overlap + * the vmalloc area. + */ + if (phys_to_virt(mb->start + mb->size) < phys_to_virt(mb->start) || + phys_to_virt(mb->start + mb->size) > VMALLOC_MIN) { + unsigned long newsize = VMALLOC_MIN - phys_to_virt(mb->start); + + printk(KERN_NOTICE "Truncating RAM at %.8lx-%.8lx " + "to -%.8lx (vmalloc region overlap).\n", + mb->start, mb->start + mb->size - 1, + mb->start + newsize - 1); + mb->size = newsize; + } + + return 1; +} + +static void __init sanity_check_meminfo(struct meminfo *mi) +{ + int i; + int j; + + for (i = 0, j = 0; i < mi->nr_banks; i++) { + if (check_membank_valid(&mi->bank[i])) + mi->bank[j++] = mi->bank[i]; + } + mi->nr_banks = j; +} + static inline void prepare_page_table(struct meminfo *mi) { unsigned long addr; @@ -753,6 +802,7 @@ void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc) void *zero_page; build_mem_type_table(); + sanity_check_meminfo(mi); prepare_page_table(mi); bootmem_init(mi); devicemaps_init(mdesc); |