[PATCH v4 3/4] riscv/barrier: Consolidate fence definitions
Samuel Holland
samuel.holland at sifive.com
Tue Feb 13 13:31:10 PST 2024
Hi Eric,
On 2024-02-13 2:12 PM, Eric Chan wrote:
> Disparate fence implementations are consolidated into fence.h.
> Also introduce RISCV_FENCE_ASM to make fence macro more reusable.
>
> Signed-off-by: Eric Chan <ericchancf at google.com>
> ---
> v3 -> v4: fix the form that can pass the checking of checkpatch.pl.
> arch/riscv/include/asm/atomic.h | 8 ++------
> arch/riscv/include/asm/barrier.h | 3 +--
> arch/riscv/include/asm/cmpxchg.h | 1 -
> arch/riscv/include/asm/fence.h | 10 +++++++---
> arch/riscv/include/asm/io.h | 8 ++++----
> arch/riscv/include/asm/mmio.h | 5 +++--
> arch/riscv/include/asm/mmiowb.h | 2 +-
> 7 files changed, 18 insertions(+), 19 deletions(-)
>
> diff --git a/arch/riscv/include/asm/atomic.h b/arch/riscv/include/asm/atomic.h
> index 31e6e2e7cc18..19050d13b6c1 100644
> --- a/arch/riscv/include/asm/atomic.h
> +++ b/arch/riscv/include/asm/atomic.h
> @@ -17,13 +17,9 @@
> #endif
>
> #include <asm/cmpxchg.h>
> -#include <asm/barrier.h>
>
> -#define __atomic_acquire_fence() \
> - __asm__ __volatile__(RISCV_ACQUIRE_BARRIER "" ::: "memory")
> -
> -#define __atomic_release_fence() \
> - __asm__ __volatile__(RISCV_RELEASE_BARRIER "" ::: "memory");
> +#define __atomic_acquire_fence() RISCV_FENCE(r, rw)
> +#define __atomic_release_fence() RISCV_FENCE(rw, r)
This change removes the omit-the-fence-on-uniprocessor optimization, like you
added some instances of in your previous patch. Should we keep this optimization?
Regards,
Samuel
More information about the linux-riscv
mailing list