aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/mmu.c
diff options
context:
space:
mode:
authorLaura Abbott <lauraa@codeaurora.org>2014-04-13 17:54:58 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-05-31 20:17:12 -0400
commit1c2f87c22566cd057bc8cde10c37ae9da1a1bb76 (patch)
tree6c135a3b2b6af6be3b6593ac6329d6d4f353b7dd /arch/arm/mm/mmu.c
parent1c8c3cf0b5239388e712508a85821f4718f4d889 (diff)
ARM: 8025/1: Get rid of meminfo
memblock is now fully integrated into the kernel and is the prefered method for tracking memory. Rather than reinvent the wheel with meminfo, migrate to using memblock directly instead of meminfo as an intermediate. Acked-by: Jason Cooper <jason@lakedaemon.net> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Acked-by: Kukjin Kim <kgene.kim@samsung.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Laura Abbott <lauraa@codeaurora.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/mmu.c')
-rw-r--r--arch/arm/mm/mmu.c117
1 files changed, 35 insertions, 82 deletions
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index a991ce2f18d4..82ea2b3fb9b5 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1062,74 +1062,47 @@ phys_addr_t arm_lowmem_limit __initdata = 0;
1062void __init sanity_check_meminfo(void) 1062void __init sanity_check_meminfo(void)
1063{ 1063{
1064 phys_addr_t memblock_limit = 0; 1064 phys_addr_t memblock_limit = 0;
1065 int i, j, highmem = 0; 1065 int highmem = 0;
1066 phys_addr_t vmalloc_limit = __pa(vmalloc_min - 1) + 1; 1066 phys_addr_t vmalloc_limit = __pa(vmalloc_min - 1) + 1;
1067 struct memblock_region *reg;
1067 1068
1068 for (i = 0, j = 0; i < meminfo.nr_banks; i++) { 1069 for_each_memblock(memory, reg) {
1069 struct membank *bank = &meminfo.bank[j]; 1070 phys_addr_t block_start = reg->base;
1070 phys_addr_t size_limit; 1071 phys_addr_t block_end = reg->base + reg->size;
1071 1072 phys_addr_t size_limit = reg->size;
1072 *bank = meminfo.bank[i];
1073 size_limit = bank->size;
1074 1073
1075 if (bank->start >= vmalloc_limit) 1074 if (reg->base >= vmalloc_limit)
1076 highmem = 1; 1075 highmem = 1;
1077 else 1076 else
1078 size_limit = vmalloc_limit - bank->start; 1077 size_limit = vmalloc_limit - reg->base;
1079 1078
1080 bank->highmem = highmem;
1081 1079
1082#ifdef CONFIG_HIGHMEM 1080 if (!IS_ENABLED(CONFIG_HIGHMEM) || cache_is_vipt_aliasing()) {
1083 /* 1081
1084 * Split those memory banks which are partially overlapping 1082 if (highmem) {
1085 * the vmalloc area greatly simplifying things later. 1083 pr_notice("Ignoring RAM at %pa-%pa (!CONFIG_HIGHMEM)\n",
1086 */ 1084 &block_start, &block_end);
1087 if (!highmem && bank->size > size_limit) { 1085 memblock_remove(reg->base, reg->size);
1088 if (meminfo.nr_banks >= NR_BANKS) { 1086 continue;
1089 printk(KERN_CRIT "NR_BANKS too low, "
1090 "ignoring high memory\n");
1091 } else {
1092 memmove(bank + 1, bank,
1093 (meminfo.nr_banks - i) * sizeof(*bank));
1094 meminfo.nr_banks++;
1095 i++;
1096 bank[1].size -= size_limit;
1097 bank[1].start = vmalloc_limit;
1098 bank[1].highmem = highmem = 1;
1099 j++;
1100 } 1087 }
1101 bank->size = size_limit;
1102 }
1103#else
1104 /*
1105 * Highmem banks not allowed with !CONFIG_HIGHMEM.
1106 */
1107 if (highmem) {
1108 printk(KERN_NOTICE "Ignoring RAM at %.8llx-%.8llx "
1109 "(!CONFIG_HIGHMEM).\n",
1110 (unsigned long long)bank->start,
1111 (unsigned long long)bank->start + bank->size - 1);
1112 continue;
1113 }
1114 1088
1115 /* 1089 if (reg->size > size_limit) {
1116 * Check whether this memory bank would partially overlap 1090 phys_addr_t overlap_size = reg->size - size_limit;
1117 * the vmalloc area. 1091
1118 */ 1092 pr_notice("Truncating RAM at %pa-%pa to -%pa",
1119 if (bank->size > size_limit) { 1093 &block_start, &block_end, &vmalloc_limit);
1120 printk(KERN_NOTICE "Truncating RAM at %.8llx-%.8llx " 1094 memblock_remove(vmalloc_limit, overlap_size);
1121 "to -%.8llx (vmalloc region overlap).\n", 1095 block_end = vmalloc_limit;
1122 (unsigned long long)bank->start, 1096 }
1123 (unsigned long long)bank->start + bank->size - 1,
1124 (unsigned long long)bank->start + size_limit - 1);
1125 bank->size = size_limit;
1126 } 1097 }
1127#endif
1128 if (!bank->highmem) {
1129 phys_addr_t bank_end = bank->start + bank->size;
1130 1098
1131 if (bank_end > arm_lowmem_limit) 1099 if (!highmem) {
1132 arm_lowmem_limit = bank_end; 1100 if (block_end > arm_lowmem_limit) {
1101 if (reg->size > size_limit)
1102 arm_lowmem_limit = vmalloc_limit;
1103 else
1104 arm_lowmem_limit = block_end;
1105 }
1133 1106
1134 /* 1107 /*
1135 * Find the first non-section-aligned page, and point 1108 * Find the first non-section-aligned page, and point
@@ -1145,35 +1118,15 @@ void __init sanity_check_meminfo(void)
1145 * occurs before any free memory is mapped. 1118 * occurs before any free memory is mapped.
1146 */ 1119 */
1147 if (!memblock_limit) { 1120 if (!memblock_limit) {
1148 if (!IS_ALIGNED(bank->start, SECTION_SIZE)) 1121 if (!IS_ALIGNED(block_start, SECTION_SIZE))
1149 memblock_limit = bank->start; 1122 memblock_limit = block_start;
1150 else if (!IS_ALIGNED(bank_end, SECTION_SIZE)) 1123 else if (!IS_ALIGNED(block_end, SECTION_SIZE))
1151 memblock_limit = bank_end; 1124 memblock_limit = arm_lowmem_limit;
1152 } 1125 }
1153 }
1154 j++;
1155 }
1156#ifdef CONFIG_HIGHMEM
1157 if (highmem) {
1158 const char *reason = NULL;
1159 1126
1160 if (cache_is_vipt_aliasing()) {
1161 /*
1162 * Interactions between kmap and other mappings
1163 * make highmem support with aliasing VIPT caches
1164 * rather difficult.
1165 */
1166 reason = "with VIPT aliasing cache";
1167 }
1168 if (reason) {
1169 printk(KERN_CRIT "HIGHMEM is not supported %s, ignoring high memory\n",
1170 reason);
1171 while (j > 0 && meminfo.bank[j - 1].highmem)
1172 j--;
1173 } 1127 }
1174 } 1128 }
1175#endif 1129
1176 meminfo.nr_banks = j;
1177 high_memory = __va(arm_lowmem_limit - 1) + 1; 1130 high_memory = __va(arm_lowmem_limit - 1) + 1;
1178 1131
1179 /* 1132 /*