qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH 2/6] target/arm: Fix SVE system register access checks
Date: Thu, 28 Jun 2018 17:15:34 -0700	[thread overview]
Message-ID: <20180629001538.11415-3-richard.henderson@linaro.org> (raw)
In-Reply-To: <20180629001538.11415-1-richard.henderson@linaro.org>

Leave ARM_CP_SVE, removing ARM_CP_FPU; the sve_access_check
produced by the flag already includes fp_access_check.  If
we also check ARM_CP_FPU the double fp_access_check asserts.

Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/helper.c        | 8 ++++----
 target/arm/translate-a64.c | 5 ++---
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index b19c7ace78..a855da045b 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -4393,7 +4393,7 @@ static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
 static const ARMCPRegInfo zcr_el1_reginfo = {
     .name = "ZCR_EL1", .state = ARM_CP_STATE_AA64,
     .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 0,
-    .access = PL1_RW, .type = ARM_CP_SVE | ARM_CP_FPU,
+    .access = PL1_RW, .type = ARM_CP_SVE,
     .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[1]),
     .writefn = zcr_write, .raw_writefn = raw_write
 };
@@ -4401,7 +4401,7 @@ static const ARMCPRegInfo zcr_el1_reginfo = {
 static const ARMCPRegInfo zcr_el2_reginfo = {
     .name = "ZCR_EL2", .state = ARM_CP_STATE_AA64,
     .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0,
-    .access = PL2_RW, .type = ARM_CP_SVE | ARM_CP_FPU,
+    .access = PL2_RW, .type = ARM_CP_SVE,
     .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[2]),
     .writefn = zcr_write, .raw_writefn = raw_write
 };
@@ -4409,14 +4409,14 @@ static const ARMCPRegInfo zcr_el2_reginfo = {
 static const ARMCPRegInfo zcr_no_el2_reginfo = {
     .name = "ZCR_EL2", .state = ARM_CP_STATE_AA64,
     .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0,
-    .access = PL2_RW, .type = ARM_CP_SVE | ARM_CP_FPU,
+    .access = PL2_RW, .type = ARM_CP_SVE,
     .readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore
 };
 
 static const ARMCPRegInfo zcr_el3_reginfo = {
     .name = "ZCR_EL3", .state = ARM_CP_STATE_AA64,
     .opc0 = 3, .opc1 = 6, .crn = 1, .crm = 2, .opc2 = 0,
-    .access = PL3_RW, .type = ARM_CP_SVE | ARM_CP_FPU,
+    .access = PL3_RW, .type = ARM_CP_SVE,
     .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[3]),
     .writefn = zcr_write, .raw_writefn = raw_write
 };
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index f986340832..45a6c2a3aa 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -1633,11 +1633,10 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
     default:
         break;
     }
-    if ((ri->type & ARM_CP_SVE) && !sve_access_check(s)) {
-        return;
-    }
     if ((ri->type & ARM_CP_FPU) && !fp_access_check(s)) {
         return;
+    } else if ((ri->type & ARM_CP_SVE) && !sve_access_check(s)) {
+        return;
     }
 
     if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) {
-- 
2.17.1

  parent reply	other threads:[~2018-06-29  0:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29  0:15 [Qemu-devel] [PATCH 0/6] target/arm SVE updates Richard Henderson
2018-06-29  0:15 ` [Qemu-devel] [PATCH 1/6] target/arm: Fix SVE signed division vs x86 overflow exception Richard Henderson
2018-06-29  0:42   ` Philippe Mathieu-Daudé
2018-06-29  8:29   ` Peter Maydell
2018-06-29  9:10     ` Peter Maydell
2018-06-29 14:43       ` Richard Henderson
2018-06-29  0:15 ` Richard Henderson [this message]
2018-06-29  0:48   ` [Qemu-devel] [PATCH 2/6] target/arm: Fix SVE system register access checks Philippe Mathieu-Daudé
2018-06-29  8:30   ` Peter Maydell
2018-06-29  9:23   ` Laurent Desnogues
2018-06-29  0:15 ` [Qemu-devel] [PATCH 3/6] target/arm: Prune a57 features from max Richard Henderson
2018-06-29  0:38   ` Philippe Mathieu-Daudé
2018-06-29  8:31   ` Peter Maydell
2018-06-29  0:15 ` [Qemu-devel] [PATCH 4/6] target/arm: Prune a15 " Richard Henderson
2018-06-29  0:39   ` Philippe Mathieu-Daudé
2018-06-29  8:32   ` Peter Maydell
2018-06-29  0:15 ` [Qemu-devel] [PATCH 5/6] target/arm: Add ID_ISAR6 Richard Henderson
2018-06-29  0:57   ` Philippe Mathieu-Daudé
2018-06-29  1:09     ` Philippe Mathieu-Daudé
2018-06-29  3:51     ` Richard Henderson
2018-06-29  8:40   ` Peter Maydell
2018-06-29 14:47     ` Richard Henderson
2018-06-29  0:15 ` [Qemu-devel] [PATCH 6/6] target/arm: Set ISAR bits for -cpu max Richard Henderson
2018-06-29  1:03   ` Philippe Mathieu-Daudé
2018-06-29  8:42   ` Peter Maydell
2018-06-29 14:54     ` Richard Henderson
2018-06-29 15:08       ` Peter Maydell
2018-06-29  1:06 ` [Qemu-devel] [PATCH 0/6] target/arm SVE updates 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=20180629001538.11415-3-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=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).