aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/zcore.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 /drivers/s390/char/zcore.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 'drivers/s390/char/zcore.c')
-rw-r--r--drivers/s390/char/zcore.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c
index 3d8e4d63f514..1884653e4472 100644
--- a/drivers/s390/char/zcore.c
+++ b/drivers/s390/char/zcore.c
@@ -17,6 +17,8 @@
17#include <linux/miscdevice.h> 17#include <linux/miscdevice.h>
18#include <linux/debugfs.h> 18#include <linux/debugfs.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/memblock.h>
21
20#include <asm/asm-offsets.h> 22#include <asm/asm-offsets.h>
21#include <asm/ipl.h> 23#include <asm/ipl.h>
22#include <asm/sclp.h> 24#include <asm/sclp.h>
@@ -411,33 +413,24 @@ static ssize_t zcore_memmap_read(struct file *filp, char __user *buf,
411 size_t count, loff_t *ppos) 413 size_t count, loff_t *ppos)
412{ 414{
413 return simple_read_from_buffer(buf, count, ppos, filp->private_data, 415 return simple_read_from_buffer(buf, count, ppos, filp->private_data,
414 MEMORY_CHUNKS * CHUNK_INFO_SIZE); 416 memblock.memory.cnt * CHUNK_INFO_SIZE);
415} 417}
416 418
417static int zcore_memmap_open(struct inode *inode, struct file *filp) 419static int zcore_memmap_open(struct inode *inode, struct file *filp)
418{ 420{
419 int i; 421 struct memblock_region *reg;
420 char *buf; 422 char *buf;
421 struct mem_chunk *chunk_array; 423 int i = 0;
422 424
423 chunk_array = kzalloc(MEMORY_CHUNKS * sizeof(struct mem_chunk), 425 buf = kzalloc(memblock.memory.cnt * CHUNK_INFO_SIZE, GFP_KERNEL);
424 GFP_KERNEL);
425 if (!chunk_array)
426 return -ENOMEM;
427 detect_memory_layout(chunk_array, 0);
428 buf = kzalloc(MEMORY_CHUNKS * CHUNK_INFO_SIZE, GFP_KERNEL);
429 if (!buf) { 426 if (!buf) {
430 kfree(chunk_array);
431 return -ENOMEM; 427 return -ENOMEM;
432 } 428 }
433 for (i = 0; i < MEMORY_CHUNKS; i++) { 429 for_each_memblock(memory, reg) {
434 sprintf(buf + (i * CHUNK_INFO_SIZE), "%016llx %016llx ", 430 sprintf(buf + (i++ * CHUNK_INFO_SIZE), "%016llx %016llx ",
435 (unsigned long long) chunk_array[i].addr, 431 (unsigned long long) reg->base,
436 (unsigned long long) chunk_array[i].size); 432 (unsigned long long) reg->size);
437 if (chunk_array[i].size == 0)
438 break;
439 } 433 }
440 kfree(chunk_array);
441 filp->private_data = buf; 434 filp->private_data = buf;
442 return nonseekable_open(inode, filp); 435 return nonseekable_open(inode, filp);
443} 436}
@@ -593,21 +586,12 @@ static int __init check_sdias(void)
593 586
594static int __init get_mem_info(unsigned long *mem, unsigned long *end) 587static int __init get_mem_info(unsigned long *mem, unsigned long *end)
595{ 588{
596 int i; 589 struct memblock_region *reg;
597 struct mem_chunk *chunk_array;
598 590
599 chunk_array = kzalloc(MEMORY_CHUNKS * sizeof(struct mem_chunk), 591 for_each_memblock(memory, reg) {
600 GFP_KERNEL); 592 *mem += reg->size;
601 if (!chunk_array) 593 *end = max_t(unsigned long, *end, reg->base + reg->size);
602 return -ENOMEM;
603 detect_memory_layout(chunk_array, 0);
604 for (i = 0; i < MEMORY_CHUNKS; i++) {
605 if (chunk_array[i].size == 0)
606 break;
607 *mem += chunk_array[i].size;
608 *end = max(*end, chunk_array[i].addr + chunk_array[i].size);
609 } 594 }
610 kfree(chunk_array);
611 return 0; 595 return 0;
612} 596}
613 597