

Dave,

The following patch is necessary for memory hot add on ppc64 in a
DLPAR environment.  I still need to do some additional work to
make sure the memory really is there before creating the mappings.
Also, I want to do some cleanup in the cases where memory block
size does not equal section size.

In any case, the following is needed for anyone playing with ppc64.

-- 
Signed-off-by: Mike Kravetz <kravetz@us.ibm.com>

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---

 memhotplug-dave/arch/ppc64/mm/hash_utils.c |    7 +++++++
 memhotplug-dave/arch/ppc64/mm/init.c       |    3 +++
 2 files changed, 10 insertions(+)

diff -puN arch/ppc64/mm/hash_utils.c~G3-ppc64-create-mappings arch/ppc64/mm/hash_utils.c
--- memhotplug/arch/ppc64/mm/hash_utils.c~G3-ppc64-create-mappings	2005-04-13 14:20:54.000000000 -0700
+++ memhotplug-dave/arch/ppc64/mm/hash_utils.c	2005-04-13 14:20:54.000000000 -0700
@@ -143,6 +143,13 @@ static inline void create_pte_mapping(un
 	}
 }
 
+void create_lmb_mapping(unsigned long start, unsigned long end)
+{
+	create_pte_mapping(start, end,
+		_PAGE_ACCESSED | _PAGE_COHERENT | PP_RWXX,
+		cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE ? 1 : 0);
+}
+
 void __init htab_initialize(void)
 {
 	unsigned long table, htab_size_bytes;
diff -puN arch/ppc64/mm/init.c~G3-ppc64-create-mappings arch/ppc64/mm/init.c
--- memhotplug/arch/ppc64/mm/init.c~G3-ppc64-create-mappings	2005-04-13 14:20:54.000000000 -0700
+++ memhotplug-dave/arch/ppc64/mm/init.c	2005-04-13 14:20:54.000000000 -0700
@@ -963,6 +963,9 @@ int __devinit add_memory(u64 start, u64 
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	unsigned long nr_pages = size >> PAGE_SHIFT;
 
+	start += KERNELBASE;
+	create_lmb_mapping(start, start + size);
+
 	/* this should work for most non-highmem platforms */
 	zone = pgdata->node_zones;
 
_
