x86/fpu: Rename i387.h to fpu/api.h
authorIngo Molnar <mingo@kernel.org>
Fri, 24 Apr 2015 00:46:00 +0000 (02:46 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 19 May 2015 13:47:30 +0000 (15:47 +0200)
We already have fpu/types.h, move i387.h to fpu/api.h.

The file name has become a misnomer anyway: it offers generic FPU APIs,
but is not limited to i387 functionality.

Reviewed-by: Borislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
31 files changed:
arch/x86/crypto/aesni-intel_glue.c
arch/x86/crypto/crc32-pclmul_glue.c
arch/x86/crypto/crct10dif-pclmul_glue.c
arch/x86/crypto/fpu.c
arch/x86/crypto/ghash-clmulni-intel_glue.c
arch/x86/crypto/sha1_ssse3_glue.c
arch/x86/crypto/sha256_ssse3_glue.c
arch/x86/crypto/sha512_ssse3_glue.c
arch/x86/crypto/twofish_avx_glue.c
arch/x86/include/asm/crypto/glue_helper.h
arch/x86/include/asm/efi.h
arch/x86/include/asm/fpu-internal.h
arch/x86/include/asm/fpu/api.h [new file with mode: 0644]
arch/x86/include/asm/i387.h [deleted file]
arch/x86/include/asm/simd.h
arch/x86/include/asm/suspend_32.h
arch/x86/include/asm/suspend_64.h
arch/x86/include/asm/xor.h
arch/x86/include/asm/xor_32.h
arch/x86/include/asm/xor_avx.h
arch/x86/kernel/cpu/bugs.c
arch/x86/kernel/fpu/xsave.c
arch/x86/kvm/vmx.c
arch/x86/lguest/boot.c
arch/x86/lib/mmx_32.c
arch/x86/math-emu/fpu_entry.c
drivers/char/hw_random/via-rng.c
drivers/crypto/padlock-aes.c
drivers/crypto/padlock-sha.c
drivers/lguest/x86/core.c
lib/raid6/x86.h

index 112cefacf2af07b216cb598232bcc586a76fa919..b419f43ce0c589ce934195b77296760dc300830c 100644 (file)
@@ -32,7 +32,7 @@
 #include <crypto/lrw.h>
 #include <crypto/xts.h>
 #include <asm/cpu_device_id.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/crypto/aes.h>
 #include <crypto/ablk_helper.h>
 #include <crypto/scatterwalk.h>
index 1937fc1d876338aa0aa9bb5fddea9e0aa3541707..07d2c6c86a5483216684970489fcba3b4478007d 100644 (file)
@@ -35,7 +35,7 @@
 
 #include <asm/cpufeature.h>
 #include <asm/cpu_device_id.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 
 #define CHKSUM_BLOCK_SIZE      1
 #define CHKSUM_DIGEST_SIZE     4
index b6c67bf30fdf6704f6d83b093ee73ae7d9b77fcf..a3fcfc97a311d5b660e0dcda3be489038f231dce 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/init.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/cpufeature.h>
 #include <asm/cpu_device_id.h>
 
index f368ba261739fa09be28bc02fe34cf3112099fa8..5a2f30f9f52dca78820b67cef7c025c53aa0b735 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/crypto.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 
 struct crypto_fpu_ctx {
        struct crypto_blkcipher *child;
index 2079baf06bdd3b64e7f61ec3fecf088c4bd8bc24..64d7cf1b50e112ab370ac63e59e9ff89d4d677e0 100644 (file)
@@ -19,7 +19,7 @@
 #include <crypto/cryptd.h>
 #include <crypto/gf128mul.h>
 #include <crypto/internal/hash.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/cpu_device_id.h>
 
 #define GHASH_BLOCK_SIZE       16
index 33d1b9dc14cc751203ba72af1585f6685558b7fc..cb3bf19dca5a3262c74ae98ac36709e49e12c20d 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/types.h>
 #include <crypto/sha.h>
 #include <crypto/sha1_base.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/xcr.h>
 #include <asm/xsave.h>
 
index ccc338881ee81886b6de43963df23d179d510b22..9eaf7abaf4dc8744096efb25c18690965dc0a411 100644 (file)
@@ -37,7 +37,7 @@
 #include <linux/types.h>
 #include <crypto/sha.h>
 #include <crypto/sha256_base.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/xcr.h>
 #include <asm/xsave.h>
 #include <linux/string.h>
index d9fa4c1e063ff631cc09e168c6c6747527edf334..e0d6a67f567d235ebf63ec065f00c681d264ffbd 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/types.h>
 #include <crypto/sha.h>
 #include <crypto/sha512_base.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/xcr.h>
 #include <asm/xsave.h>
 
index b5e2d56518517010e6869d592aa505450965e36f..1a66e6110f4bd909193b76c025ddd9107f29ea86 100644 (file)
@@ -36,7 +36,7 @@
 #include <crypto/ctr.h>
 #include <crypto/lrw.h>
 #include <crypto/xts.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/xcr.h>
 #include <asm/xsave.h>
 #include <asm/crypto/twofish.h>
index 1eef55596e82cade6ecc0e910488a6fcc9e0b74a..03bb1065c3352826843a305b15399751a5c860ae 100644 (file)
@@ -7,7 +7,7 @@
 
 #include <linux/kernel.h>
 #include <linux/crypto.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <crypto/b128ops.h>
 
 typedef void (*common_glue_func_t)(void *ctx, u8 *dst, const u8 *src);
index 3738b138b843d46467c75a910d916cc79ebad25f..155162ea0e00292b619cc2a02ff8b2f31fafd02b 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _ASM_X86_EFI_H
 #define _ASM_X86_EFI_H
 
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/pgtable.h>
 
 /*
index 21ad681794548b47e8e5bf186cf12bfee5252143..d68b349b424777def239b8661354bd43aa3558aa 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/slab.h>
 
 #include <asm/user.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/xsave.h>
 
 #ifdef CONFIG_X86_64
diff --git a/arch/x86/include/asm/fpu/api.h b/arch/x86/include/asm/fpu/api.h
new file mode 100644 (file)
index 0000000..9d3a6f3
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 1994 Linus Torvalds
+ *
+ * Pentium III FXSR, SSE support
+ * General FPU state handling cleanups
+ *     Gareth Hughes <gareth@valinux.com>, May 2000
+ * x86-64 work by Andi Kleen 2002
+ */
+
+#ifndef _ASM_X86_FPU_API_H
+#define _ASM_X86_FPU_API_H
+
+#ifndef __ASSEMBLY__
+
+#include <linux/sched.h>
+#include <linux/hardirq.h>
+
+struct pt_regs;
+struct user_i387_struct;
+
+extern int fpstate_alloc_init(struct fpu *fpu);
+extern void fpstate_init(struct fpu *fpu);
+extern void fpu__clear(struct task_struct *tsk);
+
+extern int dump_fpu(struct pt_regs *, struct user_i387_struct *);
+extern void fpu__restore(void);
+extern void fpu__init_check_bugs(void);
+
+extern bool irq_fpu_usable(void);
+
+/*
+ * Careful: __kernel_fpu_begin/end() must be called with preempt disabled
+ * and they don't touch the preempt state on their own.
+ * If you enable preemption after __kernel_fpu_begin(), preempt notifier
+ * should call the __kernel_fpu_end() to prevent the kernel/user FPU
+ * state from getting corrupted. KVM for example uses this model.
+ *
+ * All other cases use kernel_fpu_begin/end() which disable preemption
+ * during kernel FPU usage.
+ */
+extern void __kernel_fpu_begin(void);
+extern void __kernel_fpu_end(void);
+
+static inline void kernel_fpu_begin(void)
+{
+       preempt_disable();
+       WARN_ON_ONCE(!irq_fpu_usable());
+       __kernel_fpu_begin();
+}
+
+static inline void kernel_fpu_end(void)
+{
+       __kernel_fpu_end();
+       preempt_enable();
+}
+
+/*
+ * Some instructions like VIA's padlock instructions generate a spurious
+ * DNA fault but don't modify SSE registers. And these instructions
+ * get used from interrupt context as well. To prevent these kernel instructions
+ * in interrupt context interacting wrongly with other user/kernel fpu usage, we
+ * should use them only in the context of irq_ts_save/restore()
+ */
+static inline int irq_ts_save(void)
+{
+       /*
+        * If in process context and not atomic, we can take a spurious DNA fault.
+        * Otherwise, doing clts() in process context requires disabling preemption
+        * or some heavy lifting like kernel_fpu_begin()
+        */
+       if (!in_atomic())
+               return 0;
+
+       if (read_cr0() & X86_CR0_TS) {
+               clts();
+               return 1;
+       }
+
+       return 0;
+}
+
+static inline void irq_ts_restore(int TS_state)
+{
+       if (TS_state)
+               stts();
+}
+
+/*
+ * The question "does this thread have fpu access?"
+ * is slightly racy, since preemption could come in
+ * and revoke it immediately after the test.
+ *
+ * However, even in that very unlikely scenario,
+ * we can just assume we have FPU access - typically
+ * to save the FP state - we'll just take a #NM
+ * fault and get the FPU access back.
+ */
+static inline int user_has_fpu(void)
+{
+       return current->thread.fpu.has_fpu;
+}
+
+extern void fpu__save(struct fpu *fpu);
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_X86_FPU_API_H */
diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h
deleted file mode 100644 (file)
index b8f7d76..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 1994 Linus Torvalds
- *
- * Pentium III FXSR, SSE support
- * General FPU state handling cleanups
- *     Gareth Hughes <gareth@valinux.com>, May 2000
- * x86-64 work by Andi Kleen 2002
- */
-
-#ifndef _ASM_X86_I387_H
-#define _ASM_X86_I387_H
-
-#ifndef __ASSEMBLY__
-
-#include <linux/sched.h>
-#include <linux/hardirq.h>
-
-struct pt_regs;
-struct user_i387_struct;
-
-extern int fpstate_alloc_init(struct fpu *fpu);
-extern void fpstate_init(struct fpu *fpu);
-extern void fpu__clear(struct task_struct *tsk);
-
-extern int dump_fpu(struct pt_regs *, struct user_i387_struct *);
-extern void fpu__restore(void);
-extern void fpu__init_check_bugs(void);
-
-extern bool irq_fpu_usable(void);
-
-/*
- * Careful: __kernel_fpu_begin/end() must be called with preempt disabled
- * and they don't touch the preempt state on their own.
- * If you enable preemption after __kernel_fpu_begin(), preempt notifier
- * should call the __kernel_fpu_end() to prevent the kernel/user FPU
- * state from getting corrupted. KVM for example uses this model.
- *
- * All other cases use kernel_fpu_begin/end() which disable preemption
- * during kernel FPU usage.
- */
-extern void __kernel_fpu_begin(void);
-extern void __kernel_fpu_end(void);
-
-static inline void kernel_fpu_begin(void)
-{
-       preempt_disable();
-       WARN_ON_ONCE(!irq_fpu_usable());
-       __kernel_fpu_begin();
-}
-
-static inline void kernel_fpu_end(void)
-{
-       __kernel_fpu_end();
-       preempt_enable();
-}
-
-/*
- * Some instructions like VIA's padlock instructions generate a spurious
- * DNA fault but don't modify SSE registers. And these instructions
- * get used from interrupt context as well. To prevent these kernel instructions
- * in interrupt context interacting wrongly with other user/kernel fpu usage, we
- * should use them only in the context of irq_ts_save/restore()
- */
-static inline int irq_ts_save(void)
-{
-       /*
-        * If in process context and not atomic, we can take a spurious DNA fault.
-        * Otherwise, doing clts() in process context requires disabling preemption
-        * or some heavy lifting like kernel_fpu_begin()
-        */
-       if (!in_atomic())
-               return 0;
-
-       if (read_cr0() & X86_CR0_TS) {
-               clts();
-               return 1;
-       }
-
-       return 0;
-}
-
-static inline void irq_ts_restore(int TS_state)
-{
-       if (TS_state)
-               stts();
-}
-
-/*
- * The question "does this thread have fpu access?"
- * is slightly racy, since preemption could come in
- * and revoke it immediately after the test.
- *
- * However, even in that very unlikely scenario,
- * we can just assume we have FPU access - typically
- * to save the FP state - we'll just take a #NM
- * fault and get the FPU access back.
- */
-static inline int user_has_fpu(void)
-{
-       return current->thread.fpu.has_fpu;
-}
-
-extern void fpu__save(struct fpu *fpu);
-
-#endif /* __ASSEMBLY__ */
-
-#endif /* _ASM_X86_I387_H */
index ee80b92f00962a392a824221dbdbeb781b6312bf..6c8a7ed13365ae5dd675fd4b158c8034ba213a29 100644 (file)
@@ -1,5 +1,5 @@
 
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 
 /*
  * may_use_simd - whether it is allowable at this time to issue SIMD
index 552d6c90a6d43dbebbae0756ba10061bc0969e8d..d1793f06854d28f22481c40f03cd2171d7b13495 100644 (file)
@@ -7,7 +7,7 @@
 #define _ASM_X86_SUSPEND_32_H
 
 #include <asm/desc.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 
 /* image of the saved processor state */
 struct saved_context {
index bc6232834babf33973c8a4e6da1ce63cd159dce4..7ebf0ebe4e687f3704cac47b3de3dd1b906d27e8 100644 (file)
@@ -7,7 +7,7 @@
 #define _ASM_X86_SUSPEND_64_H
 
 #include <asm/desc.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 
 /*
  * Image of the saved processor state, used by the low level ACPI suspend to
index d8829751b3f895e9fd19fa6bd597758650f417b8..1f5c5161ead682664dc30fc5dda802de2de0bc4b 100644 (file)
@@ -36,7 +36,7 @@
  * no advantages to be gotten from x86-64 here anyways.
  */
 
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 
 #ifdef CONFIG_X86_32
 /* reduce register pressure */
index ce05722e3c68bce4d72a1bcdc9e798b5014581cf..5a08bc8bff33934e10b4b9afe8e3236ac8c5ce93 100644 (file)
@@ -26,7 +26,7 @@
 #define XO3(x, y)      "       pxor   8*("#x")(%4), %%mm"#y"   ;\n"
 #define XO4(x, y)      "       pxor   8*("#x")(%5), %%mm"#y"   ;\n"
 
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 
 static void
 xor_pII_mmx_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
index 492b29802f571b0363a22fe686f708c8235c317a..7c0a517ec7511a667166c216df8357087ff3e7b0 100644 (file)
@@ -18,7 +18,7 @@
 #ifdef CONFIG_AS_AVX
 
 #include <linux/compiler.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 
 #define BLOCK4(i) \
                BLOCK(32 * i, 0) \
index eb8be0c5823b2dfe9cf670fe7d5d71a0c7305cb9..29dd74318ec6f726b816b4d6b09f30e12fe7f6c6 100644 (file)
@@ -12,7 +12,7 @@
 #include <asm/bugs.h>
 #include <asm/processor.h>
 #include <asm/processor-flags.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/msr.h>
 #include <asm/paravirt.h>
 #include <asm/alternative.h>
index 80b0c8fa50c50c091fc5a63ce72a863808ed5633..8aa3b864a2e07b577c76ee6547e6ef7a2bc4c800 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/bootmem.h>
 #include <linux/compat.h>
 #include <linux/cpu.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/fpu-internal.h>
 #include <asm/sigframe.h>
 #include <asm/tlbflush.h>
index f7b61687bd79facc3f6ed0339b68ecf3fcf43aed..5cb738a18ca337534b40de44802c4c0dd2ffdafb 100644 (file)
@@ -40,7 +40,7 @@
 #include <asm/vmx.h>
 #include <asm/virtext.h>
 #include <asm/mce.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/xcr.h>
 #include <asm/perf_event.h>
 #include <asm/debugreg.h>
index 8f9a133cc09934c2de2fa77a1eecb14ce5f94c06..27f8eea0d6eb0c9798f4c45e18fa8099c452a2a8 100644 (file)
@@ -70,7 +70,7 @@
 #include <asm/e820.h>
 #include <asm/mce.h>
 #include <asm/io.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/stackprotector.h>
 #include <asm/reboot.h>                /* for struct machine_ops */
 #include <asm/kvm_para.h>
index c9f2d9ba8dd8c2da54b0bbd07c37be1d38aa49c4..e5e3ed8dc0798bd007e8573ddbf57dc4e2312049 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/sched.h>
 #include <linux/types.h>
 
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/asm.h>
 
 void *_mmx_memcpy(void *to, const void *from, size_t len)
index e394bcb4275dfac0946d383569729adbf34f6d53..3bb4c6a24ea5060aed6e62f5ee7baa51959a3ed7 100644 (file)
@@ -31,7 +31,7 @@
 #include <asm/traps.h>
 #include <asm/desc.h>
 #include <asm/user.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 
 #include "fpu_system.h"
 #include "fpu_emu.h"
index a3bebef255ad3af669c2134ce85805d0af4b0523..0c98a9d51a2494e6a49ef49e6bfb557cefca1974 100644 (file)
@@ -33,7 +33,7 @@
 #include <asm/io.h>
 #include <asm/msr.h>
 #include <asm/cpufeature.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 
 
 
index c178ed8c3908d3a92e55432aecb86e0e6e1501ee..da2d6777bd092f0a373e14cc960514b8a4f5d148 100644 (file)
@@ -22,7 +22,7 @@
 #include <asm/cpu_device_id.h>
 #include <asm/byteorder.h>
 #include <asm/processor.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 
 /*
  * Number of data blocks actually fetched for each xcrypt insn.
index 95f7d27ce491f000458a257e5dfa55a6105b433b..4e154c9b92064bb1fbafeb805bcb77f9cc2d1bdf 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/kernel.h>
 #include <linux/scatterlist.h>
 #include <asm/cpu_device_id.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 
 struct padlock_sha_desc {
        struct shash_desc fallback;
index bcb534a5512d6b1e5c517b11146e4c3e42765bb8..fce5989e66d91acdbf5528000ec673944763c97d 100644 (file)
@@ -46,7 +46,7 @@
 #include <asm/setup.h>
 #include <asm/lguest.h>
 #include <asm/uaccess.h>
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 #include <asm/tlbflush.h>
 #include "../lg.h"
 
index b7595484a8150c02e086f5d1a3ac41cd971bd91b..8fe9d9662abbcda7563000c00e5f516dc156f05f 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifdef __KERNEL__ /* Real code */
 
-#include <asm/i387.h>
+#include <asm/fpu/api.h>
 
 #else /* Dummy code for user space testing */
 
This page took 0.049503 seconds and 5 git commands to generate.