Skip to contentSkip to conversation

s390x: Initialize the physical allocator on mem init

PATCH New Janosch Frank 1 participant 1 message Jan 10, 2019 s390

lore
Share & tools
lore
#0 lore raw

PATCH v5 11/11 s390x: Initialize the physical allocator on mem init

The physical and virtual allocators can coexist, so we can initialize the former and allocate pages without breaking VM alloc.

---
 lib/s390x/sclp.c | 9 +++++++++
 1 file changed, 9 insertions(+)
lib/s390x/sclp.c +9 -0
index e14f25d..0e76787 100644
@@ -18,6 +18,7 @@
 #include <asm/spinlock.h>
 #include "sclp.h"
 #include <alloc_phys.h>
+#include <alloc_page.h>
 
 extern unsigned long stacktop;
 
@@ -32,8 +33,16 @@ static struct spinlock sclp_lock;
 static void mem_init(phys_addr_t mem_end)
 {
 	phys_addr_t freemem_start = (phys_addr_t)&stacktop;
+	phys_addr_t base, top;
 
 	phys_alloc_init(freemem_start, mem_end - freemem_start);
+	phys_alloc_get_unused(&base, &top);
+	base = (base + PAGE_SIZE - 1) & -PAGE_SIZE;
+	top = top & -PAGE_SIZE;
+
+	/* Make the pages available to the physical allocator */
+	free_pages((void *)(unsigned long)base, top - base);
+	page_alloc_ops_enable();
 }
 
 static void sclp_setup_int(void)
Signature · 1 line
2.14.3