Re: [PATCH v6 2/4] rtc: goldfish: use __raw_writel()/__raw_readl()

From: Arnd Bergmann
Date: Fri Jan 14 2022 - 01:57:50 EST


On Thu, Jan 13, 2022 at 9:19 PM Laurent Vivier <laurent@xxxxxxxxx> wrote:
>
> As android implementation defines the endianness of the device is the one
> of the architecture replace all writel()/readl() by
> __raw_writel()/__raw_readl()
>
> https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/hw/timer/goldfish_timer.c#177
>
> The same change has been done for goldfish-tty:
>
> commit da31de35cd2f ("tty: goldfish: use __raw_writel()/__raw_readl()")
>
> Signed-off-by: Laurent Vivier <laurent@xxxxxxxxx>

__raw_readl() isn't really the correct interface though, this is not
well-defined to have
a particular meaning at all, and doesn't guarantee atomicity or a
particular endianess
across architectures.

I'd suggest defining a set of goldfish specific accessors per
architecture that turn
into either readl() or swabl(readl()), to allow future architectures
to define this
properly in qemu.

Arnd