From: Heiko Carstens Date: Thu, 1 Dec 2016 11:20:09 +0000 (+0100) Subject: s390/setup: fix memblock usage X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=db7ad63624b370100077aa0a849d54fbeabd432b;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git s390/setup: fix memblock usage When converting from bootmem to memblock I missed a subtle difference: the memblock_alloc() functions return uninitialized memory, while the memblock_virt_alloc() functions return zeroed memory. This led to quite random early boot crashes. Therefore use the correct version everywhere now. Hopefully. Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky --- diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 14b57ddd4f62..b57e28f1edc2 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -304,9 +304,7 @@ static void __init setup_lowcore(void) * Setup lowcore for boot cpu */ BUILD_BUG_ON(sizeof(struct lowcore) != LC_PAGES * 4096); - lc = (struct lowcore *) memblock_alloc_base(sizeof(struct lowcore), - sizeof(struct lowcore), - MAX_DMA_ADDRESS); + lc = memblock_virt_alloc_low(sizeof(*lc), sizeof(*lc)); lc->restart_psw.mask = PSW_KERNEL_BITS; lc->restart_psw.addr = (unsigned long) restart_int_handler; lc->external_new_psw.mask = PSW_KERNEL_BITS | @@ -326,9 +324,11 @@ static void __init setup_lowcore(void) lc->clock_comparator = -1ULL; lc->kernel_stack = ((unsigned long) &init_thread_union) + THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs); - lc->async_stack = memblock_alloc(ASYNC_SIZE, ASYNC_SIZE) + lc->async_stack = (unsigned long) + memblock_virt_alloc(ASYNC_SIZE, ASYNC_SIZE) + ASYNC_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs); - lc->panic_stack = memblock_alloc(PAGE_SIZE, PAGE_SIZE) + lc->panic_stack = (unsigned long) + memblock_virt_alloc(PAGE_SIZE, PAGE_SIZE) + PAGE_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs); lc->current_task = (unsigned long)&init_task; lc->lpp = LPP_MAGIC; @@ -350,7 +350,7 @@ static void __init setup_lowcore(void) lc->last_update_timer = S390_lowcore.last_update_timer; lc->last_update_clock = S390_lowcore.last_update_clock; - restart_stack = (void *) memblock_alloc(ASYNC_SIZE, ASYNC_SIZE); + restart_stack = memblock_virt_alloc(ASYNC_SIZE, ASYNC_SIZE); restart_stack += ASYNC_SIZE; /* @@ -413,7 +413,7 @@ static void __init setup_resources(void) bss_resource.end = (unsigned long) &__bss_stop - 1; for_each_memblock(memory, reg) { - res = (void *) memblock_alloc(sizeof(*res), 8); + res = memblock_virt_alloc(sizeof(*res), 8); res->flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM; res->name = "System RAM"; @@ -427,7 +427,7 @@ static void __init setup_resources(void) std_res->start > res->end) continue; if (std_res->end > res->end) { - sub_res = (void *) memblock_alloc(sizeof(*sub_res), 8); + sub_res = memblock_virt_alloc(sizeof(*sub_res), 8); *sub_res = *std_res; sub_res->end = res->end; std_res->start = res->end + 1;