kernel: switch 3.19 from -rc5 to release .0
[openwrt.git] / target / linux / generic / patches-3.19 / 304-mips_disable_fpu.patch
1 --- a/arch/mips/Kconfig
2 +++ b/arch/mips/Kconfig
3 @@ -2521,6 +2521,20 @@ config MIPS_O32_FP64_SUPPORT
4  
5           If unsure, say N.
6  
7 +config MIPS_FPU_EMULATOR
8 +       bool "MIPS FPU Emulator"
9 +       default y
10 +       help
11 +         This option lets you disable the built-in MIPS FPU (Coprocessor 1)
12 +         emulator, which handles floating-point instructions on processors
13 +         without a hardware FPU.  It is generally a good idea to keep the
14 +         emulator built-in, unless you are perfectly sure you have a
15 +         complete soft-float environment.  With the emulator disabled, all
16 +         users of float operations will be killed with an illegal instr-
17 +         uction exception.
18 +
19 +         Say Y, please.
20 +
21  config USE_OF
22         bool
23         select OF
24 --- a/arch/mips/Makefile
25 +++ b/arch/mips/Makefile
26 @@ -275,7 +275,7 @@ OBJCOPYFLAGS                += --remove-section=.regin
27  head-y := arch/mips/kernel/head.o
28  
29  libs-y                 += arch/mips/lib/
30 -libs-y                 += arch/mips/math-emu/
31 +libs-$(CONFIG_MIPS_FPU_EMULATOR)       += arch/mips/math-emu/
32  
33  # See arch/mips/Kbuild for content of core part of the kernel
34  core-y += arch/mips/
35 --- a/arch/mips/include/asm/fpu.h
36 +++ b/arch/mips/include/asm/fpu.h
37 @@ -210,8 +210,10 @@ static inline int init_fpu(void)
38                 /* Restore FRE */
39                 write_c0_config5(config5);
40                 enable_fpu_hazard();
41 -       } else
42 +       } else (IS_ENABLED(CONFIG_MIPS_FPU_EMULATOR))
43                 fpu_emulator_init_fpu();
44 +       else
45 +               ret = SIGILL;
46  
47         return ret;
48  }
49 --- a/arch/mips/include/asm/fpu_emulator.h
50 +++ b/arch/mips/include/asm/fpu_emulator.h
51 @@ -30,6 +30,7 @@
52  #include <asm/local.h>
53  #include <asm/processor.h>
54  
55 +#ifdef CONFIG_MIPS_FPU_EMULATOR
56  #ifdef CONFIG_DEBUG_FS
57  
58  struct mips_fpu_emulator_stats {
59 @@ -65,6 +66,20 @@ extern int do_dsemulret(struct pt_regs *
60  extern int fpu_emulator_cop1Handler(struct pt_regs *xcp,
61                                     struct mips_fpu_struct *ctx, int has_fpu,
62                                     void *__user *fault_addr);
63 +#else  /* no CONFIG_MIPS_FPU_EMULATOR */
64 +static inline int do_dsemulret(struct pt_regs *xcp)
65 +{
66 +       return 0;       /* 0 means error, should never get here anyway */
67 +}
68 +
69 +static inline int fpu_emulator_cop1Handler(struct pt_regs *xcp,
70 +                               struct mips_fpu_struct *ctx, int has_fpu,
71 +                               void *__user *fault_addr)
72 +{
73 +       return SIGILL;  /* we don't speak MIPS FPU */
74 +}
75 +#endif /* CONFIG_MIPS_FPU_EMULATOR */
76 +
77  int process_fpemu_return(int sig, void __user *fault_addr);
78  int mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
79                      unsigned long *contpc);