MIPS: asm: local: add barriers for Loongson
authorWang Xuerui <git@xen0n.name>
Thu, 23 Jan 2020 04:04:09 +0000 (12:04 +0800)
committerPaul Burton <paulburton@kernel.org>
Thu, 23 Jan 2020 18:21:53 +0000 (10:21 -0800)
Somehow these LL/SC usages are not taken care of, breaking Loongson
builds. Add the SYNCs appropriately.

Signed-off-by: Wang Xuerui <git@xen0n.name>
Signed-off-by: Paul Burton <paulburton@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: <stable@vger.kernel.org> # v5.5+
arch/mips/include/asm/local.h

index 02783e141c321d981a3e1a0b39a9152c18fbd0fd..fef0fda8f82fe8d94bdb999621e651044c53f22f 100644 (file)
@@ -37,6 +37,7 @@ static __inline__ long local_add_return(long i, local_t * l)
                __asm__ __volatile__(
                "       .set    push                                    \n"
                "       .set    arch=r4000                              \n"
+                       __SYNC(full, loongson3_war) "                   \n"
                "1:"    __LL    "%1, %2         # local_add_return      \n"
                "       addu    %0, %1, %3                              \n"
                        __SC    "%0, %2                                 \n"
@@ -52,6 +53,7 @@ static __inline__ long local_add_return(long i, local_t * l)
                __asm__ __volatile__(
                "       .set    push                                    \n"
                "       .set    "MIPS_ISA_ARCH_LEVEL"                   \n"
+                       __SYNC(full, loongson3_war) "                   \n"
                "1:"    __LL    "%1, %2         # local_add_return      \n"
                "       addu    %0, %1, %3                              \n"
                        __SC    "%0, %2                                 \n"
@@ -84,6 +86,7 @@ static __inline__ long local_sub_return(long i, local_t * l)
                __asm__ __volatile__(
                "       .set    push                                    \n"
                "       .set    arch=r4000                              \n"
+                       __SYNC(full, loongson3_war) "                   \n"
                "1:"    __LL    "%1, %2         # local_sub_return      \n"
                "       subu    %0, %1, %3                              \n"
                        __SC    "%0, %2                                 \n"
@@ -99,6 +102,7 @@ static __inline__ long local_sub_return(long i, local_t * l)
                __asm__ __volatile__(
                "       .set    push                                    \n"
                "       .set    "MIPS_ISA_ARCH_LEVEL"                   \n"
+                       __SYNC(full, loongson3_war) "                   \n"
                "1:"    __LL    "%1, %2         # local_sub_return      \n"
                "       subu    %0, %1, %3                              \n"
                        __SC    "%0, %2                                 \n"