Source-Changes-HG archive

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

[src/trunk]: src/common/lib/libc/arch/mips/atomic Include OCTEON support for ...



details:   https://anonhg.NetBSD.org/src/rev/357f8e1edda9
branches:  trunk
changeset: 338623:357f8e1edda9
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Jun 01 23:16:54 2015 +0000

description:
Include OCTEON support for syncw and saa/saad (Store Atomic Add).

diffstat:

 common/lib/libc/arch/mips/atomic/atomic_add.S    |  12 ++++++++++--
 common/lib/libc/arch/mips/atomic/atomic_cas.S    |  10 ++++++++--
 common/lib/libc/arch/mips/atomic/atomic_dec.S    |  14 ++++++++++++--
 common/lib/libc/arch/mips/atomic/atomic_inc.S    |  14 ++++++++++++--
 common/lib/libc/arch/mips/atomic/atomic_op_asm.h |   8 +++++++-
 common/lib/libc/arch/mips/atomic/atomic_swap.S   |   8 ++++----
 common/lib/libc/arch/mips/atomic/membar_ops.S    |  19 ++++++++++++++++++-
 7 files changed, 71 insertions(+), 14 deletions(-)

diffs (299 lines):

diff -r f1c566c05a98 -r 357f8e1edda9 common/lib/libc/arch/mips/atomic/atomic_add.S
--- a/common/lib/libc/arch/mips/atomic/atomic_add.S     Mon Jun 01 22:55:12 2015 +0000
+++ b/common/lib/libc/arch/mips/atomic/atomic_add.S     Mon Jun 01 23:16:54 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_add.S,v 1.4 2012/03/14 16:50:34 christos Exp $  */
+/*     $NetBSD: atomic_add.S,v 1.5 2015/06/01 23:16:54 matt 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.4 2012/03/14 16:50:34 christos Exp $")
+RCSID("$NetBSD: atomic_add.S,v 1.5 2015/06/01 23:16:54 matt Exp $")
 
        .text
        .set    noreorder
@@ -46,12 +46,16 @@
 
 
 LEAF(_atomic_add_32)
+#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
+       saa             a1, (a0)
+#else
 1:     INT_LL          t0, 0(a0)
         nop
        INT_ADDU        t0, a1
        INT_SC          t0, 0(a0)
        beq             t0, zero, 1b
         nop
+#endif
        j               ra
         nop
 END(_atomic_add_32)
@@ -72,12 +76,16 @@
 
 #if !defined(__mips_o32)
 LEAF(_atomic_add_64)
+#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
+       saad            a1, (a0)
+#else
 1:     REG_LL          t0, 0(a0)
         nop
        REG_ADDU        t0, a1
        REG_SC          t0, 0(a0)
        beq             t0, zero, 1b
         nop
+#endif
        j               ra
         nop
 END(_atomic_add_64)
diff -r f1c566c05a98 -r 357f8e1edda9 common/lib/libc/arch/mips/atomic/atomic_cas.S
--- a/common/lib/libc/arch/mips/atomic/atomic_cas.S     Mon Jun 01 22:55:12 2015 +0000
+++ b/common/lib/libc/arch/mips/atomic/atomic_cas.S     Mon Jun 01 23:16:54 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_cas.S,v 1.3 2012/03/14 16:50:34 christos Exp $  */
+/*     $NetBSD: atomic_cas.S,v 1.4 2015/06/01 23:16:54 matt 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.3 2012/03/14 16:50:34 christos Exp $")
+RCSID("$NetBSD: atomic_cas.S,v 1.4 2015/06/01 23:16:54 matt Exp $")
 
        .text
        .set    noat
@@ -46,6 +46,9 @@
        beq             t0, zero, 1b
         nop
        move            v0, a1
+#ifdef _MIPS_ARCH_OCTEONP
+       syncw
+#endif
 2:
        j               ra
         nop
@@ -63,6 +66,9 @@
        beq             t0, zero, 1b
         nop
        move            v0, a1
+#ifdef _MIPS_ARCH_OCTEONP
+       syncw
+#endif
 2:
        j               ra
         nop
diff -r f1c566c05a98 -r 357f8e1edda9 common/lib/libc/arch/mips/atomic/atomic_dec.S
--- a/common/lib/libc/arch/mips/atomic/atomic_dec.S     Mon Jun 01 22:55:12 2015 +0000
+++ b/common/lib/libc/arch/mips/atomic/atomic_dec.S     Mon Jun 01 23:16:54 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_dec.S,v 1.4 2012/03/14 16:50:34 christos Exp $  */
+/*     $NetBSD: atomic_dec.S,v 1.5 2015/06/01 23:16:54 matt 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.4 2012/03/14 16:50:34 christos Exp $")
+RCSID("$NetBSD: atomic_dec.S,v 1.5 2015/06/01 23:16:54 matt Exp $")
 
        .text
        .set    noreorder
@@ -45,12 +45,17 @@
 #endif /* _KERNEL_OPT */
 
 LEAF(_atomic_dec_32)
+#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
+       li              t0, -1
+       saa             t0, (a0)
+#else
 1:     INT_LL          t0, 0(a0)
         nop
        INT_ADDU        t0, -1
        INT_SC          t0, 0(a0)
        beq             t0, zero, 1b
         nop
+#endif
        j               ra
         nop
 END(_atomic_dec_32)
@@ -71,12 +76,17 @@
 
 #if !defined(__mips_o32)
 LEAF(_atomic_dec_64)
+#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
+       li              t0, -1
+       saad            t0, (a0)
+#else
 1:     REG_LL          t0, 0(a0)
         nop
        REG_ADDU        t0, -1
        REG_SC          t0, 0(a0)
        beq             t0, zero, 1b
         nop
+#endif
        j               ra
         nop
 END(_atomic_dec_64)
diff -r f1c566c05a98 -r 357f8e1edda9 common/lib/libc/arch/mips/atomic/atomic_inc.S
--- a/common/lib/libc/arch/mips/atomic/atomic_inc.S     Mon Jun 01 22:55:12 2015 +0000
+++ b/common/lib/libc/arch/mips/atomic/atomic_inc.S     Mon Jun 01 23:16:54 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_inc.S,v 1.4 2012/03/14 16:50:34 christos Exp $  */
+/*     $NetBSD: atomic_inc.S,v 1.5 2015/06/01 23:16:54 matt 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.4 2012/03/14 16:50:34 christos Exp $")
+RCSID("$NetBSD: atomic_inc.S,v 1.5 2015/06/01 23:16:54 matt Exp $")
 
        .text
        .set    noreorder
@@ -46,12 +46,17 @@
 
 
 LEAF(_atomic_inc_32)
+#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
+       li              t0, 1
+       saa             t0, (a0)
+#else
 1:     INT_LL          t0, 0(a0)
         nop
        INT_ADDU        t0, 1
        INT_SC          t0, 0(a0)
        beq             t0, zero, 1b
         nop
+#endif
        j               ra
         nop
 END(_atomic_inc_32)
@@ -72,12 +77,17 @@
 
 #if !defined(__mips_o32)
 LEAF(_atomic_inc_64)
+#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2)
+       li              t0, 1
+       saad            t0, (a0)
+#else
 1:     REG_LL          t0, 0(a0)
         nop
        REG_ADDU        t0, 1
        REG_SC          t0, 0(a0)
        beq             t0, zero, 1b
         nop
+#endif
        j               ra
         nop
 END(_atomic_inc_64)
diff -r f1c566c05a98 -r 357f8e1edda9 common/lib/libc/arch/mips/atomic/atomic_op_asm.h
--- a/common/lib/libc/arch/mips/atomic/atomic_op_asm.h  Mon Jun 01 22:55:12 2015 +0000
+++ b/common/lib/libc/arch/mips/atomic/atomic_op_asm.h  Mon Jun 01 23:16:54 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_op_asm.h,v 1.2 2008/04/28 20:22:52 martin Exp $ */
+/*     $NetBSD: atomic_op_asm.h,v 1.3 2015/06/01 23:16:54 matt Exp $   */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -44,4 +44,10 @@
 
 #endif /* _KERNEL */
 
+#ifdef __OCTEON__
+#define        SYNCW   syncw
+#else
+#define        SYNCW   nop
+#endif
+
 #endif /* _ATOMIC_OP_ASM_H_ */
diff -r f1c566c05a98 -r 357f8e1edda9 common/lib/libc/arch/mips/atomic/atomic_swap.S
--- a/common/lib/libc/arch/mips/atomic/atomic_swap.S    Mon Jun 01 22:55:12 2015 +0000
+++ b/common/lib/libc/arch/mips/atomic/atomic_swap.S    Mon Jun 01 23:16:54 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_swap.S,v 1.4 2012/03/14 16:50:34 christos Exp $ */
+/*     $NetBSD: atomic_swap.S,v 1.5 2015/06/01 23:16:54 matt 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.4 2012/03/14 16:50:34 christos Exp $")
+RCSID("$NetBSD: atomic_swap.S,v 1.5 2015/06/01 23:16:54 matt Exp $")
 
        .text
        .set    noreorder
@@ -54,7 +54,7 @@
         nop
 2:
        j               ra
-        nop
+        SYNCW
 END(_atomic_swap_32)
 ATOMIC_OP_ALIAS(atomic_swap_32, _atomic_swap_32)
 
@@ -68,7 +68,7 @@
         nop
 2:
        j               ra
-        nop
+        SYNCW
 END(_atomic_swap_64)
 ATOMIC_OP_ALIAS(atomic_swap_64, _atomic_swap_64)
 #endif
diff -r f1c566c05a98 -r 357f8e1edda9 common/lib/libc/arch/mips/atomic/membar_ops.S
--- a/common/lib/libc/arch/mips/atomic/membar_ops.S     Mon Jun 01 22:55:12 2015 +0000
+++ b/common/lib/libc/arch/mips/atomic/membar_ops.S     Mon Jun 01 23:16:54 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: membar_ops.S,v 1.5 2012/08/03 06:06:44 matt Exp $      */
+/*     $NetBSD: membar_ops.S,v 1.6 2015/06/01 23:16:54 matt Exp $      */
 
 /*-
  * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@@ -61,18 +61,35 @@
 #endif
 END(_membar_sync)
 
+#ifdef __OCTEON__
+LEAF(_membar_producer)
+       j       ra
+        syncw
+END(_membar_producer)
+#endif
+
 #ifdef _KERNEL
 STRONG_ALIAS(mb_read, _membar_sync)
+#ifdef __OCTEON__
+STRONG_ALIAS(mb_write, _membar_producer)
+#else
 STRONG_ALIAS(mb_write, _membar_sync)
+#endif
 STRONG_ALIAS(mb_memory, _membar_sync)
 #endif
 
 ATOMIC_OP_ALIAS(membar_sync,_membar_sync)
 ATOMIC_OP_ALIAS(membar_enter,_membar_sync)
 STRONG_ALIAS(_membar_enter,_membar_sync)
+#ifdef __OCTEON__
+ATOMIC_OP_ALIAS(membar_exit,_membar_producer)
+STRONG_ALIAS(_membar_exit,_membar_producer)
+STRONG_ALIAS(membar_producer,_membar_producer)
+#else
 ATOMIC_OP_ALIAS(membar_exit,_membar_sync)
 STRONG_ALIAS(_membar_exit,_membar_sync)
 ATOMIC_OP_ALIAS(membar_producer,_membar_sync)
 STRONG_ALIAS(_membar_producer,_membar_sync)
+#endif
 ATOMIC_OP_ALIAS(membar_consumer,_membar_sync)
 STRONG_ALIAS(_membar_consumer,_membar_sync)



Home | Main Index | Thread Index | Old Index