powerpc/mm: Pass node id into create_section_mapping
[linux-2.6-block.git] / arch / powerpc / mm / mem.c
index 4362b86ef84c5daa404e806cf3802128b77b8532..f50ce66dd6bd042104ea72654c30ba901e1de7fb 100644 (file)
@@ -117,7 +117,7 @@ int memory_add_physaddr_to_nid(u64 start)
 }
 #endif
 
-int __weak create_section_mapping(unsigned long start, unsigned long end)
+int __weak create_section_mapping(unsigned long start, unsigned long end, int nid)
 {
        return -ENODEV;
 }
@@ -127,7 +127,8 @@ int __weak remove_section_mapping(unsigned long start, unsigned long end)
        return -ENODEV;
 }
 
-int arch_add_memory(int nid, u64 start, u64 size, bool want_memblock)
+int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap,
+               bool want_memblock)
 {
        unsigned long start_pfn = start >> PAGE_SHIFT;
        unsigned long nr_pages = size >> PAGE_SHIFT;
@@ -136,23 +137,21 @@ int arch_add_memory(int nid, u64 start, u64 size, bool want_memblock)
        resize_hpt_for_hotplug(memblock_phys_mem_size());
 
        start = (unsigned long)__va(start);
-       rc = create_section_mapping(start, start + size);
+       rc = create_section_mapping(start, start + size, nid);
        if (rc) {
-               pr_warning(
-                       "Unable to create mapping for hot added memory 0x%llx..0x%llx: %d\n",
+               pr_warn("Unable to create mapping for hot added memory 0x%llx..0x%llx: %d\n",
                        start, start + size, rc);
                return -EFAULT;
        }
 
-       return __add_pages(nid, start_pfn, nr_pages, want_memblock);
+       return __add_pages(nid, start_pfn, nr_pages, altmap, want_memblock);
 }
 
 #ifdef CONFIG_MEMORY_HOTREMOVE
-int arch_remove_memory(u64 start, u64 size)
+int arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
 {
        unsigned long start_pfn = start >> PAGE_SHIFT;
        unsigned long nr_pages = size >> PAGE_SHIFT;
-       struct vmem_altmap *altmap;
        struct page *page;
        int ret;
 
@@ -161,11 +160,10 @@ int arch_remove_memory(u64 start, u64 size)
         * when querying the zone.
         */
        page = pfn_to_page(start_pfn);
-       altmap = to_vmem_altmap((unsigned long) page);
        if (altmap)
                page += vmem_altmap_offset(altmap);
 
-       ret = __remove_pages(page_zone(page), start_pfn, nr_pages);
+       ret = __remove_pages(page_zone(page), start_pfn, nr_pages, altmap);
        if (ret)
                return ret;
 
@@ -214,7 +212,7 @@ walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
 EXPORT_SYMBOL_GPL(walk_system_ram_range);
 
 #ifndef CONFIG_NEED_MULTIPLE_NODES
-void __init initmem_init(void)
+void __init mem_topology_setup(void)
 {
        max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
        min_low_pfn = MEMORY_START >> PAGE_SHIFT;
@@ -226,7 +224,10 @@ void __init initmem_init(void)
         * memblock_regions
         */
        memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
+}
 
+void __init initmem_init(void)
+{
        /* XXX need to clip this if using highmem? */
        sparse_memory_present_with_active_regions(0);
        sparse_init();