On Sun, Jan 16, 2022 at 12:54 PM Laurent Vivier <laurent@xxxxxxxxx> wrote: > > Virtio has exactly the same problem in the past (prio to v1.0), and it uses __LITTLE_ENDIAN in > virtio_legacy_is_little_endian() to know the endianness of the device. Right, that was my point, let's not duplicate the bug from pre-standard virtio. > So the code can become: > > #ifdef __LITTLE_ENDIAN > #define goldfish_ioread32 ioread32 > #define goldfish_iowrite32 iowrite32 > #else > #define goldfish_ioread32 ioread32be > #define goldfish_iowrite32 iowrite32be > #endif This is exactly the same as what you had before, it continues to break when host and guest disagree on the endianess. > What do you prefer: CONFIG_M68K or __LITTLE_ENDIAN? Checking for CONFIG_M68K at least has a chance of working, provided that all existing qemu implementations agree on the semantics here. Arnd