if ((addr >> PAGE_SHIFT) != pfn)
                return 0;
+
+#ifdef CONFIG_SPARSEMEM
+       if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
+               return 0;
+
+       if (!valid_section(__nr_to_section(pfn_to_section_nr(pfn))))
+               return 0;
+#endif
        return memblock_is_map_memory(addr);
 }
 EXPORT_SYMBOL(pfn_valid);
 
        pmd_free(NULL, table);
        return 1;
 }
+
+#ifdef CONFIG_MEMORY_HOTPLUG
+int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap,
+                   bool want_memblock)
+{
+       int flags = 0;
+
+       if (rodata_full || debug_pagealloc_enabled())
+               flags = NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS;
+
+       __create_pgd_mapping(swapper_pg_dir, start, __phys_to_virt(start),
+                            size, PAGE_KERNEL, pgd_pgtable_alloc, flags);
+
+       return __add_pages(nid, start >> PAGE_SHIFT, size >> PAGE_SHIFT,
+                          altmap, want_memblock);
+}
+#endif
 
 
        numa_init(dummy_numa_init);
 }
+
+/*
+ * We hope that we will be hotplugging memory on nodes we already know about,
+ * such that acpi_get_node() succeeds and we never fall back to this...
+ */
+int memory_add_physaddr_to_nid(u64 addr)
+{
+       pr_warn("Unknown node for memory at 0x%llx, assuming node 0\n", addr);
+       return 0;
+}