Calculating the maximum memory based on the number of lmbs and lmb size does not account for the RMA region. Hence use memory_hotplug_max(), which already accounts for the RMA region, to fetch the maximum memory value. Thanks to Nathan Lynch for suggesting the memory_hotplug_max() function.
Fixes: 772b039fd9a7: ("powerpc/pseries: Export maximum memory value") Signed-off-by: Aravinda Prasad <aravi...@linux.vnet.ibm.com> --- arch/powerpc/platforms/pseries/lparcfg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c index e33e8bc..010a41f 100644 --- a/arch/powerpc/platforms/pseries/lparcfg.c +++ b/arch/powerpc/platforms/pseries/lparcfg.c @@ -23,6 +23,7 @@ #include <linux/slab.h> #include <linux/uaccess.h> #include <linux/hugetlb.h> +#include <linux/memblock.h> #include <asm/lppaca.h> #include <asm/hvcall.h> #include <asm/firmware.h> @@ -33,7 +34,6 @@ #include <asm/vio.h> #include <asm/mmu.h> #include <asm/machdep.h> -#include <asm/drmem.h> #include "pseries.h" @@ -435,7 +435,7 @@ static void maxmem_data(struct seq_file *m) { unsigned long maxmem = 0; - maxmem += drmem_info->n_lmbs * drmem_info->lmb_size; + maxmem += memory_hotplug_max(); maxmem += hugetlb_total_pages() * PAGE_SIZE; seq_printf(m, "MaxMem=%ld\n", maxmem);