powerpc: Cleanup memblock usage
* early_init_devtree(): Total memory size is aligned to PAGE_SIZE; however, alignment isn't enforced if memory_limit is explicitly specified. Simplify the logic and always apply PAGE_SIZE alignment. * MMU_init(): memblock regions is truncated by directly modifying memblock.memory.cnt. This is incomplete (reserved array is not truncated) and unnecessarily low level hindering further memblock improvments. Use memblock_enforce_memory_limit() instead. * wii_memory_fixups(): Unnecessarily low level direct manipulation of memblock regions. The same result can be achieved using properly abstracted operations. Reimplement using memblock API. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Yinghai Lu <yinghai@kernel.org>
This commit is contained in:
@@ -754,17 +754,12 @@ void __init early_init_devtree(void *params)
|
||||
early_reserve_mem();
|
||||
phyp_dump_reserve_mem();
|
||||
|
||||
limit = memory_limit;
|
||||
if (! limit) {
|
||||
phys_addr_t memsize;
|
||||
|
||||
/* Ensure that total memory size is page-aligned, because
|
||||
* otherwise mark_bootmem() gets upset. */
|
||||
memblock_analyze();
|
||||
memsize = memblock_phys_mem_size();
|
||||
if ((memsize & PAGE_MASK) != memsize)
|
||||
limit = memsize & PAGE_MASK;
|
||||
}
|
||||
/*
|
||||
* Ensure that total memory size is page-aligned, because otherwise
|
||||
* mark_bootmem() gets upset.
|
||||
*/
|
||||
memblock_analyze();
|
||||
limit = ALIGN(memory_limit ?: memblock_phys_mem_size(), PAGE_SIZE);
|
||||
memblock_enforce_memory_limit(limit);
|
||||
|
||||
memblock_analyze();
|
||||
|
Reference in New Issue
Block a user