powerpc: atomic: Implement acquire/release/relaxed variants for cmpxchg
authorBoqun Feng <boqun.feng@gmail.com>
Tue, 15 Dec 2015 14:24:17 +0000 (22:24 +0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 17 Feb 2016 13:11:39 +0000 (00:11 +1100)
commit56c08e6d226c860ad097fa6ba109133228c56722
treee7888be8d1d81987e5acc648b2c52d9bac5e41ff
parent26760fc19a7e663e4f49d586aca6740fb21d887d
powerpc: atomic: Implement acquire/release/relaxed variants for cmpxchg

Implement cmpxchg{,64}_relaxed and atomic{,64}_cmpxchg_relaxed, based on
which _release variants can be built.

To avoid superfluous barriers in _acquire variants, we implement these
operations with assembly code rather use __atomic_op_acquire() to build
them automatically.

For the same reason, we keep the assembly implementation of fully
ordered cmpxchg operations.

However, we don't do the similar for _release, because that will require
putting barriers in the middle of ll/sc loops, which is probably a bad
idea.

Note cmpxchg{,64}_relaxed and atomic{,64}_cmpxchg_relaxed are not
compiler barriers.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/atomic.h
arch/powerpc/include/asm/cmpxchg.h