]> git.karo-electronics.de Git - karo-tx-linux.git/commit
MIPS: Handle initmem in systems with kernel not in add_memory_region() mem
authorDavid Daney <ddaney@caviumnetworks.com>
Wed, 16 Nov 2011 01:33:03 +0000 (01:33 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 16 Nov 2011 01:33:03 +0000 (01:33 +0000)
commit36a95452e20ff2bbc4527529562476b3f1d988ed
tree4f6fb7579de3ed40d11cdbad82fb84995f0fddbf
parent76aa4a949a9ea8c7d6a116f602d2e095cfabc833
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>
arch/mips/cavium-octeon/setup.c
arch/mips/include/asm/bootinfo.h
arch/mips/kernel/setup.c
arch/mips/mm/init.c