Subject: Re: [PATCH] powerpc/pseries: Fix maximum memory value

From: Nathan Lynch <[email-masked]>
Date: Wed, 26 Jun 2019 17:36:55 -0500

Aravinda Prasad <[email-masked]> writes:
> Calculating the maximum memory based on the number of lmbs
> and lmb size does not account for the RMA region. Hence
> use drmem_lmb_memory_max(), which already accounts for the
> RMA region, to fetch the maximum memory value.
>
> Fixes: 772b039fd9a7: ("powerpc/pseries: Export maximum memory value")
> Signed-off-by: Aravinda Prasad <[email-masked]>
> ---
>  arch/powerpc/platforms/pseries/lparcfg.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c
> index e33e8bc..f425842 100644
> --- a/arch/powerpc/platforms/pseries/lparcfg.c
> +++ b/arch/powerpc/platforms/pseries/lparcfg.c
> @@ -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 += drmem_lmb_memory_max();

Would memory_hotplug_max() be better here? There's no guarantee an LPAR
will have the device tree node/properties that populate drmem.