Improve atomic memory access and support -mno-atomic.

Use CONFIG_GENERIC_ATOMIC64 if 32-bit.  Add system call to emulate
atomic compare exchange, primarily for targets lacking hardware
support (i.e., lacking RV32A, RV64A).  Support excluding use of
atomic memory instructions (-mno-atomic).

This change is mutually dependent on the corresponding change to
riscv-gcc.
On 08/16/2014 02:02 AM, Albert Ou wrote:
> In arch/riscv/include/asm/cmpxchg.h:
> 
>> @@ -104,4 +106,64 @@
>>  	cmpxchg_local((ptr), (o), (n));		\
>>  })
>>  
>> +#else /* !CONFIG_RV_ATOMIC */
>> +
>> +static inline unsigned long __cmpxchg_local(volatile void *ptr,
> 
> The inline assembly appears equivalent to |__cmpxchg_local_generic()| as
> defined in |<asm-generic/cmpxchg-local.h>|. Is there a particular reason
> to avoid the generic definition of |cmpxchg_local()|?
> 

Yes, I agree it is equivalent and that <asm-generic/cmpxchg-local.h>
should be used.

// darius