diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2017-10-29 19:32:10 +0100 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2017-12-16 22:11:19 +0100 |
commit | b3f95490b9bec020314eb32016988ee262d52884 (patch) | |
tree | f8289c19587108bb3b687575776f559eee6f01fd /target/linux/generic/pending-4.14/304-mips_disable_fpu.patch | |
parent | a362df6f253e4460504fd870d6a7af40ef86ad70 (diff) | |
download | upstream-b3f95490b9bec020314eb32016988ee262d52884.tar.gz upstream-b3f95490b9bec020314eb32016988ee262d52884.tar.bz2 upstream-b3f95490b9bec020314eb32016988ee262d52884.zip |
kernel: generic: Add kernel 4.14 support
This adds initial support for kernel 4.14 based on the patches for
kernel 4.9.
In the configuration I deactivated some of the new possible security
features like:
CONFIG_REFCOUNT_FULL
CONFIG_SLAB_FREELIST_HARDENED
CONFIG_SOFTLOCKUP_DETECTOR
CONFIG_WARN_ALL_UNSEEDED_RANDOM
And these overlay FS options are also deactivated:
CONFIG_OVERLAY_FS_INDEX
CONFIG_OVERLAY_FS_REDIRECT_DIR
I activated this:
CONFIG_FORTIFY_SOURCE
CONFIG_POSIX_TIMERS
CONFIG_SLAB_MERGE_DEFAULT
CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED
I am not sure if I did the porting correct for the following patches:
target/linux/generic/backport-4.14/020-backport_netfilter_rtcache.patch
target/linux/generic/hack-4.14/220-gc_sections.patch
target/linux/generic/hack-4.14/321-powerpc_crtsavres_prereq.patch
target/linux/generic/pending-4.14/305-mips_module_reloc.patch
target/linux/generic/pending-4.14/611-netfilter_match_bypass_default_table.patch
target/linux/generic/pending-4.14/680-NET-skip-GRO-for-foreign-MAC-addresses.patch
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'target/linux/generic/pending-4.14/304-mips_disable_fpu.patch')
-rw-r--r-- | target/linux/generic/pending-4.14/304-mips_disable_fpu.patch | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/target/linux/generic/pending-4.14/304-mips_disable_fpu.patch b/target/linux/generic/pending-4.14/304-mips_disable_fpu.patch new file mode 100644 index 0000000000..bee62b2664 --- /dev/null +++ b/target/linux/generic/pending-4.14/304-mips_disable_fpu.patch @@ -0,0 +1,137 @@ +From: Manuel Lauss <manuel.lauss@gmail.com> +Subject: [RFC PATCH v4 2/2] MIPS: make FPU emulator optional + +This small patch makes the MIPS FPU emulator optional. The kernel +kills float-users on systems without a hardware FPU by sending a SIGILL. + +Disabling the emulator shrinks vmlinux by about 54kBytes (32bit, +optimizing for size). + +Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com> +--- +v4: rediffed because of patch 1/2, should now work with micromips as well +v3: updated patch description with size savings. +v2: incorporated changes suggested by Jonas Gorski + force the fpu emulator on for micromips: relocating the parts + of the mmips code in the emulator to other areas would be a + much larger change; I went the cheap route instead with this. + + arch/mips/Kbuild | 2 +- + arch/mips/Kconfig | 14 ++++++++++++++ + arch/mips/include/asm/fpu.h | 5 +++-- + arch/mips/include/asm/fpu_emulator.h | 15 +++++++++++++++ + 4 files changed, 33 insertions(+), 3 deletions(-) + +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -2890,6 +2890,20 @@ config MIPS_O32_FP64_SUPPORT + + If unsure, say N. + ++config MIPS_FPU_EMULATOR ++ bool "MIPS FPU Emulator" ++ default y ++ help ++ This option lets you disable the built-in MIPS FPU (Coprocessor 1) ++ emulator, which handles floating-point instructions on processors ++ without a hardware FPU. It is generally a good idea to keep the ++ emulator built-in, unless you are perfectly sure you have a ++ complete soft-float environment. With the emulator disabled, all ++ users of float operations will be killed with an illegal instr- ++ uction exception. ++ ++ Say Y, please. ++ + config USE_OF + bool + select OF +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile +@@ -319,7 +319,7 @@ OBJCOPYFLAGS += --remove-section=.regin + head-y := arch/mips/kernel/head.o + + libs-y += arch/mips/lib/ +-libs-y += arch/mips/math-emu/ ++libs-$(CONFIG_MIPS_FPU_EMULATOR) += arch/mips/math-emu/ + + # See arch/mips/Kbuild for content of core part of the kernel + core-y += arch/mips/ +--- a/arch/mips/include/asm/fpu.h ++++ b/arch/mips/include/asm/fpu.h +@@ -230,8 +230,10 @@ static inline int init_fpu(void) + /* Restore FRE */ + write_c0_config5(config5); + enable_fpu_hazard(); +- } else ++ } else if (IS_ENABLED(CONFIG_MIPS_FPU_EMULATOR)) + fpu_emulator_init_fpu(); ++ else ++ ret = SIGILL; + + return ret; + } +--- a/arch/mips/include/asm/fpu_emulator.h ++++ b/arch/mips/include/asm/fpu_emulator.h +@@ -30,6 +30,7 @@ + #include <asm/local.h> + #include <asm/processor.h> + ++#ifdef CONFIG_MIPS_FPU_EMULATOR + #ifdef CONFIG_DEBUG_FS + + struct mips_fpu_emulator_stats { +@@ -179,6 +180,16 @@ do { \ + extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, + struct mips_fpu_struct *ctx, int has_fpu, + void __user **fault_addr); ++#else /* no CONFIG_MIPS_FPU_EMULATOR */ ++static inline int fpu_emulator_cop1Handler(struct pt_regs *xcp, ++ struct mips_fpu_struct *ctx, int has_fpu, ++ void __user **fault_addr) ++{ ++ *fault_addr = NULL; ++ return SIGILL; /* we don't speak MIPS FPU */ ++} ++#endif /* CONFIG_MIPS_FPU_EMULATOR */ ++ + void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr, + struct task_struct *tsk); + int process_fpemu_return(int sig, void __user *fault_addr, +--- a/arch/mips/include/asm/dsemul.h ++++ b/arch/mips/include/asm/dsemul.h +@@ -41,6 +41,7 @@ struct task_struct; + extern int mips_dsemul(struct pt_regs *regs, mips_instruction ir, + unsigned long branch_pc, unsigned long cont_pc); + ++#ifdef CONFIG_MIPS_FPU_EMULATOR + /** + * do_dsemulret() - Return from a delay slot 'emulation' frame + * @xcp: User thread register context. +@@ -88,5 +89,27 @@ extern bool dsemul_thread_rollback(struc + * before @mm is freed in order to avoid memory leaks. + */ + extern void dsemul_mm_cleanup(struct mm_struct *mm); ++#else ++static inline bool do_dsemulret(struct pt_regs *xcp) ++{ ++ return false; ++} ++ ++static inline bool dsemul_thread_cleanup(struct task_struct *tsk) ++{ ++ return false; ++} ++ ++static inline bool dsemul_thread_rollback(struct pt_regs *regs) ++{ ++ return false; ++} ++ ++static inline void dsemul_mm_cleanup(struct mm_struct *mm) ++{ ++ ++} ++ ++#endif + + #endif /* __MIPS_ASM_DSEMUL_H__ */ |