From 703ccaaab493583331fe9fed18381f514f376f6c Mon Sep 17 00:00:00 2001 From: Charan Teja Reddy Date: Fri, 1 Nov 2019 19:24:12 +0530 Subject: [PATCH] arm64: mm: improve the mem-offline device node availability check Even if we use status = "disabled" in mem-offline node, still the update_memory_limit() will go and update memory_limit variable and thus the removed memory is never added to system as the mem-offline driver is disabled. Correct this logic. Change-Id: I80102830f0a5a82dcd4cddfaddb0de21bfdd0110 Signed-off-by: Charan Teja Reddy Signed-off-by: Isaac J. Manjarres --- arch/arm64/mm/init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index a91f9963a4b9..062da2ae7c23 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -271,6 +271,7 @@ static void __init update_memory_limit(void) phys_addr_t end_addr, addr_aligned, offset; int len; const __be32 *prop; + char *status; phys_addr_t min_ddr_sz = 0, offline_sz = 0; int t_len = (2 * dt_root_size_cells) * sizeof(__be32); @@ -281,6 +282,12 @@ static void __init update_memory_limit(void) return; } + status = (char *)fdt_getprop(initial_boot_params, node, "status", NULL); + if (status && !strcmp(status, "disabled")) { + pr_info("mem-offline device is disabled\n"); + return; + } + prop = of_get_flat_dt_prop(node, "offline-sizes", &len); if (prop) { if (len % t_len != 0) {