Merge tag 's390-6.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
[linux-block.git] / arch / s390 / kernel / setup.c
index d25425b8d0c0da64f348357d7bf3e2ec2aa5a8ad..fe10da1a271e867966c2635e0ae1c4f5280a8f8f 100644 (file)
@@ -150,6 +150,7 @@ unsigned long __bootdata(ident_map_size);
 struct physmem_info __bootdata(physmem_info);
 
 unsigned long __bootdata_preserved(__kaslr_offset);
+int __bootdata_preserved(__kaslr_enabled);
 unsigned int __bootdata_preserved(zlib_dfltcc_support);
 EXPORT_SYMBOL(zlib_dfltcc_support);
 u64 __bootdata_preserved(stfle_fac_list[16]);
@@ -380,39 +381,27 @@ void stack_free(unsigned long stack)
 #endif
 }
 
-int __init arch_early_irq_init(void)
+void __init __noreturn arch_call_rest_init(void)
 {
-       unsigned long stack;
-
-       stack = __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER);
-       if (!stack)
-               panic("Couldn't allocate async stack");
-       S390_lowcore.async_stack = stack + STACK_INIT_OFFSET;
-       return 0;
+       smp_reinit_ipl_cpu();
+       rest_init();
 }
 
-void __init arch_call_rest_init(void)
+static unsigned long __init stack_alloc_early(void)
 {
        unsigned long stack;
 
-       smp_reinit_ipl_cpu();
-       stack = stack_alloc();
-       if (!stack)
-               panic("Couldn't allocate kernel stack");
-       current->stack = (void *) stack;
-#ifdef CONFIG_VMAP_STACK
-       current->stack_vm_area = (void *) stack;
-#endif
-       set_task_stack_end_magic(current);
-       stack += STACK_INIT_OFFSET;
-       S390_lowcore.kernel_stack = stack;
-       call_on_stack_noreturn(rest_init, stack);
+       stack = (unsigned long)memblock_alloc(THREAD_SIZE, THREAD_SIZE);
+       if (!stack) {
+               panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
+                     __func__, THREAD_SIZE, THREAD_SIZE);
+       }
+       return stack;
 }
 
 static void __init setup_lowcore(void)
 {
        struct lowcore *lc, *abs_lc;
-       unsigned long mcck_stack;
 
        /*
         * Setup lowcore for boot cpu
@@ -436,8 +425,6 @@ static void __init setup_lowcore(void)
        lc->io_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_MCHECK;
        lc->io_new_psw.addr = (unsigned long) io_int_handler;
        lc->clock_comparator = clock_comparator_max;
-       lc->nodat_stack = ((unsigned long) &init_thread_union)
-               + THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
        lc->current_task = (unsigned long)&init_task;
        lc->lpp = LPP_MAGIC;
        lc->machine_flags = S390_lowcore.machine_flags;
@@ -450,17 +437,15 @@ static void __init setup_lowcore(void)
        lc->steal_timer = S390_lowcore.steal_timer;
        lc->last_update_timer = S390_lowcore.last_update_timer;
        lc->last_update_clock = S390_lowcore.last_update_clock;
-
        /*
         * Allocate the global restart stack which is the same for
-        * all CPUs in cast *one* of them does a PSW restart.
+        * all CPUs in case *one* of them does a PSW restart.
         */
-       restart_stack = memblock_alloc(THREAD_SIZE, THREAD_SIZE);
-       if (!restart_stack)
-               panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
-                     __func__, THREAD_SIZE, THREAD_SIZE);
-       restart_stack += STACK_INIT_OFFSET;
-
+       restart_stack = (void *)(stack_alloc_early() + STACK_INIT_OFFSET);
+       lc->mcck_stack = stack_alloc_early() + STACK_INIT_OFFSET;
+       lc->async_stack = stack_alloc_early() + STACK_INIT_OFFSET;
+       lc->nodat_stack = stack_alloc_early() + STACK_INIT_OFFSET;
+       lc->kernel_stack = S390_lowcore.kernel_stack;
        /*
         * Set up PSW restart to call ipl.c:do_restart(). Copy the relevant
         * restart data to the absolute zero lowcore. This is necessary if
@@ -471,13 +456,6 @@ static void __init setup_lowcore(void)
        lc->restart_data = 0;
        lc->restart_source = -1U;
        __ctl_store(lc->cregs_save_area, 0, 15);
-
-       mcck_stack = (unsigned long)memblock_alloc(THREAD_SIZE, THREAD_SIZE);
-       if (!mcck_stack)
-               panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
-                     __func__, THREAD_SIZE, THREAD_SIZE);
-       lc->mcck_stack = mcck_stack + STACK_INIT_OFFSET;
-
        lc->spinlock_lockval = arch_spin_lockval(0);
        lc->spinlock_index = 0;
        arch_spin_lock_setup(0);