浏览代码

xtensa: nommu: reserve memory below PLATFORM_DEFAULT_MEM_START

Memory accounting code can't handle pages below
PLATFORM_DEFAULT_MEM_START. Reserve those pages if they exist.
When PLATFORM_DEFAULT_MEM_START is zero reserve one page at address 0 to
make sure that successfull memory allocations don't return NULL.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Max Filippov 11 年之前
父节点
当前提交
566fb58ed4
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      arch/xtensa/mm/init.c

+ 11 - 0
arch/xtensa/mm/init.c

@@ -239,6 +239,17 @@ void __init bootmem_init(void)
 	unsigned long bootmap_start, bootmap_size;
 	unsigned long bootmap_start, bootmap_size;
 	int i;
 	int i;
 
 
+	/* Reserve all memory below PLATFORM_DEFAULT_MEM_START, as memory
+	 * accounting doesn't work for pages below that address.
+	 *
+	 * If PLATFORM_DEFAULT_MEM_START is zero reserve page at address 0:
+	 * successfull allocations should never return NULL.
+	 */
+	if (PLATFORM_DEFAULT_MEM_START)
+		mem_reserve(0, PLATFORM_DEFAULT_MEM_START, 0);
+	else
+		mem_reserve(0, 1, 0);
+
 	sysmem_dump();
 	sysmem_dump();
 	max_low_pfn = max_pfn = 0;
 	max_low_pfn = max_pfn = 0;
 	min_low_pfn = ~0;
 	min_low_pfn = ~0;