summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/powerpc/aim/swtch32.S3
-rw-r--r--sys/powerpc/aim/swtch64.S3
-rw-r--r--sys/powerpc/include/atomic.h5
-rw-r--r--sys/powerpc/include/pio.h7
4 files changed, 10 insertions, 8 deletions
diff --git a/sys/powerpc/aim/swtch32.S b/sys/powerpc/aim/swtch32.S
index 76bb0f404353..fa87aba63c3a 100644
--- a/sys/powerpc/aim/swtch32.S
+++ b/sys/powerpc/aim/swtch32.S
@@ -124,7 +124,8 @@ cpu_switchin:
blocked_loop:
lwz %r7,TD_LOCK(%r2)
cmpw %r6,%r7
- beq blocked_loop
+ beq- blocked_loop
+ isync
#endif
mfsprg %r7,0 /* Get the pcpu pointer */
diff --git a/sys/powerpc/aim/swtch64.S b/sys/powerpc/aim/swtch64.S
index 857ae40b1771..ab6f53278952 100644
--- a/sys/powerpc/aim/swtch64.S
+++ b/sys/powerpc/aim/swtch64.S
@@ -150,7 +150,8 @@ cpu_switchin:
blocked_loop:
ld %r7,TD_LOCK(%r13)
cmpd %r6,%r7
- beq blocked_loop
+ beq- blocked_loop
+ isync
#endif
mfsprg %r7,0 /* Get the pcpu pointer */
diff --git a/sys/powerpc/include/atomic.h b/sys/powerpc/include/atomic.h
index c88c3fa39a58..8ec3ea0282b0 100644
--- a/sys/powerpc/include/atomic.h
+++ b/sys/powerpc/include/atomic.h
@@ -51,13 +51,8 @@
* with the atomic lXarx/stXcx. sequences below. See Appendix B.2 of Book II
* of the architecture manual.
*/
-#ifdef __powerpc64__
-#define __ATOMIC_REL() __asm __volatile("lwsync" : : : "memory")
-#define __ATOMIC_ACQ() __asm __volatile("lwsync" : : : "memory")
-#else
#define __ATOMIC_REL() __asm __volatile("lwsync" : : : "memory")
#define __ATOMIC_ACQ() __asm __volatile("isync" : : : "memory")
-#endif
/*
* atomic_add(p, v)
diff --git a/sys/powerpc/include/pio.h b/sys/powerpc/include/pio.h
index 0994ed18e0cb..b09e68a43e81 100644
--- a/sys/powerpc/include/pio.h
+++ b/sys/powerpc/include/pio.h
@@ -39,7 +39,12 @@
* I/O macros.
*/
-#define powerpc_iomb() __asm __volatile("eieio" : : : "memory")
+/*
+ * Use sync so that bus space operations cannot sneak out the bottom of
+ * mutex-protected sections (mutex release does not guarantee completion of
+ * accesses to caching-inhibited memory on some systems)
+ */
+#define powerpc_iomb() __asm __volatile("sync" : : : "memory")
static __inline void
__outb(volatile u_int8_t *a, u_int8_t v)