mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 12:58:12 -04:00
arm64: Honor limits set by boot parameter
Consider the memory limit enforced by boot parameter and restrict adding beyond this boundary during a memory hotplug. Change-Id: Ibd13e47ee13004381a1ddff649150fae13429c87 Signed-off-by: Vijayanand Jitta <vjitta@codeaurora.org> Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
parent
41dfbf027b
commit
cdab8bbfe2
1 changed files with 16 additions and 3 deletions
|
|
@ -274,7 +274,16 @@ static void __init update_memory_limit(void)
|
|||
phys_addr_t min_ddr_sz = 0, offline_sz = 0;
|
||||
int t_len = (2 * dt_root_size_cells) * sizeof(__be32);
|
||||
|
||||
ram_sz = memblock_phys_mem_size();
|
||||
if (memory_limit == PHYS_ADDR_MAX)
|
||||
ram_sz = memblock_phys_mem_size();
|
||||
else if (IS_ALIGNED(memory_limit, MIN_MEMORY_BLOCK_SIZE))
|
||||
ram_sz = memory_limit;
|
||||
else {
|
||||
WARN(1, "mem-offline is not supported for DDR size %lld\n",
|
||||
memory_limit);
|
||||
return;
|
||||
}
|
||||
|
||||
node = of_get_flat_dt_subnode_by_name(dt_root, "mem-offline");
|
||||
if (node == -FDT_ERR_NOTFOUND) {
|
||||
pr_err("mem-offine node not found in FDT\n");
|
||||
|
|
@ -434,12 +443,16 @@ void __init arm64_memblock_init(void)
|
|||
memblock_remove(0, memstart_addr);
|
||||
}
|
||||
|
||||
update_memory_limit();
|
||||
/*
|
||||
* Save bootloader imposed memory limit before we overwirte
|
||||
* memblock.
|
||||
*/
|
||||
bootloader_memory_limit = memblock_end_of_DRAM();
|
||||
if (memory_limit == PHYS_ADDR_MAX)
|
||||
bootloader_memory_limit = memblock_end_of_DRAM();
|
||||
else
|
||||
bootloader_memory_limit = memblock_max_addr(memory_limit);
|
||||
|
||||
update_memory_limit();
|
||||
|
||||
/*
|
||||
* Apply the memory limit if it was set. Since the kernel may be loaded
|
||||
|
|
|
|||
Loading…
Reference in a new issue