From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: [PATCH 0/3] target/arm: Fix LDRD, STRD atomicity, fault behaviour
Date: Thu, 27 Feb 2025 14:27:43 +0000 [thread overview]
Message-ID: <20250227142746.1698904-1-peter.maydell@linaro.org> (raw)
Our LDRD and STRD implementations have a couple of bugs:
* if the LDRD address is 4-aligned and the load crosses a page boundary
and the second load faults and the first load was to the base register
(as in cases like "ldrd r2, r3, [r2]", then we must not update the base
register before taking the fault. Our current implementation does
a sequence of "32 bit load; write to Rt; 32-bit load; write to Rt2"
so it mishandles this kind of insn.
* if the address is 8-aligned the access must be a 64-bit
single-copy atomic access, not two 32-bit accesses.
This patchseries fixes both of these bugs, and then cleans up an
argument to some utility functions that we no longer need after
the first two changes.
Note for reviewers: please check that I got the MemOp right:
I believe that MO_64 | MO_ALIGN_4 | MO_ATOM_SUBALIGN expresses
"8-aligned addresses should be 64-bit atomic, 4-aligned addresses
should be 32-bit atomic, less-aligned addresses fault" but I'm
not sure if I've correctly understood MO_ATOM_SUBALIGN.
Thanks to Stu Grossman for reporting the page-boundary-crossing
fault bug, which prompted me to look a bit closer at the code and
notice that we weren't doing the atomicity right either.
thanks
-- PMM
Peter Maydell (3):
target/arm: Correct LDRD atomicity and fault behaviour
target/arm: Correct STRD atomicity
target/arm: Drop unused address_offset from op_addr_{rr,ri}_post()
target/arm/tcg/translate.c | 137 +++++++++++++++++++++++--------------
1 file changed, 84 insertions(+), 53 deletions(-)
--
2.43.0
next reply other threads:[~2025-02-27 14:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 14:27 Peter Maydell [this message]
2025-02-27 14:27 ` [PATCH 1/3] target/arm: Correct LDRD atomicity and fault behaviour Peter Maydell
2025-02-27 17:40 ` Richard Henderson
2025-02-27 17:58 ` Peter Maydell
2025-02-28 0:18 ` Richard Henderson
2025-02-28 9:37 ` Peter Maydell
2025-02-27 14:27 ` [PATCH 2/3] target/arm: Correct STRD atomicity Peter Maydell
2025-02-27 17:42 ` Richard Henderson
2025-02-27 14:27 ` [PATCH 3/3] target/arm: Drop unused address_offset from op_addr_{rr, ri}_post() Peter Maydell
2025-02-27 17:43 ` Richard Henderson
2025-02-27 22:23 ` Philippe Mathieu-Daudé
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=20250227142746.1698904-1-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.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).