aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAravinda Prasad <aravinda@linux.vnet.ibm.com>2018-10-10 06:22:59 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2018-10-26 06:58:58 -0400
commit772b039fd9a7e12d5fc80e6f649341934ad51fbe (patch)
treedc8eaa9e9bd22b1697a45ddd142ce222b67fa9c9
parent709cf19c5749308603ffa12557d8bd152a926783 (diff)
powerpc/pseries: Export maximum memory value
This patch exports the maximum possible amount of memory configured on the system via /proc/powerpc/lparcfg. Signed-off-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/platforms/pseries/lparcfg.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c
index 8bd590af488a..794487313cc8 100644
--- a/arch/powerpc/platforms/pseries/lparcfg.c
+++ b/arch/powerpc/platforms/pseries/lparcfg.c
@@ -26,6 +26,7 @@
26#include <linux/seq_file.h> 26#include <linux/seq_file.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/uaccess.h> 28#include <linux/uaccess.h>
29#include <linux/hugetlb.h>
29#include <asm/lppaca.h> 30#include <asm/lppaca.h>
30#include <asm/hvcall.h> 31#include <asm/hvcall.h>
31#include <asm/firmware.h> 32#include <asm/firmware.h>
@@ -36,6 +37,7 @@
36#include <asm/vio.h> 37#include <asm/vio.h>
37#include <asm/mmu.h> 38#include <asm/mmu.h>
38#include <asm/machdep.h> 39#include <asm/machdep.h>
40#include <asm/drmem.h>
39 41
40#include "pseries.h" 42#include "pseries.h"
41 43
@@ -433,6 +435,16 @@ static void parse_em_data(struct seq_file *m)
433 seq_printf(m, "power_mode_data=%016lx\n", retbuf[0]); 435 seq_printf(m, "power_mode_data=%016lx\n", retbuf[0]);
434} 436}
435 437
438static void maxmem_data(struct seq_file *m)
439{
440 unsigned long maxmem = 0;
441
442 maxmem += drmem_info->n_lmbs * drmem_info->lmb_size;
443 maxmem += hugetlb_total_pages() * PAGE_SIZE;
444
445 seq_printf(m, "MaxMem=%ld\n", maxmem);
446}
447
436static int pseries_lparcfg_data(struct seq_file *m, void *v) 448static int pseries_lparcfg_data(struct seq_file *m, void *v)
437{ 449{
438 int partition_potential_processors; 450 int partition_potential_processors;
@@ -491,6 +503,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
491 seq_printf(m, "slb_size=%d\n", mmu_slb_size); 503 seq_printf(m, "slb_size=%d\n", mmu_slb_size);
492#endif 504#endif
493 parse_em_data(m); 505 parse_em_data(m);
506 maxmem_data(m);
494 507
495 return 0; 508 return 0;
496} 509}