Re: [PATCH] Add io_sync stubs to generic IO memcpy/memset

From: Arnd Bergmann
Date: Mon Jan 27 2025 - 05:27:33 EST


On Mon, Jan 27, 2025, at 11:04, Julian Vetter wrote:
> The recently added IO memcpy and memset functions lack support for
> barriers or other sync functions before and/or after the transaction. To
> convert more architectures to use the generic IO memcpy and memset
> functions, add empty __pre_io_sync and __post_io_sync defines that can
> be overwritten by individual architectures if needed.
>
> Signed-off-by: Julian Vetter <julian@xxxxxxxxxxxxxxxx>
> ---
> lib/iomem_copy.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/lib/iomem_copy.c b/lib/iomem_copy.c
> index dec7eaea60e0..2e81182dd4d3 100644
> --- a/lib/iomem_copy.c
> +++ b/lib/iomem_copy.c
> @@ -9,6 +9,14 @@
> #include <linux/types.h>
> #include <linux/unaligned.h>
>
> +#ifndef __pre_io_sync
> +#define __pre_io_sync
> +#endif
> +
> +#ifndef __post_io_sync
> +#define __post_io_sync
> +#endif

I think we should define what these barriers are supposed to
do exactly, and how they relate to the __io_br/__io_ar/__io_bw/__io_aw
ones include/asm-generic/io.h.

Depending on what the barriers are meant to do, we probably
want to either use the existing ones directly or use a similar
naming scheme.

Arnd