@@ -22,6 +22,9 @@
extern void e820__update_table_print(void);
extern unsigned long e820__end_of_ram_pfn(void);
+#ifdef CONFIG_ZONE_NVM
+extern unsigned long e820__end_of_nvm_pfn(void);
+#endif
extern unsigned long e820__end_of_low_ram_pfn(void);
extern u64 e820__memblock_alloc_reserved(u64 size, u64 align);
@@ -840,6 +840,13 @@ unsigned long __init e820__end_of_ram_pfn(void)
return e820_end_pfn(MAX_ARCH_PFN, E820_TYPE_RAM);
}
+#ifdef CONFIG_ZONE_NVM
+unsigned long __init e820__end_of_nvm_pfn(void)
+{
+ return e820_end_pfn(MAX_ARCH_PFN, E820_TYPE_PMEM);
+}
+#endif
+
unsigned long __init e820__end_of_low_ram_pfn(void)
{
return e820_end_pfn(1UL << (32 - PAGE_SHIFT), E820_TYPE_RAM);
@@ -1246,11 +1253,22 @@ void __init e820__memblock_setup(void)
end = entry->addr + entry->size;
if (end != (resource_size_t)end)
continue;
-
+#ifdef CONFIG_ZONE_NVM
+ if (entry->type != E820_TYPE_RAM && entry->type != E820_TYPE_RESERVED_KERN &&
+ entry->type != E820_TYPE_PMEM)
+#else
if (entry->type != E820_TYPE_RAM && entry->type != E820_TYPE_RESERVED_KERN)
+#endif
continue;
memblock_add(entry->addr, entry->size);
+
+#ifdef CONFIG_ZONE_NVM
+ if (entry->type == E820_TYPE_PMEM) {
+ /* Mark this region with PMEM flags */
+ memblock_mark_nvdimm(entry->addr, entry->size);
+ }
+#endif
}
/* Throw away partial pages: */
@@ -1032,7 +1032,15 @@ void __init setup_arch(char **cmdline_p)
* partially used pages are not usable - thus
* we are rounding upwards:
*/
+#ifdef CONFIG_ZONE_NVM
+ max_pfn = e820__end_of_nvm_pfn();
+ if (!max_pfn) {
+ printk(KERN_INFO "No physical NVDIMM has been found\n");
+ max_pfn = e820__end_of_ram_pfn();
+ }
+#else
max_pfn = e820__end_of_ram_pfn();
+#endif
/* update e820 for memory not covered by WB MTRRs */
mtrr_bp_init();