From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, alex.bennee@linaro.org
Subject: [PATCH v2 08/15] target/arm: Prepare DBGBVR and DBGWVR for FEAT_LVA
Date: Thu, 10 Feb 2022 15:04:16 +1100 [thread overview]
Message-ID: <20220210040423.95120-9-richard.henderson@linaro.org> (raw)
In-Reply-To: <20220210040423.95120-1-richard.henderson@linaro.org>
The original A.a revision of the AArch64 ARM required that we
force-extend the addresses in these registers from 49 bits.
This language has been loosened via a combination of IMPLEMENTATION
DEFINED and CONSTRAINTED UNPREDICTABLE to allow consideration of
the entire aligned address.
This means that we do not have to consider whether or not FEAT_LVA
is enabled, and decide from which bit an address might need to be
extended.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/helper.c | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 015f992f02..e5050816cf 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -6421,11 +6421,18 @@ static void dbgwvr_write(CPUARMState *env, const ARMCPRegInfo *ri,
ARMCPU *cpu = env_archcpu(env);
int i = ri->crm;
- /* Bits [63:49] are hardwired to the value of bit [48]; that is, the
- * register reads and behaves as if values written are sign extended.
+ /*
* Bits [1:0] are RES0.
+ *
+ * It is IMPLEMENTATION DEFINED whether [63:49] ([63:53] with FEAT_LVA)
+ * are hardwired to the value of bit [48] ([52] with FEAT_LVA), or if
+ * they contain the value written. It is CONSTRAINED UNPREDICTABLE
+ * whether the RESS bits are ignored when comparing an address.
+ *
+ * Therefore we are allowed to compare the entire register, which lets
+ * us avoid considering whether or not FEAT_LVA is actually enabled.
*/
- value = sextract64(value, 0, 49) & ~3ULL;
+ value &= ~3ULL;
raw_write(env, ri, value);
hw_watchpoint_update(cpu, i);
@@ -6471,10 +6478,19 @@ void hw_breakpoint_update(ARMCPU *cpu, int n)
case 0: /* unlinked address match */
case 1: /* linked address match */
{
- /* Bits [63:49] are hardwired to the value of bit [48]; that is,
- * we behave as if the register was sign extended. Bits [1:0] are
- * RES0. The BAS field is used to allow setting breakpoints on 16
- * bit wide instructions; it is CONSTRAINED UNPREDICTABLE whether
+ /*
+ * Bits [1:0] are RES0.
+ *
+ * It is IMPLEMENTATION DEFINED whether bits [63:49]
+ * ([63:53] for FEAT_LVA) are hardwired to a copy of the sign bit
+ * of the VA field ([48] or [52] for FEAT_LVA), or whether the
+ * value is read as written. It is CONSTRAINED UNPREDICTABLE
+ * whether the RESS bits are ignored when comparing an address.
+ * Therefore we are allowed to compare the entire register, which
+ * lets us avoid considering whether FEAT_LVA is actually enabled.
+ *
+ * The BAS field is used to allow setting breakpoints on 16-bit
+ * wide instructions; it is CONSTRAINED UNPREDICTABLE whether
* a bp will fire if the addresses covered by the bp and the addresses
* covered by the insn overlap but the insn doesn't start at the
* start of the bp address range. We choose to require the insn and
@@ -6487,7 +6503,7 @@ void hw_breakpoint_update(ARMCPU *cpu, int n)
* See also figure D2-3 in the v8 ARM ARM (DDI0487A.c).
*/
int bas = extract64(bcr, 5, 4);
- addr = sextract64(bvr, 0, 49) & ~3ULL;
+ addr = bvr & ~3ULL;
if (bas == 0) {
return;
}
--
2.25.1
next prev parent reply other threads:[~2022-02-10 4:16 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-10 4:04 [PATCH v2 00/15] target/arm: Implement LVA, LPA, LPA2 features Richard Henderson
2022-02-10 4:04 ` [PATCH v2 01/15] hw/registerfields: Add FIELD_SEX<N> and FIELD_SDP<N> Richard Henderson
2022-02-10 11:15 ` Philippe Mathieu-Daudé via
2022-02-10 4:04 ` [PATCH v2 02/15] target/arm: Set TCR_EL1.TSZ for user-only Richard Henderson
2022-02-15 21:50 ` Peter Maydell
2022-02-10 4:04 ` [PATCH v2 03/15] target/arm: Fault on invalid TCR_ELx.TxSZ Richard Henderson
2022-02-15 21:51 ` Peter Maydell
2022-02-10 4:04 ` [PATCH v2 04/15] target/arm: Move arm_pamax out of line Richard Henderson
2022-02-15 21:51 ` Peter Maydell
2022-02-10 4:04 ` [PATCH v2 05/15] target/arm: Pass outputsize down to check_s2_mmu_setup Richard Henderson
2022-02-15 21:57 ` Peter Maydell
2022-02-10 4:04 ` [PATCH v2 06/15] target/arm: Use MAKE_64BIT_MASK to compute indexmask Richard Henderson
2022-02-10 11:15 ` Philippe Mathieu-Daudé via
2022-02-10 4:04 ` [PATCH v2 07/15] target/arm: Honor TCR_ELx.{I}PS Richard Henderson
2022-02-15 22:01 ` Peter Maydell
2022-02-10 4:04 ` Richard Henderson [this message]
2022-02-15 22:03 ` [PATCH v2 08/15] target/arm: Prepare DBGBVR and DBGWVR for FEAT_LVA Peter Maydell
2022-02-10 4:04 ` [PATCH v2 09/15] target/arm: Implement FEAT_LVA Richard Henderson
2022-02-15 22:05 ` Peter Maydell
2022-02-10 4:04 ` [PATCH v2 10/15] target/arm: Implement FEAT_LPA Richard Henderson
2022-02-15 22:06 ` Peter Maydell
2022-02-10 4:04 ` [PATCH v2 11/15] target/arm: Extend arm_fi_to_lfsc to level -1 Richard Henderson
2022-02-15 22:11 ` Peter Maydell
2022-02-10 4:04 ` [PATCH v2 12/15] target/arm: Introduce tlbi_aa64_get_range Richard Henderson
2022-02-15 22:14 ` Peter Maydell
2022-02-10 4:04 ` [PATCH v2 13/15] target/arm: Fix TLBIRange.base for 16k and 64k pages Richard Henderson
2022-02-15 22:18 ` Peter Maydell
2022-02-10 4:04 ` [PATCH v2 14/15] target/arm: Validate tlbi TG matches translation granule in use Richard Henderson
2022-02-15 22:24 ` Peter Maydell
2022-02-10 4:04 ` [PATCH v2 15/15] target/arm: Implement FEAT_LPA2 Richard Henderson
2022-02-16 17:50 ` Peter Maydell
2022-02-16 17:51 ` [PATCH v2 00/15] target/arm: Implement LVA, LPA, LPA2 features Peter Maydell
2022-02-17 14:07 ` Peter Maydell
2022-02-17 17:37 ` Alex Bennée
2022-02-18 3:47 ` Richard Henderson
2022-02-23 21:08 ` Richard Henderson
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=20220210040423.95120-9-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=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).