summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Camus <noamca@mellanox.com>2017-06-13 10:03:45 -0400
committerVineet Gupta <vgupta@synopsys.com>2017-08-28 18:17:36 -0400
commit983394959f5edff6b39bcd10317badaaf33efa99 (patch)
tree40493ca158134c5f1a553e9f1985dd64e69b3b60
parent644fa02b392e25d7592951da2b2b64b4d533d1be (diff)
ARC: [plat-eznps] Handle user memory error same in simulation and silicon
On ARC700 (and nSIM), user mode memory error triggers an L2 interrupt which is handled gracefully by kernel (or it tries to despite this being imprecise, and error could get charged to kernel itself). The offending task is killed and kernel moves on. NPS hardware however raises a Machine Check exception for same error which is NOT recoverable by kernel. This patch aligns kernel handling for nSIM case, to same as hardware by overriding the default user space bus error handler. Signed-off-by: Noam Camus <noamca@mellanox.com> Signed-off-by: Elad Kanfi <eladkan@mellanox.com> [vgupta: rewrote changelog] Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r--arch/arc/kernel/traps.c2
-rw-r--r--arch/arc/plat-eznps/Kconfig11
-rw-r--r--arch/arc/plat-eznps/mtm.c9
3 files changed, 21 insertions, 1 deletions
diff --git a/arch/arc/kernel/traps.c b/arch/arc/kernel/traps.c
index ff83e78d0cfb..62675b94fccd 100644
--- a/arch/arc/kernel/traps.c
+++ b/arch/arc/kernel/traps.c
@@ -80,7 +80,7 @@ int name(unsigned long address, struct pt_regs *regs) \
80DO_ERROR_INFO(SIGILL, "Priv Op/Disabled Extn", do_privilege_fault, ILL_PRVOPC) 80DO_ERROR_INFO(SIGILL, "Priv Op/Disabled Extn", do_privilege_fault, ILL_PRVOPC)
81DO_ERROR_INFO(SIGILL, "Invalid Extn Insn", do_extension_fault, ILL_ILLOPC) 81DO_ERROR_INFO(SIGILL, "Invalid Extn Insn", do_extension_fault, ILL_ILLOPC)
82DO_ERROR_INFO(SIGILL, "Illegal Insn (or Seq)", insterror_is_error, ILL_ILLOPC) 82DO_ERROR_INFO(SIGILL, "Illegal Insn (or Seq)", insterror_is_error, ILL_ILLOPC)
83DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", do_memory_error, BUS_ADRERR) 83DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", __weak do_memory_error, BUS_ADRERR)
84DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT) 84DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT)
85DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_misaligned_error, BUS_ADRALN) 85DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_misaligned_error, BUS_ADRALN)
86 86
diff --git a/arch/arc/plat-eznps/Kconfig b/arch/arc/plat-eznps/Kconfig
index feaa47141cdb..b36afb1feaba 100644
--- a/arch/arc/plat-eznps/Kconfig
+++ b/arch/arc/plat-eznps/Kconfig
@@ -32,3 +32,14 @@ config EZNPS_MTM_EXT
32 any of them seem like CPU from Linux point of view. 32 any of them seem like CPU from Linux point of view.
33 All threads within same core share the execution unit of the 33 All threads within same core share the execution unit of the
34 core and HW scheduler round robin between them. 34 core and HW scheduler round robin between them.
35
36config EZNPS_MEM_ERROR_ALIGN
37 bool "ARC-EZchip Memory error as an exception"
38 depends on EZNPS_MTM_EXT
39 default n
40 help
41 On the real chip of the NPS, user memory errors are handled
42 as a machine check exception, which is fatal, whereas on
43 simulator platform for NPS, is handled as a Level 2 interrupt
44 (just a stock ARC700) which is recoverable. This option makes
45 simulator behave like hardware.
diff --git a/arch/arc/plat-eznps/mtm.c b/arch/arc/plat-eznps/mtm.c
index e0cb36b03d2e..dcbf8f6ebf74 100644
--- a/arch/arc/plat-eznps/mtm.c
+++ b/arch/arc/plat-eznps/mtm.c
@@ -25,6 +25,15 @@
25#define MT_CTRL_ST_CNT 0xF 25#define MT_CTRL_ST_CNT 0xF
26#define NPS_NUM_HW_THREADS 0x10 26#define NPS_NUM_HW_THREADS 0x10
27 27
28#ifdef CONFIG_EZNPS_MEM_ERROR_ALIGN
29int do_memory_error(unsigned long address, struct pt_regs *regs)
30{
31 die("Invalid Mem Access", regs, address);
32
33 return 1;
34}
35#endif
36
28static void mtm_init_nat(int cpu) 37static void mtm_init_nat(int cpu)
29{ 38{
30 struct nps_host_reg_mtm_cfg mtm_cfg; 39 struct nps_host_reg_mtm_cfg mtm_cfg;