aboutsummaryrefslogtreecommitdiff
path: root/hw/mips/malta.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2023-03-30 17:26:13 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2023-12-20 19:11:10 +0300
commita386866a8dd3c0e79deffbfe269cb40e2e34c665 (patch)
tree5a6ae863e9ad778cab8a783e99f6fb529f5bf2f5 /hw/mips/malta.c
parentadfe37a19a8896e1736850f027312fb04559ec18 (diff)
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 <peter.maydell@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com> (cherry picked from commit dc96009afd8cf2372fa1bbced0bcbcbb2c5d6f1b) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> (Mjt: adjust context for before v7.2.0-677-g0e45355c5c)
Diffstat (limited to 'hw/mips/malta.c')
-rw-r--r--hw/mips/malta.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index c0a2e0ab04..da7c110b73 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -877,9 +877,9 @@ static void write_bootloader(uint8_t *base, 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
/* move GT64120 registers from 0x14000000 to 0x1be00000 */