]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.46/arc-handle-unaligned-access-delay-slot-corner-case.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.4.46 / arc-handle-unaligned-access-delay-slot-corner-case.patch
1 From 9aed02feae57bf7a40cb04ea0e3017cb7a998db4 Mon Sep 17 00:00:00 2001
2 From: Vineet Gupta <vgupta@synopsys.com>
3 Date: Fri, 27 Jan 2017 10:45:27 -0800
4 Subject: ARC: [arcompact] handle unaligned access delay slot corner case
5
6 From: Vineet Gupta <vgupta@synopsys.com>
7
8 commit 9aed02feae57bf7a40cb04ea0e3017cb7a998db4 upstream.
9
10 After emulating an unaligned access in delay slot of a branch, we
11 pretend as the delay slot never happened - so return back to actual
12 branch target (or next PC if branch was not taken).
13
14 Curently we did this by handling STATUS32.DE, we also need to clear the
15 BTA.T bit, which is disregarded when returning from original misaligned
16 exception, but could cause weirdness if it took the interrupt return
17 path (in case interrupt was acive too)
18
19 One ARC700 customer ran into this when enabling unaligned access fixup
20 for kernel mode accesses as well
21
22 Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25 ---
26 arch/arc/kernel/unaligned.c | 3 ++-
27 1 file changed, 2 insertions(+), 1 deletion(-)
28
29 --- a/arch/arc/kernel/unaligned.c
30 +++ b/arch/arc/kernel/unaligned.c
31 @@ -241,8 +241,9 @@ int misaligned_fixup(unsigned long addre
32 if (state.fault)
33 goto fault;
34
35 + /* clear any remanants of delay slot */
36 if (delay_mode(regs)) {
37 - regs->ret = regs->bta;
38 + regs->ret = regs->bta ~1U;
39 regs->status32 &= ~STATUS_DE_MASK;
40 } else {
41 regs->ret += state.instr_len;