aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kernel/setup.c')
-rw-r--r--arch/s390/kernel/setup.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index b1a8ad967f9c..b928fecdc743 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -62,7 +62,6 @@ EXPORT_SYMBOL_GPL(uaccess);
62unsigned int console_mode = 0; 62unsigned int console_mode = 0;
63unsigned int console_devno = -1; 63unsigned int console_devno = -1;
64unsigned int console_irq = -1; 64unsigned int console_irq = -1;
65unsigned long memory_size = 0;
66unsigned long machine_flags = 0; 65unsigned long machine_flags = 0;
67 66
68struct mem_chunk memory_chunk[MEMORY_CHUNKS]; 67struct mem_chunk memory_chunk[MEMORY_CHUNKS];
@@ -486,6 +485,37 @@ setup_resources(void)
486 } 485 }
487} 486}
488 487
488static void __init setup_memory_end(void)
489{
490 unsigned long real_size, memory_size;
491 unsigned long max_mem, max_phys;
492 int i;
493
494 memory_size = real_size = 0;
495 max_phys = VMALLOC_END - VMALLOC_MIN_SIZE;
496 memory_end &= PAGE_MASK;
497
498 max_mem = memory_end ? min(max_phys, memory_end) : max_phys;
499
500 for (i = 0; i < MEMORY_CHUNKS; i++) {
501 struct mem_chunk *chunk = &memory_chunk[i];
502
503 real_size = max(real_size, chunk->addr + chunk->size);
504 if (chunk->addr >= max_mem) {
505 memset(chunk, 0, sizeof(*chunk));
506 continue;
507 }
508 if (chunk->addr + chunk->size > max_mem)
509 chunk->size = max_mem - chunk->addr;
510 memory_size = max(memory_size, chunk->addr + chunk->size);
511 }
512 if (!memory_end)
513 memory_end = memory_size;
514 if (real_size > memory_end)
515 printk("More memory detected than supported. Unused: %luk\n",
516 (real_size - memory_end) >> 10);
517}
518
489static void __init 519static void __init
490setup_memory(void) 520setup_memory(void)
491{ 521{
@@ -642,8 +672,6 @@ setup_arch(char **cmdline_p)
642 init_mm.end_data = (unsigned long) &_edata; 672 init_mm.end_data = (unsigned long) &_edata;
643 init_mm.brk = (unsigned long) &_end; 673 init_mm.brk = (unsigned long) &_end;
644 674
645 memory_end = memory_size;
646
647 if (MACHINE_HAS_MVCOS) 675 if (MACHINE_HAS_MVCOS)
648 memcpy(&uaccess, &uaccess_mvcos, sizeof(uaccess)); 676 memcpy(&uaccess, &uaccess_mvcos, sizeof(uaccess));
649 else 677 else
@@ -651,20 +679,7 @@ setup_arch(char **cmdline_p)
651 679
652 parse_early_param(); 680 parse_early_param();
653 681
654#ifndef CONFIG_64BIT 682 setup_memory_end();
655 memory_end &= ~0x400000UL;
656
657 /*
658 * We need some free virtual space to be able to do vmalloc.
659 * On a machine with 2GB memory we make sure that we have at
660 * least 128 MB free space for vmalloc.
661 */
662 if (memory_end > 1920*1024*1024)
663 memory_end = 1920*1024*1024;
664#else /* CONFIG_64BIT */
665 memory_end &= ~0x200000UL;
666#endif /* CONFIG_64BIT */
667
668 setup_memory(); 683 setup_memory();
669 setup_resources(); 684 setup_resources();
670 setup_lowcore(); 685 setup_lowcore();