Skip to content

Commit 4d9f109

Browse files
James Hogangregkh
authored andcommitted
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent de34c07 commit 4d9f109

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

arch/mips/kernel/syscall.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <linux/elf.h>
2929

3030
#include <asm/asm.h>
31+
#include <asm/asm-eva.h>
3132
#include <asm/branch.h>
3233
#include <asm/cachectl.h>
3334
#include <asm/cacheflush.h>
@@ -138,9 +139,11 @@ static inline int mips_atomic_set(unsigned long addr, unsigned long new)
138139
__asm__ __volatile__ (
139140
" .set "MIPS_ISA_ARCH_LEVEL" \n"
140141
" li %[err], 0 \n"
141-
"1: ll %[old], (%[addr]) \n"
142+
"1: \n"
143+
user_ll("%[old]", "(%[addr])")
142144
" move %[tmp], %[new] \n"
143-
"2: sc %[tmp], (%[addr]) \n"
145+
"2: \n"
146+
user_sc("%[tmp]", "(%[addr])")
144147
" beqz %[tmp], 4f \n"
145148
"3: \n"
146149
" .insn \n"

0 commit comments

Comments
 (0)