s390/fpu: add static FPU save area for init_task
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Tue, 29 Sep 2015 15:53:22 +0000 (17:53 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 14 Oct 2015 12:32:08 +0000 (14:32 +0200)
Previously, the init task did not have an allocated FPU save area and
saving an FPU state was not possible.  Now if the vector extension is
always enabled, provide a static FPU save area to save FPU states of
vector instructions that can be executed quite early.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/processor.h
arch/s390/kernel/entry.S
arch/s390/kernel/process.c

index 085fb0d3c54e944e2f846a2188136f7f729bef72..5900877bb19cbf8858892d226b68a7f10138af63 100644 (file)
@@ -139,8 +139,10 @@ struct stack_frame {
 
 #define ARCH_MIN_TASKALIGN     8
 
+extern __vector128 init_task_fpu_regs[__NUM_VXRS];
 #define INIT_THREAD {                                                  \
        .ksp = sizeof(init_stack) + (unsigned long) &init_stack,        \
+       .fpu.regs = (void *)&init_task_fpu_regs,                        \
 }
 
 /*
index b78babf9a417d602bafc1fc04c1edf45f9e5c1f2..3f23185c9173c6b318634714d480f5768c5e8f5c 100644 (file)
@@ -762,8 +762,6 @@ ENTRY(save_fpu_regs)
        stfpc   __THREAD_FPU_fpc(%r2)
 .Lsave_fpu_regs_fpc_end:
        lg      %r3,__THREAD_FPU_regs(%r2)
-       ltgr    %r3,%r3
-       jz      .Lsave_fpu_regs_done      # no save area -> set CIF_FPU
        tm      __LC_MACHINE_FLAGS+5,4    # MACHINE_HAS_VX
        jz      .Lsave_fpu_regs_fp        # no -> store FP regs
 .Lsave_fpu_regs_vx_low:
@@ -1193,8 +1191,6 @@ cleanup_critical:
        stfpc   __THREAD_FPU_fpc(%r2)
 1:     # Load register save area and check if VX is active
        lg      %r3,__THREAD_FPU_regs(%r2)
-       ltgr    %r3,%r3
-       jz      5f                        # no save area -> set CIF_FPU
        tm      __LC_MACHINE_FLAGS+5,4    # MACHINE_HAS_VX
        jz      4f                        # no VX -> store FP regs
 2:     # Store vector registers (V0-V15)
index b63787156a19aeff9e0ebdbf3a23591f9325abee..cd5568608744fbe14dfd6d2a6f74684367da565f 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/kprobes.h>
 #include <linux/random.h>
 #include <linux/module.h>
+#include <linux/init_task.h>
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <asm/vtimer.h>
@@ -36,6 +37,9 @@
 
 asmlinkage void ret_from_fork(void) asm ("ret_from_fork");
 
+/* FPU save area for the init task */
+__vector128 init_task_fpu_regs[__NUM_VXRS] __init_task_data;
+
 /*
  * Return saved PC of a blocked thread. used in kernel/sched.
  * resume in entry.S does not create a new stack frame, it