summary refs log tree commit diff stats
path: root/scripts/qapi/error.py
diff options
context:
space:
mode:
authorZiqiao Kong <ziqiaokong@gmail.com>2025-04-15 16:02:54 +0800
committerAlistair Francis <alistair.francis@wdc.com>2025-05-19 13:34:11 +1000
commitad63158bdb33dab5704ea1cf740d2ea0387175df (patch)
tree3b2e002a33af3fd99eaa215dbdfc73787a2d0793 /scripts/qapi/error.py
parent56cde18d048e1e1f889e31f7553e1f39f03eeec5 (diff)
downloadfocaccia-qemu-ad63158bdb33dab5704ea1cf740d2ea0387175df.tar.gz
focaccia-qemu-ad63158bdb33dab5704ea1cf740d2ea0387175df.zip
target/riscv: fix endless translation loop on big endian systems
On big endian systems, pte and updated_pte hold big endian host data
while pte_pa points to little endian target data. This means the branch
at cpu_helper.c:1669 will be always satisfied and restart translation,
causing an endless translation loop.

The correctness of this patch can be deduced by:

old_pte will hold value either from cpu_to_le32/64(pte) or
cpu_to_le32/64(updated_pte), both of wich is litte endian. After that,
an in-place conversion by le32/64_to_cpu(old_pte) ensures that old_pte
now is in native endian, same with pte. Therefore, the endianness of the
both side of if (old_pte != pte) is correct.

Signed-off-by: Ziqiao Kong <ziqiaokong@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250415080254.3667878-2-ziqiaokong@gmail.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Cc: qemu-stable@nongnu.org
Diffstat (limited to 'scripts/qapi/error.py')
0 files changed, 0 insertions, 0 deletions