]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ARC: [plat-eznps] Handle user memory error same in simulation and silicon
authorNoam Camus <noamca@mellanox.com>
Tue, 13 Jun 2017 14:03:45 +0000 (17:03 +0300)
committerVineet Gupta <vgupta@synopsys.com>
Mon, 28 Aug 2017 22:17:36 +0000 (15:17 -0700)
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>
arch/arc/kernel/traps.c
arch/arc/plat-eznps/Kconfig
arch/arc/plat-eznps/mtm.c

index ff83e78d0cfb5583eb44e874c0fd290cdeb24926..62675b94fccd08700dabd1aa21e7e04be014ad20 100644 (file)
@@ -80,7 +80,7 @@ int name(unsigned long address, struct pt_regs *regs) \
 DO_ERROR_INFO(SIGILL, "Priv Op/Disabled Extn", do_privilege_fault, ILL_PRVOPC)
 DO_ERROR_INFO(SIGILL, "Invalid Extn Insn", do_extension_fault, ILL_ILLOPC)
 DO_ERROR_INFO(SIGILL, "Illegal Insn (or Seq)", insterror_is_error, ILL_ILLOPC)
-DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", do_memory_error, BUS_ADRERR)
+DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", __weak do_memory_error, BUS_ADRERR)
 DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT)
 DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_misaligned_error, BUS_ADRALN)
 
index feaa47141cdb3ad5404ff2d594789e6450bf583f..b36afb1feabae86e9234f050fdceb050789bb3ae 100644 (file)
@@ -32,3 +32,14 @@ config EZNPS_MTM_EXT
          any of them seem like CPU from Linux point of view.
          All threads within same core share the execution unit of the
          core and HW scheduler round robin between them.
+
+config EZNPS_MEM_ERROR_ALIGN
+       bool "ARC-EZchip Memory error as an exception"
+       depends on EZNPS_MTM_EXT
+       default n
+       help
+         On the real chip of the NPS, user memory errors are handled
+         as a machine check exception, which is fatal, whereas on
+         simulator platform for NPS, is handled as a Level 2 interrupt
+         (just a stock ARC700) which is recoverable. This option makes
+         simulator behave like hardware.
index e0cb36b03d2e42d391d548223933ffdf5efbdbdc..dcbf8f6ebf747d2076133490968af215cea12b91 100644 (file)
 #define MT_CTRL_ST_CNT         0xF
 #define NPS_NUM_HW_THREADS     0x10
 
+#ifdef CONFIG_EZNPS_MEM_ERROR_ALIGN
+int do_memory_error(unsigned long address, struct pt_regs *regs)
+{
+       die("Invalid Mem Access", regs, address);
+
+       return 1;
+}
+#endif
+
 static void mtm_init_nat(int cpu)
 {
        struct nps_host_reg_mtm_cfg mtm_cfg;