qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 13/21] target/arm: Don't set ISV when reporting stage 1 faults in ESR_EL2
Date: Thu, 20 Apr 2023 11:04:48 +0100	[thread overview]
Message-ID: <20230420100456.944969-14-peter.maydell@linaro.org> (raw)
In-Reply-To: <20230420100456.944969-1-peter.maydell@linaro.org>

The syndrome value reported to ESR_EL2 should only contain the
detailed instruction syndrome information when the fault has been
caused by a stage 2 abort, not when the fault was a stage 1 abort
(i.e.  caused by execution at EL2).  We were getting this wrong and
reporting the detailed ISV information all the time.

Fix the bug by checking fi->stage2.  Add a TODO comment noting the
cases where we'll have to come back and revisit this when we
implement FEAT_LS64 and friends.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230331145045.2584941-3-peter.maydell@linaro.org
---
 target/arm/tcg/tlb_helper.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c
index 1a61adb8a68..d5a89bc5141 100644
--- a/target/arm/tcg/tlb_helper.c
+++ b/target/arm/tcg/tlb_helper.c
@@ -32,8 +32,9 @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
     uint32_t syn;
 
     /*
-     * ISV is only set for data aborts routed to EL2 and
-     * never for stage-1 page table walks faulting on stage 2.
+     * ISV is only set for stage-2 data aborts routed to EL2 and
+     * never for stage-1 page table walks faulting on stage 2
+     * or for stage-1 faults.
      *
      * Furthermore, ISV is only set for certain kinds of load/stores.
      * If the template syndrome does not have ISV set, we should leave
@@ -42,8 +43,14 @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
      * See ARMv8 specs, D7-1974:
      * ISS encoding for an exception from a Data Abort, the
      * ISV field.
+     *
+     * TODO: FEAT_LS64/FEAT_LS64_V/FEAT_SL64_ACCDATA: Translation,
+     * Access Flag, and Permission faults caused by LD64B, ST64B,
+     * ST64BV, or ST64BV0 insns report syndrome info even for stage-1
+     * faults and regardless of the target EL.
      */
-    if (!(template_syn & ARM_EL_ISV) || target_el != 2 || fi->s1ptw) {
+    if (!(template_syn & ARM_EL_ISV) || target_el != 2
+        || fi->s1ptw || !fi->stage2) {
         syn = syn_data_abort_no_iss(same_el, 0,
                                     fi->ea, 0, fi->s1ptw, is_write, fsc);
     } else {
-- 
2.34.1



  parent reply	other threads:[~2023-04-20 10:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 10:04 [PULL 00/21] target-arm queue Peter Maydell
2023-04-20 10:04 ` [PULL 01/21] hw/arm: Fix some typos in comments (most found by codespell) Peter Maydell
2023-04-20 10:04 ` [PULL 02/21] exynos: Fix out-of-bounds access in exynos4210_gcomp_find debug printf Peter Maydell
2023-04-20 10:04 ` [PULL 03/21] hw/watchdog: Allwinner WDT emulation for system reset Peter Maydell
2023-04-20 10:04 ` [PULL 04/21] hw/arm: Add WDT to Allwinner-A10 and Cubieboard Peter Maydell
2023-04-20 10:04 ` [PULL 05/21] hw/arm: Add WDT to Allwinner-H3 and Orangepi-PC Peter Maydell
2023-04-20 10:04 ` [PULL 06/21] tests/avocado: Add reboot tests to Cubieboard Peter Maydell
2023-04-20 10:04 ` [PULL 07/21] hw/timer/imx_epit: don't shadow variable Peter Maydell
2023-04-20 10:04 ` [PULL 08/21] hw/timer/imx_epit: fix limit check Peter Maydell
2023-04-20 10:04 ` [PULL 09/21] target/arm: Remove KVM AArch32 CPU definitions Peter Maydell
2023-04-20 10:04 ` [PULL 10/21] hw/arm/virt: Restrict Cortex-A7 check to TCG Peter Maydell
2023-04-20 10:04 ` [PULL 11/21] target/arm: Initialize debug capabilities only once Peter Maydell
2023-04-20 10:04 ` [PULL 12/21] target/arm: Pass ARMMMUFaultInfo to merge_syn_data_abort() Peter Maydell
2023-04-20 10:04 ` Peter Maydell [this message]
2023-04-20 10:04 ` [PULL 14/21] target/arm: Implement FEAT_PAN3 Peter Maydell
2023-04-20 10:04 ` [PULL 15/21] docs/devel/kconfig.rst: Fix incorrect markup Peter Maydell
2023-04-20 10:04 ` [PULL 16/21] target/arm: Report pauth information to gdb as 'pauth_v2' Peter Maydell
2023-04-20 10:04 ` [PULL 17/21] hw/net/imx_fec: Support two Ethernet interfaces connected to single MDIO bus Peter Maydell
2023-04-20 10:04 ` [PULL 18/21] fsl-imx6ul: Add fec[12]-phy-connected properties Peter Maydell
2023-04-20 10:04 ` [PULL 19/21] arm/mcimx6ul-evk: Set fec1-phy-connected property to false Peter Maydell
2023-04-20 10:04 ` [PULL 20/21] fsl-imx7: Add fec[12]-phy-connected properties Peter Maydell
2023-04-20 10:04 ` [PULL 21/21] arm/mcimx7d-sabre: Set fec2-phy-connected property to false Peter Maydell
2023-04-21 10:49 ` [PULL 00/21] target-arm queue Richard Henderson
2023-04-21 11:54   ` Peter Maydell

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=20230420100456.944969-14-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.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).