Re: [PATCH 4/6] arm64/io: Provide a WC friendly __iowriteXX_copy()

Catalin Marinas
2024-02-29T10:33:13Z

On Tue, Feb 20, 2024 at 09:17:08PM -0400, Jason Gunthorpe wrote:
> + const u32 *from, size_t count)
> +{
> + switch (count) {
> + case 8:
> + asm volatile("str %w0, [%8, #4 * 0]\n"
> + "str %w1, [%8, #4 * 1]\n"
> + "str %w2, [%8, #4 * 2]\n"
> + "str %w3, [%8, #4 * 3]\n"
> + "str %w4, [%8, #4 * 4]\n"
> + "str %w5, [%8, #4 * 5]\n"
> + "str %w6, [%8, #4 * 6]\n"
> + "str %w7, [%8, #4 * 7]\n"
> + :
> + : "rZ"(from[0]), "rZ"(from[1]), "rZ"(from[2]),
> + "rZ"(from[3]), "rZ"(from[4]), "rZ"(from[5]),
> + "rZ"(from[6]), "rZ"(from[7]), "r"(to));
> + break;

BTW, talking of maintenance, would a series of __raw_writel() with
Mark's recent patch for offset addressing generate similar code? I.e.:

__raw_writel(from[0], to);
__raw_writel(from[1], to + 1);
...
__raw_writel(from[7], to + 7);

(you may have mentioned it in previous threads, I did not check)

--
Catalin