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.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index d071a81b62da..3a61bfc2c4fb 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -559,7 +559,9 @@ setup_resources(void)
559 data_resource.start = (unsigned long) &_etext; 559 data_resource.start = (unsigned long) &_etext;
560 data_resource.end = (unsigned long) &_edata - 1; 560 data_resource.end = (unsigned long) &_edata - 1;
561 561
562 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { 562 for (i = 0; i < MEMORY_CHUNKS; i++) {
563 if (!memory_chunk[i].size)
564 continue;
563 res = alloc_bootmem_low(sizeof(struct resource)); 565 res = alloc_bootmem_low(sizeof(struct resource));
564 res->flags = IORESOURCE_BUSY | IORESOURCE_MEM; 566 res->flags = IORESOURCE_BUSY | IORESOURCE_MEM;
565 switch (memory_chunk[i].type) { 567 switch (memory_chunk[i].type) {
@@ -630,6 +632,27 @@ static void __init setup_memory_end(void)
630 max_mem = memory_end ? min(VMALLOC_START, memory_end) : VMALLOC_START; 632 max_mem = memory_end ? min(VMALLOC_START, memory_end) : VMALLOC_START;
631 memory_end = min(max_mem, memory_end); 633 memory_end = min(max_mem, memory_end);
632 634
635 /*
636 * Make sure all chunks are MAX_ORDER aligned so we don't need the
637 * extra checks that HOLES_IN_ZONE would require.
638 */
639 for (i = 0; i < MEMORY_CHUNKS; i++) {
640 unsigned long start, end;
641 struct mem_chunk *chunk;
642 unsigned long align;
643
644 chunk = &memory_chunk[i];
645 align = 1UL << (MAX_ORDER + PAGE_SHIFT - 1);
646 start = (chunk->addr + align - 1) & ~(align - 1);
647 end = (chunk->addr + chunk->size) & ~(align - 1);
648 if (start >= end)
649 memset(chunk, 0, sizeof(*chunk));
650 else {
651 chunk->addr = start;
652 chunk->size = end - start;
653 }
654 }
655
633 for (i = 0; i < MEMORY_CHUNKS; i++) { 656 for (i = 0; i < MEMORY_CHUNKS; i++) {
634 struct mem_chunk *chunk = &memory_chunk[i]; 657 struct mem_chunk *chunk = &memory_chunk[i];
635 658