parisc: Enable SPARSEMEM_VMEMMAP
diff mbox series

Message ID 20190501131440.GA8816@ls3530.dellerweb.de
State New
Headers show
Series
  • parisc: Enable SPARSEMEM_VMEMMAP
Related show

Commit Message

Helge Deller May 1, 2019, 1:14 p.m. UTC
Enable the SPARSEMEM VMEMMAP implementation on parisc.
The vmemmap is mapped at a virtual address which is higher than the
addressable physical address (0x8000000000).

This patch could be optimized by rewriting vmemmap_populate() to utilize
large pages.

Signed-off-by: Helge Deller <deller@gmx.de>

Patch
diff mbox series

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 26c215570adf..49212f31b461 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -318,6 +318,7 @@  config ARCH_SELECT_MEMORY_MODEL
 config ARCH_SPARSEMEM_ENABLE
 	def_bool y
 	depends on 64BIT
+	select SPARSEMEM_VMEMMAP_ENABLE

 config ARCH_FLATMEM_ENABLE
 	def_bool y
diff --git a/arch/parisc/include/asm/fixmap.h b/arch/parisc/include/asm/fixmap.h
index 288da73d4cc0..c5ae85fc99ae 100644
--- a/arch/parisc/include/asm/fixmap.h
+++ b/arch/parisc/include/asm/fixmap.h
@@ -43,6 +43,12 @@  extern void *parisc_vmalloc_start;
 void set_fixmap(enum fixed_addresses idx, phys_addr_t phys);
 void clear_fixmap(enum fixed_addresses idx);

+#if defined(CONFIG_SPARSEMEM_VMEMMAP)
+#define VMEMMAP_BASE	(UL(1) << MAX_PHYSMEM_BITS)
+#define VMEMMAP_SIZE	(UL(1) << (MAX_PHYSMEM_BITS - PAGE_SHIFT - 1 + STRUCT_PAGE_MAX_SHIFT))
+#define vmemmap		((struct page *) VMEMMAP_BASE)
+#endif
+
 #endif /*__ASSEMBLY__*/

 #endif /*_ASM_FIXMAP_H*/
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 78e451ce0f1b..c4c71490ca36 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -609,8 +609,11 @@  void __init mem_init(void)
 	       "     memory  : 0x%px - 0x%px   (%4ld MB)\n"
 	       "       .init : 0x%px - 0x%px   (%4ld kB)\n"
 	       "       .data : 0x%px - 0x%px   (%4ld kB)\n"
-	       "       .text : 0x%px - 0x%px   (%4ld kB)\n",
-
+	       "       .text : 0x%px - 0x%px   (%4ld kB)\n"
+#if defined(CONFIG_SPARSEMEM_VMEMMAP)
+	       "     vmemmap : 0x%px - 0x%px   (%4ld MB)\n"
+#endif
+		,
 	       (void*)VMALLOC_START, (void*)VMALLOC_END,
 	       (VMALLOC_END - VMALLOC_START) >> 20,

@@ -627,7 +630,15 @@  void __init mem_init(void)
 	       ((unsigned long)_edata - (unsigned long)_etext) >> 10,

 	       _text, _etext,
-	       ((unsigned long)_etext - (unsigned long)_text) >> 10);
+	       ((unsigned long)_etext - (unsigned long)_text) >> 10
+
+#if defined(CONFIG_SPARSEMEM_VMEMMAP)
+		,
+	       (void *)VMEMMAP_BASE, (void *)(VMEMMAP_BASE + VMEMMAP_SIZE),
+	       (unsigned long)(VMEMMAP_SIZE >> 20)
+#endif
+		);
+
 #endif
 }

@@ -923,3 +934,11 @@  void free_initrd_mem(unsigned long start, unsigned long end)
 	free_reserved_area((void *)start, (void *)end, -1, "initrd");
 }
 #endif
+
+#if defined(CONFIG_SPARSEMEM_VMEMMAP)
+int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend,
+			       int node, struct vmem_altmap *altmap)
+{
+	return vmemmap_populate_basepages(vstart, vend, node);
+}
+#endif