Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/cortex Don't "sync" atomic ops.



details:   https://anonhg.NetBSD.org/src/rev/6a053d8342d1
branches:  trunk
changeset: 784211:6a053d8342d1
user:      matt <matt%NetBSD.org@localhost>
date:      Tue Jan 22 09:04:12 2013 +0000

description:
Don't "sync" atomic ops.
Do sync after each range op.

diffstat:

 sys/arch/arm/cortex/pl310.c |  20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diffs (76 lines):

diff -r db58b4421df7 -r 6a053d8342d1 sys/arch/arm/cortex/pl310.c
--- a/sys/arch/arm/cortex/pl310.c       Tue Jan 22 08:33:18 2013 +0000
+++ b/sys/arch/arm/cortex/pl310.c       Tue Jan 22 09:04:12 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pl310.c,v 1.9 2012/11/28 22:48:13 matt Exp $   */
+/*     $NetBSD: pl310.c,v 1.10 2013/01/22 09:04:12 matt Exp $  */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pl310.c,v 1.9 2012/11/28 22:48:13 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pl310.c,v 1.10 2013/01/22 09:04:12 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -195,11 +195,14 @@
 }
 
 static inline void
-arml2cc_cache_op(struct arml2cc_softc *sc, bus_size_t off, uint32_t val)
+arml2cc_cache_op(struct arml2cc_softc *sc, bus_size_t off, uint32_t val,
+    bool wait)
 {
        arml2cc_write_4(sc, off, val);
-       while (arml2cc_read_4(sc, off) & 1) {
-               /* spin */
+       if (wait) {
+               while (arml2cc_read_4(sc, off) & 1) {
+                       /* spin */
+               }
        }
 }
 
@@ -215,7 +218,7 @@
 static inline void
 arml2cc_cache_sync(struct arml2cc_softc *sc)
 {
-       arml2cc_cache_op(sc, L2C_CACHE_SYNC, 0);
+       arml2cc_cache_op(sc, L2C_CACHE_SYNC, 0, true);
 }
 
 static inline void
@@ -294,7 +297,7 @@
                        return;
                }
                for (paddr_t segend = pa + seglen; pa < segend; pa += line_size) {
-                       arml2cc_cache_op(sc, cache_op, pa);
+                       arml2cc_cache_op(sc, cache_op, pa, false);
                }
                mutex_spin_exit(&sc->sc_lock);
        }
@@ -305,6 +308,7 @@
 {
        atomic_inc_64(&arml2cc_sc->sc_ev_inv.ev_count);
        arml2cc_cache_range_op(pa, len, L2C_INV_PA);
+       arml2cc_cache_sync(arml2cc_sc);
 }
 
 static void
@@ -312,6 +316,7 @@
 {
        atomic_inc_64(&arml2cc_sc->sc_ev_wb.ev_count);
        arml2cc_cache_range_op(pa, len, L2C_CLEAN_PA);
+       arml2cc_cache_sync(arml2cc_sc);
 }
 
 static void
@@ -319,4 +324,5 @@
 {
        atomic_inc_64(&arml2cc_sc->sc_ev_wbinv.ev_count);
        arml2cc_cache_range_op(pa, len, L2C_CLEAN_INV_PA);
+       arml2cc_cache_sync(arml2cc_sc);
 }



Home | Main Index | Thread Index | Old Index