Re: [PATCH] ARM: fix big-endian check for IO memcpy and memset

From: Linus Walleij

Date: Wed Nov 04 2026 - 09:07:02 EST


On Fri, Oct 30, 2026 at 9:30 AM Julian Vetter <julian@xxxxxxxxxxxxxxxx> wrote:

> The commit 7ddfe625cbc1 ("ARM: optimize
> memset_io()/memcpy_fromio()/memcpy_toio()") switched little-endian
> builds to mmioset()/mmiocpy() and intended to keep the byte-wise
> _memset_io()/_memcpy_fromio()/_memcpy_toio() for big-endian builds.
> However, the check uses __ARMBE__, which is not defined by GCC. The
> define used throughout the kernel is __ARMEB__ for big-endian ARM. So,
> big-endian builds have been using mmioset() and mmiocpy() ever since.
>
> This is a problem on ARMv5 BE32 platforms like IXP4xx, where word
> accesses to IO memory can end up on different byte lanes than byte
> accesses. Fix the typo, so big-endian builds use the correct byte-wise
> implementations again, as originally intended.
>
> Switching big-endian builds to the generic implementation from
> lib/iomem_copy.c instead is not an option either, because it also uses
> word accesses for the aligned parts of a buffer and thus has the same
> byte lane problem on BE32. ARMv6/v7 BE8 mode would work with both, but
> it is marked as broken and is expected to be removed, so it is not worth
> treating it differently from BE32.
>
> Signed-off-by: Julian Vetter <julian@xxxxxxxxxxxxxxxx>

Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>

Please put this patch into Russell's patch tracker.

Yours,
Linus Walleij