Commit e8812777 authored by Anton Blanchard's avatar Anton Blanchard

ppc64: Add write memory barriers before atomics that return values

parent 154a5720
...@@ -41,6 +41,7 @@ static __inline__ int atomic_add_return(int a, atomic_t *v) ...@@ -41,6 +41,7 @@ static __inline__ int atomic_add_return(int a, atomic_t *v)
int t; int t;
__asm__ __volatile__( __asm__ __volatile__(
EIEIO_ON_SMP
"1: lwarx %0,0,%2 # atomic_add_return\n\ "1: lwarx %0,0,%2 # atomic_add_return\n\
add %0,%1,%0\n\ add %0,%1,%0\n\
stwcx. %0,0,%2\n\ stwcx. %0,0,%2\n\
...@@ -72,6 +73,7 @@ static __inline__ int atomic_sub_return(int a, atomic_t *v) ...@@ -72,6 +73,7 @@ static __inline__ int atomic_sub_return(int a, atomic_t *v)
int t; int t;
__asm__ __volatile__( __asm__ __volatile__(
EIEIO_ON_SMP
"1: lwarx %0,0,%2 # atomic_sub_return\n\ "1: lwarx %0,0,%2 # atomic_sub_return\n\
subf %0,%1,%0\n\ subf %0,%1,%0\n\
stwcx. %0,0,%2\n\ stwcx. %0,0,%2\n\
...@@ -103,6 +105,7 @@ static __inline__ int atomic_inc_return(atomic_t *v) ...@@ -103,6 +105,7 @@ static __inline__ int atomic_inc_return(atomic_t *v)
int t; int t;
__asm__ __volatile__( __asm__ __volatile__(
EIEIO_ON_SMP
"1: lwarx %0,0,%1 # atomic_inc_return\n\ "1: lwarx %0,0,%1 # atomic_inc_return\n\
addic %0,%0,1\n\ addic %0,%0,1\n\
stwcx. %0,0,%1\n\ stwcx. %0,0,%1\n\
...@@ -134,6 +137,7 @@ static __inline__ int atomic_dec_return(atomic_t *v) ...@@ -134,6 +137,7 @@ static __inline__ int atomic_dec_return(atomic_t *v)
int t; int t;
__asm__ __volatile__( __asm__ __volatile__(
EIEIO_ON_SMP
"1: lwarx %0,0,%1 # atomic_dec_return\n\ "1: lwarx %0,0,%1 # atomic_dec_return\n\
addic %0,%0,-1\n\ addic %0,%0,-1\n\
stwcx. %0,0,%1\n\ stwcx. %0,0,%1\n\
...@@ -158,6 +162,7 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v) ...@@ -158,6 +162,7 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v)
int t; int t;
__asm__ __volatile__( __asm__ __volatile__(
EIEIO_ON_SMP
"1: lwarx %0,0,%1 # atomic_dec_if_positive\n\ "1: lwarx %0,0,%1 # atomic_dec_if_positive\n\
addic. %0,%0,-1\n\ addic. %0,%0,-1\n\
blt- 2f\n\ blt- 2f\n\
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment