aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/setup.c
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2013-04-30 13:19:58 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-05-03 08:21:15 -0400
commit996b4a7d8f4e5dd531369396f2312b97e9400cdc (patch)
treec827369c3cb23b84a3cd0528e534b4963c7639fa /arch/s390/kernel/setup.c
parentd3383632d4e8e9ae747f582eaee8c2e79f828ae6 (diff)
s390/mem_detect: remove artificial kdump memory types
Simplify the memory detection code a bit by removing the CHUNK_OLDMEM and CHUNK_CRASHK memory types. They are not needed. Everything that is needed is a mechanism to insert holes into the detected memory. Reviewed-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/setup.c')
-rw-r--r--arch/s390/kernel/setup.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index cdd9ec0a6fc0..0a49095104c9 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -463,14 +463,10 @@ static void __init setup_resources(void)
463 for (i = 0; i < MEMORY_CHUNKS; i++) { 463 for (i = 0; i < MEMORY_CHUNKS; i++) {
464 if (!memory_chunk[i].size) 464 if (!memory_chunk[i].size)
465 continue; 465 continue;
466 if (memory_chunk[i].type == CHUNK_OLDMEM ||
467 memory_chunk[i].type == CHUNK_CRASHK)
468 continue;
469 res = alloc_bootmem_low(sizeof(*res)); 466 res = alloc_bootmem_low(sizeof(*res));
470 res->flags = IORESOURCE_BUSY | IORESOURCE_MEM; 467 res->flags = IORESOURCE_BUSY | IORESOURCE_MEM;
471 switch (memory_chunk[i].type) { 468 switch (memory_chunk[i].type) {
472 case CHUNK_READ_WRITE: 469 case CHUNK_READ_WRITE:
473 case CHUNK_CRASHK:
474 res->name = "System RAM"; 470 res->name = "System RAM";
475 break; 471 break;
476 case CHUNK_READ_ONLY: 472 case CHUNK_READ_ONLY:
@@ -527,7 +523,7 @@ static void __init setup_memory_end(void)
527 unsigned long align; 523 unsigned long align;
528 524
529 chunk = &memory_chunk[i]; 525 chunk = &memory_chunk[i];
530 if (chunk->type == CHUNK_OLDMEM) 526 if (!chunk->size)
531 continue; 527 continue;
532 align = 1UL << (MAX_ORDER + PAGE_SHIFT - 1); 528 align = 1UL << (MAX_ORDER + PAGE_SHIFT - 1);
533 start = (chunk->addr + align - 1) & ~(align - 1); 529 start = (chunk->addr + align - 1) & ~(align - 1);
@@ -579,7 +575,7 @@ static void __init setup_memory_end(void)
579 for (i = 0; i < MEMORY_CHUNKS; i++) { 575 for (i = 0; i < MEMORY_CHUNKS; i++) {
580 struct mem_chunk *chunk = &memory_chunk[i]; 576 struct mem_chunk *chunk = &memory_chunk[i];
581 577
582 if (chunk->type == CHUNK_OLDMEM) 578 if (!chunk->size)
583 continue; 579 continue;
584 if (chunk->addr >= memory_end) { 580 if (chunk->addr >= memory_end) {
585 memset(chunk, 0, sizeof(*chunk)); 581 memset(chunk, 0, sizeof(*chunk));
@@ -681,15 +677,6 @@ static int __init verify_crash_base(unsigned long crash_base,
681} 677}
682 678
683/* 679/*
684 * Reserve kdump memory by creating a memory hole in the mem_chunk array
685 */
686static void __init reserve_kdump_bootmem(unsigned long addr, unsigned long size,
687 int type)
688{
689 create_mem_hole(memory_chunk, addr, size, type);
690}
691
692/*
693 * When kdump is enabled, we have to ensure that no memory from 680 * When kdump is enabled, we have to ensure that no memory from
694 * the area [0 - crashkernel memory size] and 681 * the area [0 - crashkernel memory size] and
695 * [crashk_res.start - crashk_res.end] is set offline. 682 * [crashk_res.start - crashk_res.end] is set offline.
@@ -730,8 +717,8 @@ static void reserve_oldmem(void)
730 717
731 real_size = max(real_size, chunk->addr + chunk->size); 718 real_size = max(real_size, chunk->addr + chunk->size);
732 } 719 }
733 reserve_kdump_bootmem(OLDMEM_BASE, OLDMEM_SIZE, CHUNK_OLDMEM); 720 create_mem_hole(memory_chunk, OLDMEM_BASE, OLDMEM_SIZE);
734 reserve_kdump_bootmem(OLDMEM_SIZE, real_size - OLDMEM_SIZE, CHUNK_OLDMEM); 721 create_mem_hole(memory_chunk, OLDMEM_SIZE, real_size - OLDMEM_SIZE);
735 if (OLDMEM_BASE + OLDMEM_SIZE == real_size) 722 if (OLDMEM_BASE + OLDMEM_SIZE == real_size)
736 saved_max_pfn = PFN_DOWN(OLDMEM_BASE) - 1; 723 saved_max_pfn = PFN_DOWN(OLDMEM_BASE) - 1;
737 else 724 else
@@ -774,7 +761,7 @@ static void __init reserve_crashkernel(void)
774 crashk_res.start = crash_base; 761 crashk_res.start = crash_base;
775 crashk_res.end = crash_base + crash_size - 1; 762 crashk_res.end = crash_base + crash_size - 1;
776 insert_resource(&iomem_resource, &crashk_res); 763 insert_resource(&iomem_resource, &crashk_res);
777 reserve_kdump_bootmem(crash_base, crash_size, CHUNK_CRASHK); 764 create_mem_hole(memory_chunk, crash_base, crash_size);
778 pr_info("Reserving %lluMB of memory at %lluMB " 765 pr_info("Reserving %lluMB of memory at %lluMB "
779 "for crashkernel (System RAM: %luMB)\n", 766 "for crashkernel (System RAM: %luMB)\n",
780 crash_size >> 20, crash_base >> 20, memory_end >> 20); 767 crash_size >> 20, crash_base >> 20, memory_end >> 20);
@@ -846,11 +833,10 @@ static void __init setup_memory(void)
846 * Register RAM areas with the bootmem allocator. 833 * Register RAM areas with the bootmem allocator.
847 */ 834 */
848 835
849 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { 836 for (i = 0; i < MEMORY_CHUNKS; i++) {
850 unsigned long start_chunk, end_chunk, pfn; 837 unsigned long start_chunk, end_chunk, pfn;
851 838
852 if (memory_chunk[i].type != CHUNK_READ_WRITE && 839 if (!memory_chunk[i].size)
853 memory_chunk[i].type != CHUNK_CRASHK)
854 continue; 840 continue;
855 start_chunk = PFN_DOWN(memory_chunk[i].addr); 841 start_chunk = PFN_DOWN(memory_chunk[i].addr);
856 end_chunk = start_chunk + PFN_DOWN(memory_chunk[i].size); 842 end_chunk = start_chunk + PFN_DOWN(memory_chunk[i].size);