Re: [PATCH v12 2/5] tty: goldfish: introduce gf_ioread32()/gf_iowrite32()

From: Laurent Vivier
Date: Wed Jan 26 2022 - 12:32:39 EST


Le 26/01/2022 à 14:41, Greg KH a écrit :
On Fri, Jan 21, 2022 at 09:07:35PM +0100, Laurent Vivier wrote:
Revert
commit da31de35cd2f ("tty: goldfish: use __raw_writel()/__raw_readl()")

Why?

and define gf_ioread32()/gf_iowrite32() to be able to use accessors
defined by the architecture.

What does this do?


Cc: stable@xxxxxxxxxxxxxxx # v5.11+
Fixes: da31de35cd2f ("tty: goldfish: use __raw_writel()/__raw_readl()")
Signed-off-by: Laurent Vivier <laurent@xxxxxxxxx>
---
drivers/tty/goldfish.c | 20 ++++++++++----------
include/linux/goldfish.h | 15 +++++++++++----
2 files changed, 21 insertions(+), 14 deletions(-)
...
--
2.34.1


This feels like a step backwards. Why keep this level of indirection
for no good reason?


It was proposed by Arnd on my previous iteration of the series when I wanted to update goldfish-rtc in the same way:

https://lore.kernel.org/all/CAK8P3a1H6-sd_+FqnOq0Zhj=L51EWuW5VCcYeTENcp3+PkTC4Q@xxxxxxxxxxxxxx/

Keeping __raw_XXX() functions works on most of the cases except if the current CPU endianness can differ from the architecture one (like a ppc64le kernel (little-endian) running a ppc64 machine (big-endian)).

The best solution would be to update QEMU to set the device as a little-endian one, but google didn't merge its implemention in upstream QEMU and this would break all other OSes using goldfish devices on big-endian architectures.

Thanks,
Laurent