Commit b1c231f5a57cb4a417c38a8a946f1e66db3bb9c0
Committed by
Ralf Baechle
1 parent
ecf52d3c89
Exists in
master
and in
39 other branches
[MIPS] Fix sparsemem support.
Move memory_present() in arch/mips/kernel/setup.c. When using sparsemem extreme, this function does an allocate for bootmem. This would always fail since init_bootmem hasn't been called yet. Move memory_present after free_bootmem. This only marks actual memory ranges as present instead of the entire address space. Signed-off-by: Chad Reese <creese@caviumnetworks.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Showing 4 changed files with 18 additions and 3 deletions Side-by-side Diff
arch/mips/kernel/setup.c
... | ... | @@ -355,8 +355,6 @@ |
355 | 355 | } |
356 | 356 | #endif |
357 | 357 | |
358 | - memory_present(0, first_usable_pfn, max_low_pfn); | |
359 | - | |
360 | 358 | /* Initialize the boot-time allocator with low memory only. */ |
361 | 359 | bootmap_size = init_bootmem(first_usable_pfn, max_low_pfn); |
362 | 360 | |
... | ... | @@ -410,6 +408,7 @@ |
410 | 408 | |
411 | 409 | /* Register lowmem ranges */ |
412 | 410 | free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size)); |
411 | + memory_present(0, curr_pfn, curr_pfn + size - 1); | |
413 | 412 | } |
414 | 413 | |
415 | 414 | /* Reserve the bootmap memory. */ |
arch/mips/mm/init.c
include/asm-mips/page.h
... | ... | @@ -139,8 +139,10 @@ |
139 | 139 | |
140 | 140 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) |
141 | 141 | |
142 | +#ifndef CONFIG_SPARSEMEM | |
142 | 143 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
143 | 144 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
145 | +#endif | |
144 | 146 | #endif |
145 | 147 | |
146 | 148 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
include/asm-mips/sparsemem.h
1 | +#ifndef _MIPS_SPARSEMEM_H | |
2 | +#define _MIPS_SPARSEMEM_H | |
3 | +#ifdef CONFIG_SPARSEMEM | |
4 | + | |
5 | +/* | |
6 | + * SECTION_SIZE_BITS 2^N: how big each section will be | |
7 | + * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space | |
8 | + */ | |
9 | +#define SECTION_SIZE_BITS 28 | |
10 | +#define MAX_PHYSMEM_BITS 35 | |
11 | + | |
12 | +#endif /* CONFIG_SPARSEMEM */ | |
13 | +#endif /* _MIPS_SPARSEMEM_H */ |