Loading arch/arm64/Kconfig +0 −1 Original line number Diff line number Diff line Loading @@ -266,7 +266,6 @@ config HOTPLUG_SIZE_BITS int "Memory hotplug block size(29 => 512MB 30 => 1GB)" depends on SPARSEMEM depends on MEMORY_HOTPLUG depends on QCOM_MEM_OFFLINE default 30 help Selects granularity of hotplug memory. Block Loading arch/arm64/mm/init.c +16 −4 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ #include <linux/crash_dump.h> #include <linux/memory.h> #include <linux/libfdt.h> #include <linux/memblock.h> #include <asm/boot.h> #include <asm/fixmap.h> Loading Loading @@ -326,9 +327,10 @@ static void __init update_memory_limit(void) unsigned long node, mp; const char *p; unsigned long long ram_sz, sz; phys_addr_t end_addr, addr_aligned, offset; int ret; ram_sz = memblock_end_of_DRAM() - memblock_start_of_DRAM(); ram_sz = memblock_phys_mem_size(); 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"); Loading @@ -352,7 +354,17 @@ static void __init update_memory_limit(void) } sz = ram_sz - ((ram_sz * mp) / 100); memory_limit = (phys_addr_t)sz; memory_limit = ALIGN(memory_limit, MIN_MEMORY_BLOCK_SIZE); end_addr = memblock_max_addr(memory_limit); addr_aligned = ALIGN(end_addr, MIN_MEMORY_BLOCK_SIZE); offset = addr_aligned - end_addr; if (offset > MIN_MEMORY_BLOCK_SIZE / 2) { addr_aligned = ALIGN_DOWN(end_addr, MIN_MEMORY_BLOCK_SIZE); offset = end_addr - addr_aligned; memory_limit -= offset; } else { memory_limit += offset; } pr_notice("Memory limit set/overridden to %lldMB\n", memory_limit >> 20); Loading Loading @@ -497,7 +509,7 @@ void __init arm64_memblock_init(void) if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) { extern u16 memstart_offset_seed; u64 range = linear_region_size - (memblock_end_of_DRAM() - memblock_start_of_DRAM()); (bootloader_memory_limit - memblock_start_of_DRAM()); /* * If the size of the linear region exceeds, by a sufficient Loading Loading @@ -859,7 +871,7 @@ static int arm64_online_page(struct page *page) { unsigned long phy_addr = page_to_phys(page); if (phy_addr + PAGE_SIZE >= bootloader_memory_limit) if (phy_addr + PAGE_SIZE > bootloader_memory_limit) return -EINVAL; __online_page_set_limits(page); Loading include/linux/memblock.h +1 −0 Original line number Diff line number Diff line Loading @@ -358,6 +358,7 @@ phys_addr_t memblock_reserved_size(void); phys_addr_t memblock_mem_size(unsigned long limit_pfn); phys_addr_t memblock_start_of_DRAM(void); phys_addr_t memblock_end_of_DRAM(void); phys_addr_t memblock_max_addr(phys_addr_t limit); void memblock_enforce_memory_limit(phys_addr_t memory_limit); void memblock_cap_memory_range(phys_addr_t base, phys_addr_t size); void memblock_mem_limit_remove_map(phys_addr_t limit); Loading mm/memblock.c +5 −0 Original line number Diff line number Diff line Loading @@ -1636,6 +1636,11 @@ static phys_addr_t __init_memblock __find_max_addr(phys_addr_t limit) return max_addr; } phys_addr_t __init_memblock memblock_max_addr(phys_addr_t limit) { return __find_max_addr(limit); } void __init memblock_enforce_memory_limit(phys_addr_t limit) { phys_addr_t max_addr = PHYS_ADDR_MAX; Loading Loading
arch/arm64/Kconfig +0 −1 Original line number Diff line number Diff line Loading @@ -266,7 +266,6 @@ config HOTPLUG_SIZE_BITS int "Memory hotplug block size(29 => 512MB 30 => 1GB)" depends on SPARSEMEM depends on MEMORY_HOTPLUG depends on QCOM_MEM_OFFLINE default 30 help Selects granularity of hotplug memory. Block Loading
arch/arm64/mm/init.c +16 −4 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ #include <linux/crash_dump.h> #include <linux/memory.h> #include <linux/libfdt.h> #include <linux/memblock.h> #include <asm/boot.h> #include <asm/fixmap.h> Loading Loading @@ -326,9 +327,10 @@ static void __init update_memory_limit(void) unsigned long node, mp; const char *p; unsigned long long ram_sz, sz; phys_addr_t end_addr, addr_aligned, offset; int ret; ram_sz = memblock_end_of_DRAM() - memblock_start_of_DRAM(); ram_sz = memblock_phys_mem_size(); 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"); Loading @@ -352,7 +354,17 @@ static void __init update_memory_limit(void) } sz = ram_sz - ((ram_sz * mp) / 100); memory_limit = (phys_addr_t)sz; memory_limit = ALIGN(memory_limit, MIN_MEMORY_BLOCK_SIZE); end_addr = memblock_max_addr(memory_limit); addr_aligned = ALIGN(end_addr, MIN_MEMORY_BLOCK_SIZE); offset = addr_aligned - end_addr; if (offset > MIN_MEMORY_BLOCK_SIZE / 2) { addr_aligned = ALIGN_DOWN(end_addr, MIN_MEMORY_BLOCK_SIZE); offset = end_addr - addr_aligned; memory_limit -= offset; } else { memory_limit += offset; } pr_notice("Memory limit set/overridden to %lldMB\n", memory_limit >> 20); Loading Loading @@ -497,7 +509,7 @@ void __init arm64_memblock_init(void) if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) { extern u16 memstart_offset_seed; u64 range = linear_region_size - (memblock_end_of_DRAM() - memblock_start_of_DRAM()); (bootloader_memory_limit - memblock_start_of_DRAM()); /* * If the size of the linear region exceeds, by a sufficient Loading Loading @@ -859,7 +871,7 @@ static int arm64_online_page(struct page *page) { unsigned long phy_addr = page_to_phys(page); if (phy_addr + PAGE_SIZE >= bootloader_memory_limit) if (phy_addr + PAGE_SIZE > bootloader_memory_limit) return -EINVAL; __online_page_set_limits(page); Loading
include/linux/memblock.h +1 −0 Original line number Diff line number Diff line Loading @@ -358,6 +358,7 @@ phys_addr_t memblock_reserved_size(void); phys_addr_t memblock_mem_size(unsigned long limit_pfn); phys_addr_t memblock_start_of_DRAM(void); phys_addr_t memblock_end_of_DRAM(void); phys_addr_t memblock_max_addr(phys_addr_t limit); void memblock_enforce_memory_limit(phys_addr_t memory_limit); void memblock_cap_memory_range(phys_addr_t base, phys_addr_t size); void memblock_mem_limit_remove_map(phys_addr_t limit); Loading
mm/memblock.c +5 −0 Original line number Diff line number Diff line Loading @@ -1636,6 +1636,11 @@ static phys_addr_t __init_memblock __find_max_addr(phys_addr_t limit) return max_addr; } phys_addr_t __init_memblock memblock_max_addr(phys_addr_t limit) { return __find_max_addr(limit); } void __init memblock_enforce_memory_limit(phys_addr_t limit) { phys_addr_t max_addr = PHYS_ADDR_MAX; Loading