s390/fpu: split fpu-internal.h into fpu internals, api, and type headers
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Tue, 6 Oct 2015 10:25:59 +0000 (12:25 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 16 Oct 2015 07:41:12 +0000 (09:41 +0200)
Split the API and FPU type definitions into separate header files
similar to "x86/fpu: Rename fpu-internal.h to fpu/internal.h" (78f7f1e54b).

The new header files and their meaning are:

asm/fpu/types.h:
FPU related data types, needed for 'struct thread_struct' and
'struct task_struct'.

asm/fpu/api.h:
FPU related 'public' functions for other subsystems and device
drivers.

asm/fpu/internal.h:
FPU internal functions mainly used to convert
FPU register contents in signal handling.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/fpu-internal.h [deleted file]
arch/s390/include/asm/fpu/api.h [new file with mode: 0644]
arch/s390/include/asm/fpu/internal.h [new file with mode: 0644]
arch/s390/include/asm/fpu/types.h [new file with mode: 0644]
arch/s390/include/asm/kvm_host.h
arch/s390/include/asm/processor.h
arch/s390/include/asm/switch_to.h
arch/s390/kernel/nmi.c
arch/s390/kernel/s390_ksyms.c
arch/s390/kernel/traps.c

diff --git a/arch/s390/include/asm/fpu-internal.h b/arch/s390/include/asm/fpu-internal.h
deleted file mode 100644 (file)
index cd79a33..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * General floating pointer and vector register helpers
- *
- * Copyright IBM Corp. 2015
- * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
- */
-
-#ifndef _ASM_S390_FPU_INTERNAL_H
-#define _ASM_S390_FPU_INTERNAL_H
-
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <asm/linkage.h>
-#include <asm/ctl_reg.h>
-#include <asm/sigcontext.h>
-
-struct fpu {
-       __u32 fpc;                      /* Floating-point control */
-       union {
-               void *regs;
-               freg_t *fprs;           /* Floating-point register save area */
-               __vector128 *vxrs;      /* Vector register save area */
-       };
-};
-
-void save_fpu_regs(void);
-
-/* VX array structure for address operand constraints in inline assemblies */
-struct vx_array { __vector128 _[__NUM_VXRS]; };
-
-static inline int test_fp_ctl(u32 fpc)
-{
-       u32 orig_fpc;
-       int rc;
-
-       asm volatile(
-               "       efpc    %1\n"
-               "       sfpc    %2\n"
-               "0:     sfpc    %1\n"
-               "       la      %0,0\n"
-               "1:\n"
-               EX_TABLE(0b,1b)
-               : "=d" (rc), "=d" (orig_fpc)
-               : "d" (fpc), "0" (-EINVAL));
-       return rc;
-}
-
-static inline void save_vx_regs_safe(__vector128 *vxrs)
-{
-       unsigned long cr0, flags;
-
-       flags = arch_local_irq_save();
-       __ctl_store(cr0, 0, 0);
-       __ctl_set_bit(0, 17);
-       __ctl_set_bit(0, 18);
-       asm volatile(
-               "       la      1,%0\n"
-               "       .word   0xe70f,0x1000,0x003e\n" /* vstm 0,15,0(1) */
-               "       .word   0xe70f,0x1100,0x0c3e\n" /* vstm 16,31,256(1) */
-               : "=Q" (*(struct vx_array *) vxrs) : : "1");
-       __ctl_load(cr0, 0, 0);
-       arch_local_irq_restore(flags);
-}
-
-static inline void convert_vx_to_fp(freg_t *fprs, __vector128 *vxrs)
-{
-       int i;
-
-       for (i = 0; i < __NUM_FPRS; i++)
-               fprs[i] = *(freg_t *)(vxrs + i);
-}
-
-static inline void convert_fp_to_vx(__vector128 *vxrs, freg_t *fprs)
-{
-       int i;
-
-       for (i = 0; i < __NUM_FPRS; i++)
-               *(freg_t *)(vxrs + i) = fprs[i];
-}
-
-static inline void fpregs_store(_s390_fp_regs *fpregs, struct fpu *fpu)
-{
-       fpregs->pad = 0;
-       if (MACHINE_HAS_VX)
-               convert_vx_to_fp((freg_t *)&fpregs->fprs, fpu->vxrs);
-       else
-               memcpy((freg_t *)&fpregs->fprs, fpu->fprs,
-                      sizeof(fpregs->fprs));
-}
-
-static inline void fpregs_load(_s390_fp_regs *fpregs, struct fpu *fpu)
-{
-       if (MACHINE_HAS_VX)
-               convert_fp_to_vx(fpu->vxrs, (freg_t *)&fpregs->fprs);
-       else
-               memcpy(fpu->fprs, (freg_t *)&fpregs->fprs,
-                      sizeof(fpregs->fprs));
-}
-
-#endif /* _ASM_S390_FPU_INTERNAL_H */
diff --git a/arch/s390/include/asm/fpu/api.h b/arch/s390/include/asm/fpu/api.h
new file mode 100644 (file)
index 0000000..5e04f3c
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * In-kernel FPU support functions
+ *
+ * Copyright IBM Corp. 2015
+ * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
+ */
+
+#ifndef _ASM_S390_FPU_API_H
+#define _ASM_S390_FPU_API_H
+
+void save_fpu_regs(void);
+
+static inline int test_fp_ctl(u32 fpc)
+{
+       u32 orig_fpc;
+       int rc;
+
+       asm volatile(
+               "       efpc    %1\n"
+               "       sfpc    %2\n"
+               "0:     sfpc    %1\n"
+               "       la      %0,0\n"
+               "1:\n"
+               EX_TABLE(0b,1b)
+               : "=d" (rc), "=d" (orig_fpc)
+               : "d" (fpc), "0" (-EINVAL));
+       return rc;
+}
+
+#endif /* _ASM_S390_FPU_API_H */
diff --git a/arch/s390/include/asm/fpu/internal.h b/arch/s390/include/asm/fpu/internal.h
new file mode 100644 (file)
index 0000000..2559b16
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * FPU state and register content conversion primitives
+ *
+ * Copyright IBM Corp. 2015
+ * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
+ */
+
+#ifndef _ASM_S390_FPU_INTERNAL_H
+#define _ASM_S390_FPU_INTERNAL_H
+
+#include <linux/string.h>
+#include <asm/ctl_reg.h>
+#include <asm/fpu/types.h>
+
+static inline void save_vx_regs_safe(__vector128 *vxrs)
+{
+       unsigned long cr0, flags;
+
+       flags = arch_local_irq_save();
+       __ctl_store(cr0, 0, 0);
+       __ctl_set_bit(0, 17);
+       __ctl_set_bit(0, 18);
+       asm volatile(
+               "       la      1,%0\n"
+               "       .word   0xe70f,0x1000,0x003e\n" /* vstm 0,15,0(1) */
+               "       .word   0xe70f,0x1100,0x0c3e\n" /* vstm 16,31,256(1) */
+               : "=Q" (*(struct vx_array *) vxrs) : : "1");
+       __ctl_load(cr0, 0, 0);
+       arch_local_irq_restore(flags);
+}
+
+static inline void convert_vx_to_fp(freg_t *fprs, __vector128 *vxrs)
+{
+       int i;
+
+       for (i = 0; i < __NUM_FPRS; i++)
+               fprs[i] = *(freg_t *)(vxrs + i);
+}
+
+static inline void convert_fp_to_vx(__vector128 *vxrs, freg_t *fprs)
+{
+       int i;
+
+       for (i = 0; i < __NUM_FPRS; i++)
+               *(freg_t *)(vxrs + i) = fprs[i];
+}
+
+static inline void fpregs_store(_s390_fp_regs *fpregs, struct fpu *fpu)
+{
+       fpregs->pad = 0;
+       if (MACHINE_HAS_VX)
+               convert_vx_to_fp((freg_t *)&fpregs->fprs, fpu->vxrs);
+       else
+               memcpy((freg_t *)&fpregs->fprs, fpu->fprs,
+                      sizeof(fpregs->fprs));
+}
+
+static inline void fpregs_load(_s390_fp_regs *fpregs, struct fpu *fpu)
+{
+       if (MACHINE_HAS_VX)
+               convert_fp_to_vx(fpu->vxrs, (freg_t *)&fpregs->fprs);
+       else
+               memcpy(fpu->fprs, (freg_t *)&fpregs->fprs,
+                      sizeof(fpregs->fprs));
+}
+
+#endif /* _ASM_S390_FPU_INTERNAL_H */
diff --git a/arch/s390/include/asm/fpu/types.h b/arch/s390/include/asm/fpu/types.h
new file mode 100644 (file)
index 0000000..14a8b0c
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * FPU data structures
+ *
+ * Copyright IBM Corp. 2015
+ * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
+ */
+
+#ifndef _ASM_S390_FPU_TYPES_H
+#define _ASM_S390_FPU_TYPES_H
+
+#include <asm/sigcontext.h>
+
+struct fpu {
+       __u32 fpc;                      /* Floating-point control */
+       union {
+               void *regs;
+               freg_t *fprs;           /* Floating-point register save area */
+               __vector128 *vxrs;      /* Vector register save area */
+       };
+};
+
+/* VX array structure for address operand constraints in inline assemblies */
+struct vx_array { __vector128 _[__NUM_VXRS]; };
+
+#endif /* _ASM_S390_FPU_TYPES_H */
index 8ced426091e10106bcc675c85d291943b130d72a..7f654308817cdf06527b94ecfaa61a65533e862a 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/kvm.h>
 #include <asm/debug.h>
 #include <asm/cpu.h>
-#include <asm/fpu-internal.h>
+#include <asm/fpu/api.h>
 #include <asm/isc.h>
 
 #define KVM_MAX_VCPUS 64
index 43ff624f75102735d86f4bd7f0a65232efbd9ac1..a83015e17f39394cf3cb78f538f4437e3a5de63a 100644 (file)
@@ -16,7 +16,7 @@
 #define CIF_MCCK_PENDING       0       /* machine check handling is pending */
 #define CIF_ASCE               1       /* user asce needs fixup / uaccess */
 #define CIF_NOHZ_DELAY         2       /* delay HZ disable for a tick */
-#define CIF_FPU                        3       /* restore vector registers */
+#define CIF_FPU                        3       /* restore FPU registers */
 #define CIF_IGNORE_IRQ         4       /* ignore interrupt (for udelay) */
 
 #define _CIF_MCCK_PENDING      _BITUL(CIF_MCCK_PENDING)
@@ -34,7 +34,8 @@
 #include <asm/ptrace.h>
 #include <asm/setup.h>
 #include <asm/runtime_instr.h>
-#include <asm/fpu-internal.h>
+#include <asm/fpu/types.h>
+#include <asm/fpu/internal.h>
 
 static inline void set_cpu_flag(int flag)
 {
index dcadfde32265ad705a3899ef1584f858ae3af704..12d45f0cfdd931e3d8049c4333b1f359e3539443 100644 (file)
@@ -8,7 +8,7 @@
 #define __ASM_SWITCH_TO_H
 
 #include <linux/thread_info.h>
-#include <asm/fpu-internal.h>
+#include <asm/fpu/api.h>
 #include <asm/ptrace.h>
 
 extern struct task_struct *__switch_to(void *, void *);
index 4082885dd4fb0282af3b13599be1e0d2019d8832..faa40bf622f8d2fb597f1cafb2c6b1c2e6ed0c74 100644 (file)
@@ -21,7 +21,6 @@
 #include <asm/nmi.h>
 #include <asm/crw.h>
 #include <asm/switch_to.h>
-#include <asm/fpu-internal.h>
 #include <asm/ctl_reg.h>
 
 struct mcck_struct {
index d9325b760596c385c52917bd52d4a724f497ede4..e67453b73c3c7b069104016e8b631762cfea9169 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/module.h>
 #include <linux/kvm_host.h>
-#include <asm/fpu-internal.h>
+#include <asm/fpu/api.h>
 #include <asm/ftrace.h>
 
 #ifdef CONFIG_FUNCTION_TRACER
index d9c45318f19b3f2fadaa53f6ec292be2caee5b0e..1b18118bbc06bbe58f846343198dc84fb5ec04b5 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
-#include <asm/fpu-internal.h>
+#include <asm/fpu/api.h>
 #include "entry.h"
 
 int show_unhandled_signals = 1;