Hi Laurent, On Wed, Jan 19, 2022 at 1:05 AM Laurent Vivier <laurent@xxxxxxxxx> wrote: > The goldfish device always uses the same endianness as the architecture > using it: > https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/hw/timer/goldfish_timer.c#177 > > On a big-endian machine, the device is also big-endian, on a > little-endian machine the device is little-endian. > > So we need to use the right accessor to read/write values to the goldfish > registers: ioread32()/iowrite32() on a little-endian machine, > ioread32be()/iowrite32be() on a big-endian machine. > > This patch introduces goldfish_ioread32()/goldfish_iowrite32() to allow > architectures to define them accordlingly to their endianness. > > We define them by default in asm-generic/io.h to access the device using > little-endian access as it is the current use, but we will be able to define > big-endian version when new architectures will use them. > > Signed-off-by: Laurent Vivier <laurent@xxxxxxxxx> Thanks for your patch! > --- a/include/asm-generic/io.h > +++ b/include/asm-generic/io.h > @@ -906,6 +906,13 @@ static inline void iowrite64_rep(volatile void __iomem *addr, > #endif /* CONFIG_64BIT */ > #endif /* CONFIG_GENERIC_IOMAP */ > > +#ifndef goldfish_ioread32 > +#define goldfish_ioread32 ioread32 > +#endif > +#ifndef goldfish_iowrite32 > +#define goldfish_iowrite32 iowrite32 > +#endif > + > #ifdef __KERNEL__ I've just discovered include/linux/goldfish.h, which already has gf_*() accessors for 64-bit, so it'd make sense to move the above there, and adjust the names. Arnd: note that the existing ones do use __raw_writel(). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds