aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2015-10-30 15:52:51 -0400
committerVineet Gupta <vgupta@synopsys.com>2015-11-14 02:42:20 -0500
commit541366da6a93f52f468b408ba24ab6bb5e4fd3d8 (patch)
treeed6db5d9c9272f7f5f5da71b50725304177e092e
parent76a8c40c65a2fc9e526fcba97c0cd1a6ecbd3438 (diff)
ARC: [arcompact] Handle bus error from userspace as Interrupt not exception
Bus errors from userspace on ARCompact based cores are handled by core as a high priority L2 interrupt but current code treated it as interrupt Handling an interrupt like exception is certainly not going to go unnoticed. (and it worked so far as we never saw a Bus error from userspace until IPPK guys tested a DDR controller with ECC error detection etc hence needed to explicitly trigger/handle such errors) - So move mem_service exception handler from common code into ARCv2 code. - In ARCompact code, define mem_service as L2 interrupt handler which just drops down to pure kernel mode and goes of to enqueue SIGBUS Reported-by: Nelson Pereira <npereira@synopsys.com> Tested-by: Ana Martins <amartins@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r--arch/arc/kernel/entry-arcv2.S19
-rw-r--r--arch/arc/kernel/entry-compact.S29
-rw-r--r--arch/arc/kernel/entry.S17
3 files changed, 44 insertions, 21 deletions
diff --git a/arch/arc/kernel/entry-arcv2.S b/arch/arc/kernel/entry-arcv2.S
index 445e63a10754..cbfec79137bf 100644
--- a/arch/arc/kernel/entry-arcv2.S
+++ b/arch/arc/kernel/entry-arcv2.S
@@ -91,6 +91,25 @@ ENTRY(EV_DCError)
91 flag 1 91 flag 1
92END(EV_DCError) 92END(EV_DCError)
93 93
94; ---------------------------------------------
95; Memory Error Exception Handler
96; - Unlike ARCompact, handles Bus errors for both User/Kernel mode,
97; Instruction fetch or Data access, under a single Exception Vector
98; ---------------------------------------------
99
100ENTRY(mem_service)
101
102 EXCEPTION_PROLOGUE
103
104 lr r0, [efa]
105 mov r1, sp
106
107 FAKE_RET_FROM_EXCPN
108
109 bl do_memory_error
110 b ret_from_exception
111END(mem_service)
112
94ENTRY(EV_Misaligned) 113ENTRY(EV_Misaligned)
95 114
96 EXCEPTION_PROLOGUE 115 EXCEPTION_PROLOGUE
diff --git a/arch/arc/kernel/entry-compact.S b/arch/arc/kernel/entry-compact.S
index 59f52035b4ea..431433929189 100644
--- a/arch/arc/kernel/entry-compact.S
+++ b/arch/arc/kernel/entry-compact.S
@@ -142,16 +142,12 @@ int1_saved_reg:
142 .zero 4 142 .zero 4
143 143
144/* Each Interrupt level needs its own scratch */ 144/* Each Interrupt level needs its own scratch */
145#ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS
146
147ARCFP_DATA int2_saved_reg 145ARCFP_DATA int2_saved_reg
148 .type int2_saved_reg, @object 146 .type int2_saved_reg, @object
149 .size int2_saved_reg, 4 147 .size int2_saved_reg, 4
150int2_saved_reg: 148int2_saved_reg:
151 .zero 4 149 .zero 4
152 150
153#endif
154
155; --------------------------------------------- 151; ---------------------------------------------
156 .section .text, "ax",@progbits 152 .section .text, "ax",@progbits
157 153
@@ -216,6 +212,31 @@ END(handle_interrupt_level2)
216#endif 212#endif
217 213
218; --------------------------------------------- 214; ---------------------------------------------
215; User Mode Memory Bus Error Interrupt Handler
216; (Kernel mode memory errors handled via seperate exception vectors)
217; ---------------------------------------------
218ENTRY(mem_service)
219
220 INTERRUPT_PROLOGUE 2
221
222 mov r0, ilink2
223 mov r1, sp
224
225 ; User process needs to be killed with SIGBUS, but first need to get
226 ; out of the L2 interrupt context (drop to pure kernel mode) and jump
227 ; off to "C" code where SIGBUS in enqueued
228 lr r3, [status32]
229 bclr r3, r3, STATUS_A2_BIT
230 or r3, r3, (STATUS_E1_MASK|STATUS_E2_MASK)
231 sr r3, [status32_l2]
232 mov ilink2, 1f
233 rtie
2341:
235 bl do_memory_error
236 b ret_from_exception
237END(mem_service)
238
239; ---------------------------------------------
219; Level 1 ISR 240; Level 1 ISR
220; --------------------------------------------- 241; ---------------------------------------------
221ENTRY(handle_interrupt_level1) 242ENTRY(handle_interrupt_level1)
diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S
index 589abf5172d6..2efb0625331d 100644
--- a/arch/arc/kernel/entry.S
+++ b/arch/arc/kernel/entry.S
@@ -93,23 +93,6 @@ ENTRY(instr_service)
93END(instr_service) 93END(instr_service)
94 94
95; --------------------------------------------- 95; ---------------------------------------------
96; Memory Error Exception Handler
97; ---------------------------------------------
98
99ENTRY(mem_service)
100
101 EXCEPTION_PROLOGUE
102
103 lr r0, [efa]
104 mov r1, sp
105
106 FAKE_RET_FROM_EXCPN
107
108 bl do_memory_error
109 b ret_from_exception
110END(mem_service)
111
112; ---------------------------------------------
113; Machine Check Exception Handler 96; Machine Check Exception Handler
114; --------------------------------------------- 97; ---------------------------------------------
115 98