qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ziqiao Kong <ziqiaokong@gmail.com>
To: qemu-devel@nongnu.org
Cc: ziqiaokong@gmail.com, qemu-trivial@nongnu.org,
	alistair.francis@wdc.com, richard.henderson@linaro.org
Subject: [PATCH v2 0/1] Fix endless translation loop of riscv
Date: Mon, 14 Apr 2025 11:46:25 +0800	[thread overview]
Message-ID: <20250414034626.3491489-1-ziqiaokong@gmail.com> (raw)

Sorry for sending this again as I found previous patch series does not
work on riscv32 due to target_ulong is not le64. Please ignore my
previous v1 patch. Below is the original cover letter to illustrate the
purpose of the patch:

Hello! I'm Ziqiao Kong, the maintainer of Unicorn Engine, a fork of
QEMU. When I port Unicorn Engine to s390x, I notice there is a bug in
the implementation of RISCV MMU. It uses qemu_map_ram_ptr to get a
pointer and reads it directly, instead of bswap or address_space_ldl,
which causes an endless translation loop on big endian systems like
s390x I'm working on. Therefore, a quick fix to this is to call
cpu_to_le64 for cmpxchg as this patch shows.

This patch passes our unit tests and the error is somewhat obvious
(unhandled endianness discrepancy). Therefore, I'm rather confident
that QEMU aslo needs this patch. Given the changes are small and don't
impact most popular little endian platforms, I think this fits into
trivial patches.


Ziqiao Kong (1):
  target/riscv: fix endless translation loop on big endian systems

 target/riscv/cpu_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.34.1



             reply	other threads:[~2025-04-14  3:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14  3:46 Ziqiao Kong [this message]
2025-04-14  3:46 ` [PATCH v2 1/1] target/riscv: fix endless translation loop on big endian systems Ziqiao Kong
2025-04-14 10:41   ` Philippe Mathieu-Daudé
2025-04-14 11:17     ` Ziqiao Kong
2025-04-14 16:59       ` Ziqiao Kong
2025-04-14 17:38         ` Philippe Mathieu-Daudé
     [not found]           ` <CAM0BWNBNrjJ6UuF+TRtkuEesLatnY1pzSjyaiPVDeKSMF8no-A@mail.gmail.com>
2025-04-15  7:04             ` Ziqiao Kong
2025-04-15  7:15               ` Philippe Mathieu-Daudé
2025-04-15  7:19                 ` Ziqiao Kong
2025-04-15  7:22                   ` Ziqiao Kong
2025-04-15  7:40                     ` Ziqiao Kong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250414034626.3491489-1-ziqiaokong@gmail.com \
    --to=ziqiaokong@gmail.com \
    --cc=alistair.francis@wdc.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).