kernel: make the kernel 3.18 patches apply and boot on arm.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> SVN-Revision: 43095v19.07.3_mercusys_ac12_duma
parent
cea2b5299b
commit
a76ee3b1d5
@ -1,160 +1,105 @@
|
|||||||
MIPS: allow disabling the kernel FPU emulator
|
From: Manuel Lauss <manuel.lauss@gmail.com>
|
||||||
|
Subject: [RFC PATCH v4 2/2] MIPS: make FPU emulator optional
|
||||||
|
Date: Mon, 7 Apr 2014 12:57:04 +0200
|
||||||
|
Message-Id: <1396868224-252888-2-git-send-email-manuel.lauss@gmail.com>
|
||||||
|
|
||||||
This patch allows turning off the in-kernel Algorithmics
|
This small patch makes the MIPS FPU emulator optional. The kernel
|
||||||
FPU emulator support, which allows one to save a couple of
|
kills float-users on systems without a hardware FPU by sending a SIGILL.
|
||||||
precious blocks on an embedded system.
|
|
||||||
|
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(-)
|
||||||
|
|
||||||
Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
|
||||||
--
|
|
||||||
--- a/arch/mips/Kconfig
|
--- a/arch/mips/Kconfig
|
||||||
+++ b/arch/mips/Kconfig
|
+++ b/arch/mips/Kconfig
|
||||||
@@ -934,6 +934,17 @@ config I8259
|
@@ -2484,6 +2484,20 @@ config MIPS_O32_FP64_SUPPORT
|
||||||
config MIPS_BONITO64
|
|
||||||
bool
|
If unsure, say N.
|
||||||
|
|
||||||
+config MIPS_FPU_EMU
|
+config MIPS_FPU_EMULATOR
|
||||||
+ bool "Enable FPU emulation"
|
+ bool "MIPS FPU Emulator"
|
||||||
+ default y
|
+ default y
|
||||||
+ help
|
+ help
|
||||||
+ This option allows building a kernel with or without the Algorithmics
|
+ This option lets you disable the built-in MIPS FPU (Coprocessor 1)
|
||||||
+ FPU emulator enabled. Turning off this option results in a kernel which
|
+ emulator, which handles floating-point instructions on processors
|
||||||
+ does not catch floating operations exceptions. Make sure that your toolchain
|
+ without a hardware FPU. It is generally a good idea to keep the
|
||||||
+ is configured to enable software floating point emulation in that case.
|
+ 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.
|
||||||
+
|
+
|
||||||
+ If unsure say Y here.
|
+ Say Y, please.
|
||||||
+
|
+
|
||||||
config MIPS_MSC
|
config USE_OF
|
||||||
bool
|
bool
|
||||||
|
select OF
|
||||||
|
--- a/arch/mips/Makefile
|
||||||
|
+++ b/arch/mips/Makefile
|
||||||
|
@@ -266,7 +266,7 @@ OBJCOPYFLAGS += --remove-section=.regin
|
||||||
|
head-y := arch/mips/kernel/head.o
|
||||||
|
|
||||||
--- a/arch/mips/math-emu/Makefile
|
libs-y += arch/mips/lib/
|
||||||
+++ b/arch/mips/math-emu/Makefile
|
-libs-y += arch/mips/math-emu/
|
||||||
@@ -2,10 +2,12 @@
|
+libs-$(CONFIG_MIPS_FPU_EMULATOR) += arch/mips/math-emu/
|
||||||
# Makefile for the Linux/MIPS kernel FPU emulation.
|
|
||||||
#
|
|
||||||
|
|
||||||
-obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
|
# See arch/mips/Kbuild for content of core part of the kernel
|
||||||
+obj-y := kernel_linkage.o
|
core-y += arch/mips/
|
||||||
+
|
--- a/arch/mips/include/asm/fpu.h
|
||||||
+obj-$(CONFIG_MIPS_FPU_EMU) += ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
|
+++ b/arch/mips/include/asm/fpu.h
|
||||||
ieee754xcpt.o dp_frexp.o dp_modf.o dp_div.o dp_mul.o dp_sub.o \
|
@@ -168,8 +168,10 @@ static inline int init_fpu(void)
|
||||||
dp_add.o dp_fsp.o dp_cmp.o dp_logb.o dp_scalb.o dp_simple.o \
|
ret = __own_fpu();
|
||||||
dp_tint.o dp_fint.o dp_tlong.o dp_flong.o sp_frexp.o sp_modf.o \
|
if (!ret)
|
||||||
sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_logb.o \
|
_init_fpu();
|
||||||
sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \
|
- } else
|
||||||
- dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o
|
+ } else if (IS_ENABLED(CONFIG_MIPS_FPU_EMULATOR))
|
||||||
+ dp_sqrt.o sp_sqrt.o dsemul.o cp1emu.o
|
fpu_emulator_init_fpu();
|
||||||
--- a/arch/mips/math-emu/kernel_linkage.c
|
+ else
|
||||||
+++ b/arch/mips/math-emu/kernel_linkage.c
|
+ ret = SIGILL;
|
||||||
@@ -29,6 +29,7 @@
|
|
||||||
|
|
||||||
#define SIGNALLING_NAN 0x7ff800007ff80000LL
|
return ret;
|
||||||
|
|
||||||
+#ifdef CONFIG_MIPS_FPU_EMU
|
|
||||||
void fpu_emulator_init_fpu(void)
|
|
||||||
{
|
|
||||||
static int first = 1;
|
|
||||||
@@ -115,3 +116,36 @@ int fpu_emulator_restore_context32(struc
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
+
|
|
||||||
+#else
|
|
||||||
+
|
|
||||||
+void fpu_emulator_init_fpu(void)
|
|
||||||
+{
|
|
||||||
+ printk(KERN_INFO "FPU emulator disabled, make sure your toolchain"
|
|
||||||
+ "was compiled with software floating point support (soft-float)\n");
|
|
||||||
+ return;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int fpu_emulator_save_context(struct sigcontext __user *sc)
|
|
||||||
+{
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int fpu_emulator_restore_context(struct sigcontext __user *sc)
|
|
||||||
+{
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#ifdef CONFIG_64BIT
|
|
||||||
+int fpu_emulator_save_context32(struct sigcontext32 __user *sc)
|
|
||||||
+{
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int fpu_emulator_restore_context32(struct sigcontext32 __user *sc)
|
|
||||||
+{
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+#endif /* CONFIG_64BIT */
|
|
||||||
+
|
|
||||||
+#endif /* CONFIG_MIPS_FPU_EMU */
|
|
||||||
--- a/arch/mips/include/asm/fpu_emulator.h
|
--- a/arch/mips/include/asm/fpu_emulator.h
|
||||||
+++ b/arch/mips/include/asm/fpu_emulator.h
|
+++ b/arch/mips/include/asm/fpu_emulator.h
|
||||||
@@ -27,6 +27,8 @@
|
@@ -30,6 +30,7 @@
|
||||||
#include <asm/inst.h>
|
|
||||||
#include <asm/local.h>
|
#include <asm/local.h>
|
||||||
|
#include <asm/processor.h>
|
||||||
|
|
||||||
+#ifdef CONFIG_MIPS_FPU_EMU
|
+#ifdef CONFIG_MIPS_FPU_EMULATOR
|
||||||
+
|
|
||||||
#ifdef CONFIG_DEBUG_FS
|
#ifdef CONFIG_DEBUG_FS
|
||||||
|
|
||||||
struct mips_fpu_emulator_stats {
|
struct mips_fpu_emulator_stats {
|
||||||
@@ -60,6 +62,38 @@ extern int fpu_emulator_cop1Handler(stru
|
@@ -65,6 +66,20 @@ extern int do_dsemulret(struct pt_regs *
|
||||||
int process_fpemu_return(int sig, void __user *fault_addr);
|
extern int fpu_emulator_cop1Handler(struct pt_regs *xcp,
|
||||||
int mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
|
struct mips_fpu_struct *ctx, int has_fpu,
|
||||||
unsigned long *contpc);
|
void *__user *fault_addr);
|
||||||
+#else
|
+#else /* no CONFIG_MIPS_FPU_EMULATOR */
|
||||||
+static inline int mips_dsemul(struct pt_regs *regs, mips_instruction ir,
|
|
||||||
+ unsigned long cpc)
|
|
||||||
+{
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static inline int do_dsemulret(struct pt_regs *xcp)
|
+static inline int do_dsemulret(struct pt_regs *xcp)
|
||||||
+{
|
+{
|
||||||
+ return 0;
|
+ return 0; /* 0 means error, should never get here anyway */
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static inline int fpu_emulator_cop1Handler(struct pt_regs *xcp,
|
+static inline int fpu_emulator_cop1Handler(struct pt_regs *xcp,
|
||||||
+ struct mips_fpu_struct *ctx,
|
+ struct mips_fpu_struct *ctx, int has_fpu,
|
||||||
+ int has_fpu,
|
+ void *__user *fault_addr)
|
||||||
+ void *__user *fault_addr)
|
|
||||||
+{
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static inline int process_fpemu_return(int sig, void __user *fault_addr)
|
|
||||||
+{
|
+{
|
||||||
+ return -EINVAL;
|
+ return SIGILL; /* we don't speak MIPS FPU */
|
||||||
+}
|
+}
|
||||||
|
+#endif /* CONFIG_MIPS_FPU_EMULATOR */
|
||||||
+
|
+
|
||||||
+static inline int mm_isBranchInstr(struct pt_regs *regs,
|
int process_fpemu_return(int sig, void __user *fault_addr);
|
||||||
+ struct mm_decoded_insn dec_insn,
|
int mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
|
||||||
+ unsigned long *contpc)
|
unsigned long *contpc);
|
||||||
+{
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+#endif /* CONFIG_MIPS_FPU_EMU */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Instruction inserted following the badinst to further tag the sequence
|
|
||||||
--- a/arch/mips/kernel/traps.c
|
|
||||||
+++ b/arch/mips/kernel/traps.c
|
|
||||||
@@ -701,6 +701,7 @@ asmlinkage void do_ov(struct pt_regs *re
|
|
||||||
exception_exit(prev_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
+#ifdef CONFIG_MIPS_FPU_EMU
|
|
||||||
int process_fpemu_return(int sig, void __user *fault_addr)
|
|
||||||
{
|
|
||||||
if (sig == SIGSEGV || sig == SIGBUS) {
|
|
||||||
@@ -724,6 +725,7 @@ int process_fpemu_return(int sig, void _
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+#endif /* CONFIG_MIPS_FPU_EMU */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XXX Delayed fp exceptions when doing a lazy ctx switch XXX
|
|
||||||
|
@ -1,122 +0,0 @@
|
|||||||
From 90bea5a3f0bf680b87b90516f3c231997f4b8f3b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Daniel Golle <daniel@makrotopia.org>
|
|
||||||
Date: Mon, 2 Jun 2014 15:51:10 +0200
|
|
||||||
X-Git-Url: http://git.infradead.org/linux-ubifs.git/commitdiff_plain/90bea5a3f0bf680b87b90516f3c231997f4b8f3b
|
|
||||||
X-Git-Url: https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=90bea5a3f0bf680b87b90516f3c231997f4b8f3b
|
|
||||||
Subject: UBIFS: respect MS_SILENT mount flag
|
|
||||||
|
|
||||||
When attempting to mount a non-ubifs formatted volume, lots of error
|
|
||||||
messages (including a stack dump) are thrown to the kernel log even if
|
|
||||||
the MS_SILENT mount flag is set.
|
|
||||||
Fix this by introducing adding an additional state-variable in
|
|
||||||
struct ubifs_info and suppress error messages in ubifs_read_node if
|
|
||||||
MS_SILENT is set.
|
|
||||||
|
|
||||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
||||||
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
|
||||||
---
|
|
||||||
fs/ubifs/io.c | 18 ++++++++++--------
|
|
||||||
fs/ubifs/super.c | 5 +++++
|
|
||||||
fs/ubifs/ubifs.h | 11 +++++++++++
|
|
||||||
3 files changed, 26 insertions(+), 8 deletions(-)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
--- a/fs/ubifs/io.c
|
|
||||||
+++ b/fs/ubifs/io.c
|
|
||||||
@@ -988,30 +988,32 @@ int ubifs_read_node(const struct ubifs_i
|
|
||||||
return err;
|
|
||||||
|
|
||||||
if (type != ch->node_type) {
|
|
||||||
- ubifs_err("bad node type (%d but expected %d)",
|
|
||||||
- ch->node_type, type);
|
|
||||||
+ ubifs_errc(c, "bad node type (%d but expected %d)",
|
|
||||||
+ ch->node_type, type);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = ubifs_check_node(c, buf, lnum, offs, 0, 0);
|
|
||||||
if (err) {
|
|
||||||
- ubifs_err("expected node type %d", type);
|
|
||||||
+ ubifs_errc(c, "expected node type %d", type);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
l = le32_to_cpu(ch->len);
|
|
||||||
if (l != len) {
|
|
||||||
- ubifs_err("bad node length %d, expected %d", l, len);
|
|
||||||
+ ubifs_errc(c, "bad node length %d, expected %d", l, len);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
out:
|
|
||||||
- ubifs_err("bad node at LEB %d:%d, LEB mapping status %d", lnum, offs,
|
|
||||||
- ubi_is_mapped(c->ubi, lnum));
|
|
||||||
- ubifs_dump_node(c, buf);
|
|
||||||
- dump_stack();
|
|
||||||
+ ubifs_errc(c, "bad node at LEB %d:%d, LEB mapping status %d", lnum,
|
|
||||||
+ offs, ubi_is_mapped(c->ubi, lnum));
|
|
||||||
+ if (!c->probing) {
|
|
||||||
+ ubifs_dump_node(c, buf);
|
|
||||||
+ dump_stack();
|
|
||||||
+ }
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
--- a/fs/ubifs/super.c
|
|
||||||
+++ b/fs/ubifs/super.c
|
|
||||||
@@ -1149,6 +1149,9 @@ static int mount_ubifs(struct ubifs_info
|
|
||||||
size_t sz;
|
|
||||||
|
|
||||||
c->ro_mount = !!(c->vfs_sb->s_flags & MS_RDONLY);
|
|
||||||
+ /* Suppress error messages while probing if MS_SILENT is set */
|
|
||||||
+ c->probing = !!(c->vfs_sb->s_flags & MS_SILENT);
|
|
||||||
+
|
|
||||||
err = init_constants_early(c);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
@@ -1214,6 +1217,8 @@ static int mount_ubifs(struct ubifs_info
|
|
||||||
if (err)
|
|
||||||
goto out_free;
|
|
||||||
|
|
||||||
+ c->probing = 0;
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* Make sure the compressor which is set as default in the superblock
|
|
||||||
* or overridden by mount options is actually compiled in.
|
|
||||||
--- a/fs/ubifs/ubifs.h
|
|
||||||
+++ b/fs/ubifs/ubifs.h
|
|
||||||
@@ -51,6 +51,15 @@
|
|
||||||
#define ubifs_warn(fmt, ...) \
|
|
||||||
pr_warn("UBIFS warning (pid %d): %s: " fmt "\n", \
|
|
||||||
current->pid, __func__, ##__VA_ARGS__)
|
|
||||||
+/*
|
|
||||||
+ * A variant of 'ubifs_err()' which takes the UBIFS file-sytem description
|
|
||||||
+ * object as an argument.
|
|
||||||
+ */
|
|
||||||
+#define ubifs_errc(c, fmt, ...) \
|
|
||||||
+ do { \
|
|
||||||
+ if (!(c)->probing) \
|
|
||||||
+ ubifs_err(fmt, ##__VA_ARGS__); \
|
|
||||||
+ } while (0)
|
|
||||||
|
|
||||||
/* UBIFS file system VFS magic number */
|
|
||||||
#define UBIFS_SUPER_MAGIC 0x24051905
|
|
||||||
@@ -1209,6 +1218,7 @@ struct ubifs_debug_info;
|
|
||||||
* @need_recovery: %1 if the file-system needs recovery
|
|
||||||
* @replaying: %1 during journal replay
|
|
||||||
* @mounting: %1 while mounting
|
|
||||||
+ * @probing: %1 while attempting to mount if MS_SILENT mount flag is set
|
|
||||||
* @remounting_rw: %1 while re-mounting from R/O mode to R/W mode
|
|
||||||
* @replay_list: temporary list used during journal replay
|
|
||||||
* @replay_buds: list of buds to replay
|
|
||||||
@@ -1441,6 +1451,7 @@ struct ubifs_info {
|
|
||||||
unsigned int replaying:1;
|
|
||||||
unsigned int mounting:1;
|
|
||||||
unsigned int remounting_rw:1;
|
|
||||||
+ unsigned int probing:1;
|
|
||||||
struct list_head replay_list;
|
|
||||||
struct list_head replay_buds;
|
|
||||||
unsigned long long cs_sqnum;
|
|
Loading…
Reference in New Issue