From: Richard Henderson <richard.henderson@linaro.org>
To: Ziqiao Kong <ziqiaokong@gmail.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, alistair.francis@wdc.com,
philmd@linaro.org, pbonzini@redhat.com
Subject: Re: [PATCH v3 1/1] target/riscv: fix endless translation loop on big endian systems
Date: Tue, 15 Apr 2025 07:32:41 -0700 [thread overview]
Message-ID: <de4fba03-c9dd-4ff9-8f4d-8feaff52703b@linaro.org> (raw)
In-Reply-To: <20250415080254.3667878-2-ziqiaokong@gmail.com>
On 4/15/25 01:02, Ziqiao Kong wrote:
> 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>
> ---
> target/riscv/cpu_helper.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
next prev parent reply other threads:[~2025-04-15 14:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-15 8:02 [PATCH v3 0/1] Fix endless translation loop of riscv Ziqiao Kong
2025-04-15 8:02 ` [PATCH v3 1/1] target/riscv: fix endless translation loop on big endian systems Ziqiao Kong
2025-04-15 14:32 ` Richard Henderson [this message]
2025-04-16 4:33 ` Alistair Francis
2025-04-16 5:53 ` [PATCH v3 0/1] Fix endless translation loop of riscv Alistair Francis
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=de4fba03-c9dd-4ff9-8f4d-8feaff52703b@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=ziqiaokong@gmail.com \
/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).