qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v5 16/17] target/arm: Rebuild hflags at EL changes and MSR writes
Date: Thu, 05 Sep 2019 14:53:05 +0100	[thread overview]
Message-ID: <87a7bi97em.fsf@linaro.org> (raw)
In-Reply-To: <20190820210720.18976-17-richard.henderson@linaro.org>


Richard Henderson <richard.henderson@linaro.org> writes:

> Now setting, but not relying upon, env->hflags.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  linux-user/syscall.c       |  1 +
>  target/arm/cpu.c           |  1 +
>  target/arm/helper-a64.c    |  3 +++
>  target/arm/helper.c        |  2 ++
>  target/arm/machine.c       |  1 +
>  target/arm/op_helper.c     |  1 +
>  target/arm/translate-a64.c |  6 +++++-
>  target/arm/translate.c     | 18 ++++++++++++++++--
>  8 files changed, 30 insertions(+), 3 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 8b41a03901..be01c33759 100644
<snip>

I had to manually fix these up due to the patch failing to apply. I
think because 9e9b10c64911 removes the gen_io_end() calls.

> diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
> index fc3e5f5c38..4412c60383 100644
> --- a/target/arm/translate-a64.c
> +++ b/target/arm/translate-a64.c
> @@ -1777,11 +1777,15 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
>          /* I/O operations must end the TB here (whether read or write) */
>          gen_io_end();
>          s->base.is_jmp = DISAS_UPDATE;
> -    } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) {
> +    }
> +    if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) {
>          /* We default to ending the TB on a coprocessor register write,
>           * but allow this to be suppressed by the register definition
>           * (usually only necessary to work around guest bugs).
>           */
> +        TCGv_i32 tcg_el = tcg_const_i32(s->current_el);
> +        gen_helper_rebuild_hflags_a64(cpu_env, tcg_el);
> +        tcg_temp_free_i32(tcg_el);
>          s->base.is_jmp = DISAS_UPDATE;
>      }
>  }
> diff --git a/target/arm/translate.c b/target/arm/translate.c
> index d948757131..2f7beca065 100644
> --- a/target/arm/translate.c
> +++ b/target/arm/translate.c
> @@ -7130,6 +7130,8 @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn)
>      ri = get_arm_cp_reginfo(s->cp_regs,
>              ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2));
>      if (ri) {
> +        bool need_exit_tb;
> +
>          /* Check access permissions */
>          if (!cp_access_ok(s->current_el, ri, isread)) {
>              return 1;
> @@ -7301,15 +7303,27 @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn)
>              }
>          }
>
> +        need_exit_tb = false;
>          if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) {
>              /* I/O operations must end the TB here (whether read or write) */
>              gen_io_end();
> -            gen_lookup_tb(s);
> -        } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) {
> +            need_exit_tb = true;
> +        }
> +        if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) {
>              /* We default to ending the TB on a coprocessor register write,
>               * but allow this to be suppressed by the register definition
>               * (usually only necessary to work around guest bugs).
>               */
> +            TCGv_i32 tcg_el = tcg_const_i32(s->current_el);
> +            if (arm_dc_feature(s, ARM_FEATURE_M)) {
> +                gen_helper_rebuild_hflags_m32(cpu_env, tcg_el);
> +            } else {
> +                gen_helper_rebuild_hflags_a32(cpu_env, tcg_el);
> +            }
> +            tcg_temp_free_i32(tcg_el);
> +            need_exit_tb = true;
> +        }
> +        if (need_exit_tb) {
>              gen_lookup_tb(s);
>          }


--
Alex Bennée


  reply	other threads:[~2019-09-05 13:54 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-20 21:07 [Qemu-devel] [PATCH v5 00/17] target/arm: Reduce overhead of cpu_get_tb_cpu_state Richard Henderson
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 01/17] target/arm: Split out rebuild_hflags_common Richard Henderson
2019-09-05 13:58   ` [Qemu-devel] [Qemu-arm] " Alex Bennée
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 02/17] target/arm: Split out rebuild_hflags_a64 Richard Henderson
2019-09-05 15:28   ` [Qemu-devel] [Qemu-arm] " Alex Bennée
2019-09-06  3:26     ` Richard Henderson
2019-09-06 15:52       ` Alex Bennée
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 03/17] target/arm: Split out rebuild_hflags_common_32 Richard Henderson
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 04/17] target/arm: Split arm_cpu_data_is_big_endian Richard Henderson
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 05/17] target/arm: Split out rebuild_hflags_m32 Richard Henderson
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 06/17] target/arm: Reduce tests vs M-profile in cpu_get_tb_cpu_state Richard Henderson
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 07/17] target/arm: Split out rebuild_hflags_a32 Richard Henderson
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 08/17] target/arm: Split out rebuild_hflags_aprofile Richard Henderson
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 09/17] target/arm: Hoist XSCALE_CPAR, VECLEN, VECSTRIDE in cpu_get_tb_cpu_state Richard Henderson
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 10/17] target/arm: Simplify set of PSTATE_SS " Richard Henderson
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 11/17] target/arm: Hoist computation of TBFLAG_A32.VFPEN Richard Henderson
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 12/17] target/arm: Add arm_rebuild_hflags Richard Henderson
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 13/17] target/arm: Split out arm_mmu_idx_el Richard Henderson
2019-09-06  7:12   ` Philippe Mathieu-Daudé
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 14/17] target/arm: Hoist store to cs_base in cpu_get_tb_cpu_state Richard Henderson
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 15/17] target/arm: Add HELPER(rebuild_hflags_{a32, a64, m32}) Richard Henderson
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 16/17] target/arm: Rebuild hflags at EL changes and MSR writes Richard Henderson
2019-09-05 13:53   ` Alex Bennée [this message]
2019-08-20 21:07 ` [Qemu-devel] [PATCH v5 17/17] target/arm: Rely on hflags correct in cpu_get_tb_cpu_state Richard Henderson
2019-09-05 15:23   ` [Qemu-devel] [Qemu-arm] " Alex Bennée
2019-09-05 15:40     ` Laurent Desnogues
2019-09-05 15:50       ` Alex Bennée
2019-09-06  3:02         ` Richard Henderson
2019-08-20 23:54 ` [Qemu-devel] [PATCH v5 00/17] target/arm: Reduce overhead of cpu_get_tb_cpu_state Richard Henderson
2019-09-04 10:48   ` Peter Maydell
2019-09-04 17:26     ` 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=87a7bi97em.fsf@linaro.org \
    --to=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).