Re: [RFC PATCH v3 28/37] kvx: Add misc common routines

From: Arnd Bergmann
Date: Tue Jul 23 2024 - 04:51:08 EST


On Mon, Jul 22, 2024, at 09:41, ysionneau@xxxxxxxxxxxxx wrote:

> +/*
> + * Copy data from IO memory space to "real" memory space.
> + */
> +void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
> +{
> + while (count && !IS_ALIGNED((unsigned long)from, 8)) {
> + *(u8 *)to = __raw_readb(from);
> + from++;
> + to++;
> + count--;
> + }
> +
> + while (count >= 8) {
> + *(u64 *)to = __raw_readq(from);
> + from += 8;
> + to += 8;
> + count -= 8;
> + }

I see this entire file is largely identical to the corresponding
one from arm64, loongarch and (mostly) csky. Can you instead
combine the existing ones into a copy in lib/ and use that?

This would be a good thing to send before the rest of your series.

Arnd