aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/mm/vmem.c
diff options
context:
space:
mode:
authorPhilipp Hachtmann <phacht@linux.vnet.ibm.com>2014-01-29 12:16:01 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2014-05-20 02:58:40 -0400
commit50be634507284eea38df78154d22615d21200b42 (patch)
tree427a1302d043bb64b5d4d01c0459f7b4a2282110 /arch/s390/mm/vmem.c
parent70210ed950b538ee7eb811dccc402db9df1c9be4 (diff)
s390/mm: Convert bootmem to memblock
The original bootmem allocator is getting replaced by memblock. To cover the needs of the s390 kdump implementation the physical memory list is used. With this patch the bootmem allocator and its bitmaps are completely removed from s390. Signed-off-by: Philipp Hachtmann <phacht@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/mm/vmem.c')
-rw-r--r--arch/s390/mm/vmem.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index 72b04de18283..fe9012a49aa5 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -10,6 +10,7 @@
10#include <linux/list.h> 10#include <linux/list.h>
11#include <linux/hugetlb.h> 11#include <linux/hugetlb.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/memblock.h>
13#include <asm/pgalloc.h> 14#include <asm/pgalloc.h>
14#include <asm/pgtable.h> 15#include <asm/pgtable.h>
15#include <asm/setup.h> 16#include <asm/setup.h>
@@ -66,7 +67,8 @@ static pte_t __ref *vmem_pte_alloc(unsigned long address)
66 if (slab_is_available()) 67 if (slab_is_available())
67 pte = (pte_t *) page_table_alloc(&init_mm, address); 68 pte = (pte_t *) page_table_alloc(&init_mm, address);
68 else 69 else
69 pte = alloc_bootmem(PTRS_PER_PTE * sizeof(pte_t)); 70 pte = alloc_bootmem_align(PTRS_PER_PTE * sizeof(pte_t),
71 PTRS_PER_PTE * sizeof(pte_t));
70 if (!pte) 72 if (!pte)
71 return NULL; 73 return NULL;
72 clear_table((unsigned long *) pte, _PAGE_INVALID, 74 clear_table((unsigned long *) pte, _PAGE_INVALID,
@@ -371,16 +373,14 @@ out:
371void __init vmem_map_init(void) 373void __init vmem_map_init(void)
372{ 374{
373 unsigned long ro_start, ro_end; 375 unsigned long ro_start, ro_end;
374 unsigned long start, end; 376 struct memblock_region *reg;
375 int i; 377 phys_addr_t start, end;
376 378
377 ro_start = PFN_ALIGN((unsigned long)&_stext); 379 ro_start = PFN_ALIGN((unsigned long)&_stext);
378 ro_end = (unsigned long)&_eshared & PAGE_MASK; 380 ro_end = (unsigned long)&_eshared & PAGE_MASK;
379 for (i = 0; i < MEMORY_CHUNKS; i++) { 381 for_each_memblock(memory, reg) {
380 if (!memory_chunk[i].size) 382 start = reg->base;
381 continue; 383 end = reg->base + reg->size - 1;
382 start = memory_chunk[i].addr;
383 end = memory_chunk[i].addr + memory_chunk[i].size;
384 if (start >= ro_end || end <= ro_start) 384 if (start >= ro_end || end <= ro_start)
385 vmem_add_mem(start, end - start, 0); 385 vmem_add_mem(start, end - start, 0);
386 else if (start >= ro_start && end <= ro_end) 386 else if (start >= ro_start && end <= ro_end)
@@ -400,23 +400,21 @@ void __init vmem_map_init(void)
400} 400}
401 401
402/* 402/*
403 * Convert memory chunk array to a memory segment list so there is a single 403 * Convert memblock.memory to a memory segment list so there is a single
404 * list that contains both r/w memory and shared memory segments. 404 * list that contains all memory segments.
405 */ 405 */
406static int __init vmem_convert_memory_chunk(void) 406static int __init vmem_convert_memory_chunk(void)
407{ 407{
408 struct memblock_region *reg;
408 struct memory_segment *seg; 409 struct memory_segment *seg;
409 int i;
410 410
411 mutex_lock(&vmem_mutex); 411 mutex_lock(&vmem_mutex);
412 for (i = 0; i < MEMORY_CHUNKS; i++) { 412 for_each_memblock(memory, reg) {
413 if (!memory_chunk[i].size)
414 continue;
415 seg = kzalloc(sizeof(*seg), GFP_KERNEL); 413 seg = kzalloc(sizeof(*seg), GFP_KERNEL);
416 if (!seg) 414 if (!seg)
417 panic("Out of memory...\n"); 415 panic("Out of memory...\n");
418 seg->start = memory_chunk[i].addr; 416 seg->start = reg->base;
419 seg->size = memory_chunk[i].size; 417 seg->size = reg->size;
420 insert_memory_segment(seg); 418 insert_memory_segment(seg);
421 } 419 }
422 mutex_unlock(&vmem_mutex); 420 mutex_unlock(&vmem_mutex);