Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips/mips Centralise SYNC/BDSYNC in asm.h and intro...



details:   https://anonhg.NetBSD.org/src/rev/6a538ee7f578
branches:  trunk
changeset: 974631:6a538ee7f578
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Aug 06 10:00:20 2020 +0000

description:
Centralise SYNC/BDSYNC in asm.h and introduce a new LLCSCSYNC and use it
before any ll/sc sequences.

Define LLSCSYNC as syncw; syncw for cnMIPS - issue two as early cnMIPS
has errat{um,a} that means the first can fail.

diffstat:

 common/lib/libc/arch/mips/atomic/atomic_add.S  |   8 ++++++--
 common/lib/libc/arch/mips/atomic/atomic_and.S  |   8 ++++++--
 common/lib/libc/arch/mips/atomic/atomic_cas.S  |   6 ++++--
 common/lib/libc/arch/mips/atomic/atomic_dec.S  |   8 ++++++--
 common/lib/libc/arch/mips/atomic/atomic_inc.S  |   8 ++++++--
 common/lib/libc/arch/mips/atomic/atomic_or.S   |   6 +++++-
 common/lib/libc/arch/mips/atomic/atomic_swap.S |   7 ++++---
 sys/arch/mips/include/asm.h                    |  24 +++++++++++++++++++++++-
 sys/arch/mips/mips/lock_stubs_llsc.S           |  25 +++++++++----------------
 9 files changed, 69 insertions(+), 31 deletions(-)

diffs (truncated from 451 to 300 lines):

diff -r bd822d9c77dc -r 6a538ee7f578 common/lib/libc/arch/mips/atomic/atomic_add.S
--- a/common/lib/libc/arch/mips/atomic/atomic_add.S     Thu Aug 06 07:38:54 2020 +0000
+++ b/common/lib/libc/arch/mips/atomic/atomic_add.S     Thu Aug 06 10:00:20 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_add.S,v 1.6 2020/08/01 09:26:49 skrll Exp $     */
+/*     $NetBSD: atomic_add.S,v 1.7 2020/08/06 10:00:21 skrll Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include <machine/asm.h>
 #include "atomic_op_asm.h"
 
-RCSID("$NetBSD: atomic_add.S,v 1.6 2020/08/01 09:26:49 skrll Exp $")
+RCSID("$NetBSD: atomic_add.S,v 1.7 2020/08/06 10:00:21 skrll Exp $")
 
        .text
        .set    noreorder
@@ -49,6 +49,7 @@
 #if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
        saa             a1, (a0)
 #else
+       LLSCSYNC
 1:     INT_LL          t0, 0(a0)
         nop
        INT_ADDU        t0, a1
@@ -62,6 +63,7 @@
 ATOMIC_OP_ALIAS(atomic_add_32, _atomic_add_32)
 
 LEAF(_atomic_add_32_nv)
+       LLSCSYNC
 1:     INT_LL          v0, 0(a0)
         nop
        INT_ADDU        v0, a1
@@ -79,6 +81,7 @@
 #if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
        saad            a1, (a0)
 #else
+       LLSCSYNC
 1:     REG_LL          t0, 0(a0)
         nop
        REG_ADDU        t0, a1
@@ -92,6 +95,7 @@
 ATOMIC_OP_ALIAS(atomic_add_64, _atomic_add_64)
 
 LEAF(_atomic_add_64_nv)
+       LLSCSYNC
 1:     REG_LL          v0, 0(a0)
         nop
        REG_ADDU        v0, a1
diff -r bd822d9c77dc -r 6a538ee7f578 common/lib/libc/arch/mips/atomic/atomic_and.S
--- a/common/lib/libc/arch/mips/atomic/atomic_and.S     Thu Aug 06 07:38:54 2020 +0000
+++ b/common/lib/libc/arch/mips/atomic/atomic_and.S     Thu Aug 06 10:00:20 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_and.S,v 1.5 2020/08/01 09:26:49 skrll Exp $     */
+/*     $NetBSD: atomic_and.S,v 1.6 2020/08/06 10:00:21 skrll Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include <machine/asm.h>
 #include "atomic_op_asm.h"
 
-RCSID("$NetBSD: atomic_and.S,v 1.5 2020/08/01 09:26:49 skrll Exp $")
+RCSID("$NetBSD: atomic_and.S,v 1.6 2020/08/06 10:00:21 skrll Exp $")
 
        .text
        .set    noreorder
@@ -46,6 +46,7 @@
 
 
 LEAF(_atomic_and_32)
+       LLSCSYNC
 1:     INT_LL          t0, 0(a0)
         nop
        and             t0, a1
@@ -58,6 +59,7 @@
 ATOMIC_OP_ALIAS(atomic_and_32, _atomic_and_32)
 
 LEAF(_atomic_and_32_nv)
+       LLSCSYNC
 1:     INT_LL          v0, 0(a0)
         nop
        and             v0, a1
@@ -72,6 +74,7 @@
 
 #if !defined(__mips_o32)
 LEAF(_atomic_and_64)
+       LLSCSYNC
 1:     REG_LL          t0, 0(a0)
         nop
        and             t0, a1
@@ -84,6 +87,7 @@
 ATOMIC_OP_ALIAS(atomic_and_64, _atomic_and_64)
 
 LEAF(_atomic_and_64_nv)
+       LLSCSYNC
 1:     REG_LL          v0, 0(a0)
         nop
        and             v0, a1
diff -r bd822d9c77dc -r 6a538ee7f578 common/lib/libc/arch/mips/atomic/atomic_cas.S
--- a/common/lib/libc/arch/mips/atomic/atomic_cas.S     Thu Aug 06 07:38:54 2020 +0000
+++ b/common/lib/libc/arch/mips/atomic/atomic_cas.S     Thu Aug 06 10:00:20 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_cas.S,v 1.7 2020/08/01 09:26:49 skrll Exp $     */
+/*     $NetBSD: atomic_cas.S,v 1.8 2020/08/06 10:00:21 skrll Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include <machine/asm.h>
 #include "atomic_op_asm.h"
 
-RCSID("$NetBSD: atomic_cas.S,v 1.7 2020/08/01 09:26:49 skrll Exp $")
+RCSID("$NetBSD: atomic_cas.S,v 1.8 2020/08/06 10:00:21 skrll Exp $")
 
        .text
        .set    noat
@@ -37,6 +37,7 @@
        .set    nomacro
 
 LEAF(_atomic_cas_32)
+       LLSCSYNC
 1:     INT_LL          v0, 0(a0)
         nop
        bne             v0, a1, 2f
@@ -58,6 +59,7 @@
 
 #if !defined(__mips_o32)
 LEAF(_atomic_cas_64)
+       LLSCSYNC
 1:     REG_LL          v0, 0(a0)
         nop
        bne             v0, a1, 2f
diff -r bd822d9c77dc -r 6a538ee7f578 common/lib/libc/arch/mips/atomic/atomic_dec.S
--- a/common/lib/libc/arch/mips/atomic/atomic_dec.S     Thu Aug 06 07:38:54 2020 +0000
+++ b/common/lib/libc/arch/mips/atomic/atomic_dec.S     Thu Aug 06 10:00:20 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_dec.S,v 1.6 2020/08/01 09:26:49 skrll Exp $     */
+/*     $NetBSD: atomic_dec.S,v 1.7 2020/08/06 10:00:21 skrll Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include <machine/asm.h>
 #include "atomic_op_asm.h"
 
-RCSID("$NetBSD: atomic_dec.S,v 1.6 2020/08/01 09:26:49 skrll Exp $")
+RCSID("$NetBSD: atomic_dec.S,v 1.7 2020/08/06 10:00:21 skrll Exp $")
 
        .text
        .set    noreorder
@@ -49,6 +49,7 @@
        li              t0, -1
        saa             t0, (a0)
 #else
+       LLSCSYNC
 1:     INT_LL          t0, 0(a0)
         nop
        INT_ADDU        t0, -1
@@ -62,6 +63,7 @@
 ATOMIC_OP_ALIAS(atomic_dec_32, _atomic_dec_32)
 
 LEAF(_atomic_dec_32_nv)
+       LLSCSYNC
 1:     INT_LL          v0, 0(a0)
         nop
        INT_ADDU        v0, -1
@@ -80,6 +82,7 @@
        li              t0, -1
        saad            t0, (a0)
 #else
+       LLSCSYNC
 1:     REG_LL          t0, 0(a0)
         nop
        REG_ADDU        t0, -1
@@ -93,6 +96,7 @@
 ATOMIC_OP_ALIAS(atomic_dec_64, _atomic_dec_64)
 
 LEAF(_atomic_dec_64_nv)
+       LLSCSYNC
 1:     REG_LL          v0, 0(a0)
         nop
        REG_ADDU        v0, -1
diff -r bd822d9c77dc -r 6a538ee7f578 common/lib/libc/arch/mips/atomic/atomic_inc.S
--- a/common/lib/libc/arch/mips/atomic/atomic_inc.S     Thu Aug 06 07:38:54 2020 +0000
+++ b/common/lib/libc/arch/mips/atomic/atomic_inc.S     Thu Aug 06 10:00:20 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_inc.S,v 1.6 2020/08/01 09:26:49 skrll Exp $     */
+/*     $NetBSD: atomic_inc.S,v 1.7 2020/08/06 10:00:21 skrll Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include <machine/asm.h>
 #include "atomic_op_asm.h"
 
-RCSID("$NetBSD: atomic_inc.S,v 1.6 2020/08/01 09:26:49 skrll Exp $")
+RCSID("$NetBSD: atomic_inc.S,v 1.7 2020/08/06 10:00:21 skrll Exp $")
 
        .text
        .set    noreorder
@@ -50,6 +50,7 @@
        li              t0, 1
        saa             t0, (a0)
 #else
+       LLSCSYNC
 1:     INT_LL          t0, 0(a0)
         nop
        INT_ADDU        t0, 1
@@ -63,6 +64,7 @@
 ATOMIC_OP_ALIAS(atomic_inc_32, _atomic_inc_32)
 
 LEAF(_atomic_inc_32_nv)
+       LLSCSYNC
 1:     INT_LL          v0, 0(a0)
         nop
        INT_ADDU        v0, 1
@@ -81,6 +83,7 @@
        li              t0, 1
        saad            t0, (a0)
 #else
+       LLSCSYNC
 1:     REG_LL          t0, 0(a0)
         nop
        REG_ADDU        t0, 1
@@ -94,6 +97,7 @@
 ATOMIC_OP_ALIAS(atomic_inc_64, _atomic_inc_64)
 
 LEAF(_atomic_inc_64_nv)
+       LLSCSYNC
 1:     REG_LL          v0, 0(a0)
         nop
        REG_ADDU        v0, 1
diff -r bd822d9c77dc -r 6a538ee7f578 common/lib/libc/arch/mips/atomic/atomic_or.S
--- a/common/lib/libc/arch/mips/atomic/atomic_or.S      Thu Aug 06 07:38:54 2020 +0000
+++ b/common/lib/libc/arch/mips/atomic/atomic_or.S      Thu Aug 06 10:00:20 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_or.S,v 1.5 2020/08/01 09:26:49 skrll Exp $      */
+/*     $NetBSD: atomic_or.S,v 1.6 2020/08/06 10:00:21 skrll Exp $      */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -43,6 +43,7 @@
 #endif /* _KERNEL_OPT */
 
 LEAF(_atomic_or_32)
+       LLSCSYNC
 1:     INT_LL          t0, 0(a0)
         nop
        or              t0, a1
@@ -55,6 +56,7 @@
 ATOMIC_OP_ALIAS(atomic_or_32, _atomic_or_32)
 
 LEAF(_atomic_or_32_nv)
+       LLSCSYNC
 1:     INT_LL          v0, 0(a0)
         nop
        or              v0, a1
@@ -69,6 +71,7 @@
 
 #if !defined(__mips_o32)
 LEAF(_atomic_or_64)
+       LLSCSYNC
 1:     REG_LL          t0, 0(a0)
         nop
        or              t0, a1
@@ -81,6 +84,7 @@
 ATOMIC_OP_ALIAS(atomic_or_64, _atomic_or_64)
 
 LEAF(_atomic_or_64_nv)
+       LLSCSYNC
 1:     REG_LL          v0, 0(a0)
         nop
        or              v0, a1
diff -r bd822d9c77dc -r 6a538ee7f578 common/lib/libc/arch/mips/atomic/atomic_swap.S
--- a/common/lib/libc/arch/mips/atomic/atomic_swap.S    Thu Aug 06 07:38:54 2020 +0000
+++ b/common/lib/libc/arch/mips/atomic/atomic_swap.S    Thu Aug 06 10:00:20 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_swap.S,v 1.6 2020/08/01 09:26:49 skrll Exp $    */
+/*     $NetBSD: atomic_swap.S,v 1.7 2020/08/06 10:00:21 skrll Exp $    */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include <machine/asm.h>
 #include "atomic_op_asm.h"
 
-RCSID("$NetBSD: atomic_swap.S,v 1.6 2020/08/01 09:26:49 skrll Exp $")
+RCSID("$NetBSD: atomic_swap.S,v 1.7 2020/08/06 10:00:21 skrll Exp $")
 
        .text
        .set    noreorder
@@ -44,8 +44,8 @@
        .set    nomacro
 #endif /* _KERNEL_OPT */
 
-
 LEAF(_atomic_swap_32)
+       LLSCSYNC



Home | Main Index | Thread Index | Old Index