linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nishanth Aravamudan <nacc@us.ibm.com>
To: nacc@us.ibm.com
Cc: sonnyrao@us.ibm.com, linuxppc-dev@lists.ozlabs.org,
	miltonm@bga.com, H Hartley Sweeten <hsweeten@visionengravers.com>,
	Paul Mackerras <paulus@samba.org>,
	Anton Blanchard <anton@samba.org>,
	"H. Peter Anvin" <hpa@linux.intel.com>,
	Yinghai Lu <yinghai@kernel.org>
Subject: [RFC PATCH 2/7 v2] ppc: add memory_hotplug_max
Date: Tue, 26 Oct 2010 20:35:12 -0700	[thread overview]
Message-ID: <1288150518-4026-3-git-send-email-nacc@us.ibm.com> (raw)
In-Reply-To: <1288150518-4026-1-git-send-email-nacc@us.ibm.com>

Add a function to get the maximum address that can be hotplug added.
This is needed to calculate the size of the tce table needed to cover
all memory in 1:1 mode.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
Comments on where to export?
---
 arch/powerpc/include/asm/mmzone.h |    5 +++++
 arch/powerpc/mm/numa.c            |   26 ++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h
index aac87cb..fd3fd58 100644
--- a/arch/powerpc/include/asm/mmzone.h
+++ b/arch/powerpc/include/asm/mmzone.h
@@ -33,6 +33,9 @@ extern int numa_cpu_lookup_table[];
 extern cpumask_var_t node_to_cpumask_map[];
 #ifdef CONFIG_MEMORY_HOTPLUG
 extern unsigned long max_pfn;
+u64 memory_hotplug_max(void);
+#else
+#define memory_hotplug_max() memblock_end_of_DRAM()
 #endif
 
 /*
@@ -42,6 +45,8 @@ extern unsigned long max_pfn;
 #define node_start_pfn(nid)	(NODE_DATA(nid)->node_start_pfn)
 #define node_end_pfn(nid)	(NODE_DATA(nid)->node_end_pfn)
 
+#else
+#define memory_hotplug_max() memblock_end_of_DRAM()
 #endif /* CONFIG_NEED_MULTIPLE_NODES */
 
 #endif /* __KERNEL__ */
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 74505b2..8c0944c 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1247,4 +1247,30 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
 	return nid;
 }
 
+static u64 hot_add_drconf_memory_max(void)
+{
+        struct device_node *memory = NULL;
+        unsigned int drconf_cell_cnt = 0;
+        u64 lmb_size = 0;
+        const u32 *dm = 0;
+
+        memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
+        if (memory) {
+                drconf_cell_cnt = of_get_drconf_memory(memory, &dm);
+                lmb_size = of_get_lmb_size(memory);
+                of_node_put(memory);
+        }
+        return lmb_size * drconf_cell_cnt;
+}
+
+/*
+ * memory_hotplug_max - return max address of memory that may be added
+ *
+ * This is currently only used on systems that support drconfig memory
+ * hotplug.
+ */
+u64 memory_hotplug_max(void)
+{
+        return max(hot_add_drconf_memory_max(), memblock_end_of_DRAM());
+}
 #endif /* CONFIG_MEMORY_HOTPLUG */
-- 
1.7.1

  parent reply	other threads:[~2010-10-27  3:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27  3:35 [RFC PATCH 0/7 v2] ppc: enable dynamic dma window support Nishanth Aravamudan
2010-10-27  3:35 ` [RFC PATCH 1/7 v2] macio: ensure all dma routines get copied over Nishanth Aravamudan
2010-10-27  3:35 ` Nishanth Aravamudan [this message]
2010-10-27  3:35 ` [RFC PATCH 3/7 v2] ppc: do not search for dma-window property on dlpar remove Nishanth Aravamudan
2010-11-29  1:38   ` Benjamin Herrenschmidt
2010-12-01  0:30     ` Nishanth Aravamudan
2010-12-04  0:30     ` Nishanth Aravamudan
2010-10-27  3:35 ` [RFC PATCH 4/7 v2] ppc: checking for pdn->parent is redundant Nishanth Aravamudan
2010-10-27  3:35 ` [RFC PATCH 5/7 v2] ppc/iommu: do not need to check for dma_window == NULL Nishanth Aravamudan
2010-10-27  3:35 ` [RFC PATCH 6/7 v2] ppc/iommu: pass phb only to iommu_table_setparms_lpar Nishanth Aravamudan
2010-12-09  4:24   ` Benjamin Herrenschmidt
2010-12-09 16:16     ` Nishanth Aravamudan
2010-10-27  3:35 ` [RFC PATCH 7/7 v2] ppc: add dynamic dma window support Nishanth Aravamudan
2010-12-09  4:17   ` Benjamin Herrenschmidt
2010-12-09 19:00     ` Nishanth Aravamudan
2010-12-09 19:09   ` Nishanth Aravamudan
2010-12-11  0:07     ` [PATCH 7/7 v3] " Nishanth Aravamudan
2011-01-08  2:53       ` [PATCH] ppc: update dynamic dma support Nishanth Aravamudan
2011-01-17 17:32         ` [PATCH v2] " Nishanth Aravamudan
2011-01-18  0:20           ` [PATCH v3] " Nishanth Aravamudan
2010-11-08 19:42 ` [RFC PATCH 0/7 v2] ppc: enable dynamic dma window support Nishanth Aravamudan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1288150518-4026-3-git-send-email-nacc@us.ibm.com \
    --to=nacc@us.ibm.com \
    --cc=anton@samba.org \
    --cc=hpa@linux.intel.com \
    --cc=hsweeten@visionengravers.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=miltonm@bga.com \
    --cc=paulus@samba.org \
    --cc=sonnyrao@us.ibm.com \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).