These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / arch / s390 / kernel / traps.c
index 4d96c9f..1b18118 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
-#include <asm/switch_to.h>
+#include <asm/fpu/api.h>
 #include "entry.h"
 
 int show_unhandled_signals = 1;
@@ -151,7 +151,7 @@ DO_ERROR_INFO(special_op_exception, SIGILL, ILL_ILLOPN,
 DO_ERROR_INFO(transaction_exception, SIGILL, ILL_ILLOPN,
              "transaction constraint exception")
 
-static inline void do_fp_trap(struct pt_regs *regs, int fpc)
+static inline void do_fp_trap(struct pt_regs *regs, __u32 fpc)
 {
        int si_code = 0;
        /* FPC[2] is Data Exception Code */
@@ -224,31 +224,6 @@ NOKPROBE_SYMBOL(illegal_op);
 DO_ERROR_INFO(specification_exception, SIGILL, ILL_ILLOPN,
              "specification exception");
 
-int alloc_vector_registers(struct task_struct *tsk)
-{
-       __vector128 *vxrs;
-       int i;
-
-       /* Allocate vector register save area. */
-       vxrs = kzalloc(sizeof(__vector128) * __NUM_VXRS,
-                      GFP_KERNEL|__GFP_REPEAT);
-       if (!vxrs)
-               return -ENOMEM;
-       preempt_disable();
-       if (tsk == current)
-               save_fp_regs(tsk->thread.fp_regs.fprs);
-       /* Copy the 16 floating point registers */
-       for (i = 0; i < 16; i++)
-               *(freg_t *) &vxrs[i] = tsk->thread.fp_regs.fprs[i];
-       tsk->thread.vxrs = vxrs;
-       if (tsk == current) {
-               __ctl_set_bit(0, 17);
-               restore_vx_regs(vxrs);
-       }
-       preempt_enable();
-       return 0;
-}
-
 void vector_exception(struct pt_regs *regs)
 {
        int si_code, vic;
@@ -259,8 +234,8 @@ void vector_exception(struct pt_regs *regs)
        }
 
        /* get vector interrupt code from fpc */
-       asm volatile("stfpc %0" : "=m" (current->thread.fp_regs.fpc));
-       vic = (current->thread.fp_regs.fpc & 0xf00) >> 8;
+       save_fpu_regs();
+       vic = (current->thread.fpu.fpc & 0xf00) >> 8;
        switch (vic) {
        case 1: /* invalid vector operation */
                si_code = FPE_FLTINV;
@@ -283,13 +258,6 @@ void vector_exception(struct pt_regs *regs)
        do_trap(regs, SIGFPE, si_code, "vector exception");
 }
 
-static int __init disable_vector_extension(char *str)
-{
-       S390_lowcore.machine_flags &= ~MACHINE_FLAG_VX;
-       return 1;
-}
-__setup("novx", disable_vector_extension);
-
 void data_exception(struct pt_regs *regs)
 {
        __u16 __user *location;
@@ -297,22 +265,13 @@ void data_exception(struct pt_regs *regs)
 
        location = get_trap_ip(regs);
 
-       asm volatile("stfpc %0" : "=m" (current->thread.fp_regs.fpc));
-       /* Check for vector register enablement */
-       if (MACHINE_HAS_VX && !current->thread.vxrs &&
-           (current->thread.fp_regs.fpc & FPC_DXC_MASK) == 0xfe00) {
-               alloc_vector_registers(current);
-               /* Vector data exception is suppressing, rewind psw. */
-               regs->psw.addr = __rewind_psw(regs->psw, regs->int_code >> 16);
-               clear_pt_regs_flag(regs, PIF_PER_TRAP);
-               return;
-       }
-       if (current->thread.fp_regs.fpc & FPC_DXC_MASK)
+       save_fpu_regs();
+       if (current->thread.fpu.fpc & FPC_DXC_MASK)
                signal = SIGFPE;
        else
                signal = SIGILL;
        if (signal == SIGFPE)
-               do_fp_trap(regs, current->thread.fp_regs.fpc);
+               do_fp_trap(regs, current->thread.fpu.fpc);
        else if (signal)
                do_trap(regs, signal, ILL_ILLOPN, "data exception");
 }