aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/cavium-octeon
diff options
context:
space:
mode:
authorDavid Daney <ddaney@caviumnetworks.com>2011-11-22 09:38:03 -0500
committerRalf Baechle <ralf@linux-mips.org>2011-12-07 17:03:45 -0500
commit43064c0c8ee2ada8edd421520c633584d648e100 (patch)
tree3621ac70a6d96a872942c205f03f9fda18826588 /arch/mips/cavium-octeon
parentb1c10bea620f79109b5cc9935267bea4f6f29ac6 (diff)
MIPS: Handle initmem in systems with kernel not in add_memory_region() mem
This patch addresses a couple of related problems: 1) The kernel may reside in physical memory outside of the ranges set by plat_mem_setup(). If this is the case, init mem cannot be reused as it resides outside of the range of pages that the kernel memory allocators control. 2) initrd images might be loaded in physical memory outside of the ranges set by plat_mem_setup(). The memory likewise cannot be reused. The patch doesn't handle this specific case, but the infrastructure is useful for future patches that do. The crux of the problem is that there are memory regions that need be memory_present(), but that cannot be free_bootmem() at the time of arch_mem_init(). We create a new type of memory (BOOT_MEM_INIT_RAM) for use with add_memory_region(). Then arch_mem_init() adds the init mem with this type if the init mem is not already covered by existing ranges. When memory is being freed into the bootmem allocator, we skip the BOOT_MEM_INIT_RAM ranges so they are not clobbered, but we do signal them as memory_present(). This way when they are later freed, the necessary memory manager structures have initialized and the Sparse allocater is prevented from crashing. The Octeon specific code that handled this case is removed, because the new general purpose code handles the case. Signed-off-by: David Daney <ddaney@caviumnetworks.com> To: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/1988/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/cavium-octeon')
-rw-r--r--arch/mips/cavium-octeon/setup.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 2d9028f1474c..b394552e5ca0 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -642,14 +642,6 @@ void __init plat_mem_setup(void)
642 642
643 total = 0; 643 total = 0;
644 644
645 /* First add the init memory we will be returning. */
646 memory = __pa_symbol(&__init_begin) & PAGE_MASK;
647 mem_alloc_size = (__pa_symbol(&__init_end) & PAGE_MASK) - memory;
648 if (mem_alloc_size > 0) {
649 add_memory_region(memory, mem_alloc_size, BOOT_MEM_RAM);
650 total += mem_alloc_size;
651 }
652
653 /* 645 /*
654 * The Mips memory init uses the first memory location for 646 * The Mips memory init uses the first memory location for
655 * some memory vectors. When SPARSEMEM is in use, it doesn't 647 * some memory vectors. When SPARSEMEM is in use, it doesn't