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>
This commit is contained in:
Vineet Gupta 2015-10-31 01:22:51 +05:30
parent 76a8c40c65
commit 541366da6a
3 changed files with 44 additions and 21 deletions

View File

@ -91,6 +91,25 @@ ENTRY(EV_DCError)
flag 1 flag 1
END(EV_DCError) END(EV_DCError)
; ---------------------------------------------
; Memory Error Exception Handler
; - Unlike ARCompact, handles Bus errors for both User/Kernel mode,
; Instruction fetch or Data access, under a single Exception Vector
; ---------------------------------------------
ENTRY(mem_service)
EXCEPTION_PROLOGUE
lr r0, [efa]
mov r1, sp
FAKE_RET_FROM_EXCPN
bl do_memory_error
b ret_from_exception
END(mem_service)
ENTRY(EV_Misaligned) ENTRY(EV_Misaligned)
EXCEPTION_PROLOGUE EXCEPTION_PROLOGUE

View File

@ -142,16 +142,12 @@ int1_saved_reg:
.zero 4 .zero 4
/* Each Interrupt level needs its own scratch */ /* Each Interrupt level needs its own scratch */
#ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS
ARCFP_DATA int2_saved_reg ARCFP_DATA int2_saved_reg
.type int2_saved_reg, @object .type int2_saved_reg, @object
.size int2_saved_reg, 4 .size int2_saved_reg, 4
int2_saved_reg: int2_saved_reg:
.zero 4 .zero 4
#endif
; --------------------------------------------- ; ---------------------------------------------
.section .text, "ax",@progbits .section .text, "ax",@progbits
@ -215,6 +211,31 @@ END(handle_interrupt_level2)
#endif #endif
; ---------------------------------------------
; User Mode Memory Bus Error Interrupt Handler
; (Kernel mode memory errors handled via seperate exception vectors)
; ---------------------------------------------
ENTRY(mem_service)
INTERRUPT_PROLOGUE 2
mov r0, ilink2
mov r1, sp
; User process needs to be killed with SIGBUS, but first need to get
; out of the L2 interrupt context (drop to pure kernel mode) and jump
; off to "C" code where SIGBUS in enqueued
lr r3, [status32]
bclr r3, r3, STATUS_A2_BIT
or r3, r3, (STATUS_E1_MASK|STATUS_E2_MASK)
sr r3, [status32_l2]
mov ilink2, 1f
rtie
1:
bl do_memory_error
b ret_from_exception
END(mem_service)
; --------------------------------------------- ; ---------------------------------------------
; Level 1 ISR ; Level 1 ISR
; --------------------------------------------- ; ---------------------------------------------

View File

@ -92,23 +92,6 @@ ENTRY(instr_service)
b ret_from_exception b ret_from_exception
END(instr_service) END(instr_service)
; ---------------------------------------------
; Memory Error Exception Handler
; ---------------------------------------------
ENTRY(mem_service)
EXCEPTION_PROLOGUE
lr r0, [efa]
mov r1, sp
FAKE_RET_FROM_EXCPN
bl do_memory_error
b ret_from_exception
END(mem_service)
; --------------------------------------------- ; ---------------------------------------------
; Machine Check Exception Handler ; Machine Check Exception Handler
; --------------------------------------------- ; ---------------------------------------------