summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2017-05-31 16:19:49 +0100
committerBen Hutchings <ben@decadent.org.uk>2017-10-12 15:27:54 +0100
commit0210302574d9ec879a3b7b18365f8fd872ec9636 (patch)
tree6e0c76b3668da04e6ea8e12cbd04be4875c22a6b
parentd4a279c79daf827b751e532935594227bfd9181d (diff)
downloadlinux-stable-0210302574d9ec879a3b7b18365f8fd872ec9636.tar.gz
linux-stable-0210302574d9ec879a3b7b18365f8fd872ec9636.tar.bz2
linux-stable-0210302574d9ec879a3b7b18365f8fd872ec9636.zip
MIPS: Fix mips_atomic_set() with EVA
commit 4915e1b043d6286928207b1f6968197b50407294 upstream. EVA linked loads (LLE) and conditional stores (SCE) should be used on EVA kernels for the MIPS_ATOMIC_SET operation of the sysmips system call, or else the atomic set will apply to the kernel view of the virtual address space (potentially unmapped on EVA kernels) rather than the user view (TLB mapped). Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/16151/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--arch/mips/kernel/syscall.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 56c562ddcfc7..1c864e20156f 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -28,6 +28,7 @@
#include <linux/elf.h>
#include <asm/asm.h>
+#include <asm/asm-eva.h>
#include <asm/branch.h>
#include <asm/cachectl.h>
#include <asm/cacheflush.h>
@@ -137,9 +138,11 @@ static inline int mips_atomic_set(unsigned long addr, unsigned long new)
__asm__ __volatile__ (
" .set arch=r4000 \n"
" li %[err], 0 \n"
- "1: ll %[old], (%[addr]) \n"
+ "1: \n"
+ user_ll("%[old]", "(%[addr])")
" move %[tmp], %[new] \n"
- "2: sc %[tmp], (%[addr]) \n"
+ "2: \n"
+ user_sc("%[tmp]", "(%[addr])")
" beqz %[tmp], 4f \n"
"3: \n"
" .subsection 2 \n"