From: Thomas Huth Date: Thu, 30 Mar 2023 15:26:13 +0000 (+0200) Subject: hw/mips/malta: Fix the malta machine on big endian hosts X-Git-Tag: v8.1.0-rc0~72^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dc96009afd8cf2372fa1bbced0bcbcbb2c5d6f1b;p=thirdparty%2Fqemu.git hw/mips/malta: Fix the malta machine on big endian hosts Booting a Linux kernel with the malta machine is currently broken on big endian hosts. The cpu_to_gt32 macro wants to byteswap a value for little endian targets only, but uses the wrong way to do this: cpu_to_[lb]e32 works the other way round on big endian hosts! Fix it by using the same ways on both, big and little endian hosts. Fixes: 0c8427baf0 ("hw/mips/malta: Use bootloader helper to set BAR registers") Cc: qemu-stable@nongnu.org Message-Id: <20230330152613.232082-1-thuth@redhat.com> Reviewed-by: Peter Maydell Signed-off-by: Thomas Huth --- diff --git a/hw/mips/malta.c b/hw/mips/malta.c index e3be2eea563..47cb49f691d 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -629,9 +629,9 @@ static void bl_setup_gt64120_jump_kernel(void **p, uint64_t run_addr, /* Bus endianess is always reversed */ #if TARGET_BIG_ENDIAN -#define cpu_to_gt32 cpu_to_le32 +#define cpu_to_gt32(x) (x) #else -#define cpu_to_gt32 cpu_to_be32 +#define cpu_to_gt32(x) bswap32(x) #endif /* setup MEM-to-PCI0 mapping as done by YAMON */