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.
It turns out that `<linux/atomic.h>` already includes `<asm-generic/atomic64.h>` when `CONFIG_GENERIC_ATOMIC64` is selected, so there is no need to do so here.