All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Richard Henderson <rth@twiddle.net>, qemu-devel@nongnu.org
Cc: thuth@redhat.com, aurelien@aurel32.net
Subject: Re: [Qemu-devel] [PATCH v3 18/18] target/s390x: Clean up TB flag bits
Date: Tue, 20 Jun 2017 00:16:59 -0300	[thread overview]
Message-ID: <0448f34c-da90-ef74-b743-7e1f4cf24531@amsat.org> (raw)
In-Reply-To: <20170620000405.3391-19-rth@twiddle.net>

On 06/19/2017 09:04 PM, Richard Henderson wrote:
> Most of the PSW bits that were being copied into TB->flags
> are not relevant to translation.  Removing those that are
> unnecessary reduces the amount of translation required.
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  target/s390x/cpu.h       | 24 +++++++++---------------
>  target/s390x/translate.c | 16 ++++++++--------
>  2 files changed, 17 insertions(+), 23 deletions(-)
>
> diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
> index 5b94ace..9faca04 100644
> --- a/target/s390x/cpu.h
> +++ b/target/s390x/cpu.h
> @@ -346,19 +346,14 @@ void s390x_cpu_debug_excp_handler(CPUState *cs);
>
>  /* tb flags */
>
> -#define FLAG_MASK_PER           (PSW_MASK_PER    >> 32)
> -#define FLAG_MASK_DAT           (PSW_MASK_DAT    >> 32)
> -#define FLAG_MASK_IO            (PSW_MASK_IO     >> 32)
> -#define FLAG_MASK_EXT           (PSW_MASK_EXT    >> 32)
> -#define FLAG_MASK_KEY           (PSW_MASK_KEY    >> 32)
> -#define FLAG_MASK_MCHECK        (PSW_MASK_MCHECK >> 32)
> -#define FLAG_MASK_WAIT          (PSW_MASK_WAIT   >> 32)
> -#define FLAG_MASK_PSTATE        (PSW_MASK_PSTATE >> 32)
> -#define FLAG_MASK_ASC           (PSW_MASK_ASC    >> 32)
> -#define FLAG_MASK_CC            (PSW_MASK_CC     >> 32)
> -#define FLAG_MASK_PM            (PSW_MASK_PM     >> 32)
> -#define FLAG_MASK_64            (PSW_MASK_64     >> 32)
> -#define FLAG_MASK_32            0x00001000
> +#define FLAG_MASK_PSW_SHIFT     31
> +#define FLAG_MASK_PER           (PSW_MASK_PER    >> FLAG_MASK_PSW_SHIFT)
> +#define FLAG_MASK_PSTATE        (PSW_MASK_PSTATE >> FLAG_MASK_PSW_SHIFT)
> +#define FLAG_MASK_ASC           (PSW_MASK_ASC    >> FLAG_MASK_PSW_SHIFT)
> +#define FLAG_MASK_64            (PSW_MASK_64     >> FLAG_MASK_PSW_SHIFT)
> +#define FLAG_MASK_32            (PSW_MASK_32     >> FLAG_MASK_PSW_SHIFT)
> +#define FLAG_MASK_PSW		(FLAG_MASK_PER | FLAG_MASK_PSTATE \
> +                                | FLAG_MASK_ASC | FLAG_MASK_64 | FLAG_MASK_32)
>
>  /* Control register 0 bits */
>  #define CR0_LOWPROT             0x0000000010000000ULL
> @@ -416,8 +411,7 @@ static inline void cpu_get_tb_cpu_state(CPUS390XState* env, target_ulong *pc,
>  {
>      *pc = env->psw.addr;
>      *cs_base = env->ex_value;
> -    *flags = ((env->psw.mask >> 32) & ~FLAG_MASK_CC) |
> -             ((env->psw.mask & PSW_MASK_32) ? FLAG_MASK_32 : 0);
> +    *flags = (env->psw.mask >> FLAG_MASK_PSW_SHIFT) & FLAG_MASK_PSW;
>  }
>
>  #define MAX_ILEN 6
> diff --git a/target/s390x/translate.c b/target/s390x/translate.c
> index 9893551..bee163f 100644
> --- a/target/s390x/translate.c
> +++ b/target/s390x/translate.c
> @@ -323,11 +323,11 @@ static inline uint64_t ld_code4(CPUS390XState *env, uint64_t pc)
>  static int get_mem_index(DisasContext *s)
>  {
>      switch (s->tb->flags & FLAG_MASK_ASC) {
> -    case PSW_ASC_PRIMARY >> 32:
> +    case PSW_ASC_PRIMARY >> FLAG_MASK_PSW_SHIFT:
>          return 0;
> -    case PSW_ASC_SECONDARY >> 32:
> +    case PSW_ASC_SECONDARY >> FLAG_MASK_PSW_SHIFT:
>          return 1;
> -    case PSW_ASC_HOME >> 32:
> +    case PSW_ASC_HOME >> FLAG_MASK_PSW_SHIFT:
>          return 2;
>      default:
>          tcg_abort();
> @@ -387,7 +387,7 @@ static inline void gen_trap(DisasContext *s)
>  #ifndef CONFIG_USER_ONLY
>  static void check_privileged(DisasContext *s)
>  {
> -    if (s->tb->flags & (PSW_MASK_PSTATE >> 32)) {
> +    if (s->tb->flags & FLAG_MASK_PSTATE) {
>          gen_program_exception(s, PGM_PRIVILEGED);
>      }
>  }
> @@ -2985,20 +2985,20 @@ static ExitStatus op_mov2e(DisasContext *s, DisasOps *o)
>      o->g_in2 = false;
>
>      switch (s->tb->flags & FLAG_MASK_ASC) {
> -    case PSW_ASC_PRIMARY >> 32:
> +    case PSW_ASC_PRIMARY >> FLAG_MASK_PSW_SHIFT:
>          tcg_gen_movi_i64(ar1, 0);
>          break;
> -    case PSW_ASC_ACCREG >> 32:
> +    case PSW_ASC_ACCREG >> FLAG_MASK_PSW_SHIFT:
>          tcg_gen_movi_i64(ar1, 1);
>          break;
> -    case PSW_ASC_SECONDARY >> 32:
> +    case PSW_ASC_SECONDARY >> FLAG_MASK_PSW_SHIFT:
>          if (b2) {
>              tcg_gen_ld32u_i64(ar1, cpu_env, offsetof(CPUS390XState, aregs[b2]));
>          } else {
>              tcg_gen_movi_i64(ar1, 0);
>          }
>          break;
> -    case PSW_ASC_HOME >> 32:
> +    case PSW_ASC_HOME >> FLAG_MASK_PSW_SHIFT:
>          tcg_gen_movi_i64(ar1, 2);
>          break;
>      }
>

  reply	other threads:[~2017-06-20  3:17 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20  0:03 [Qemu-devel] [PATCH v3 00/18] target/s390x improvements Richard Henderson
2017-06-20  0:03 ` [Qemu-devel] [PATCH v3 01/18] target/s390x: Map existing FAC_* names to S390_FEAT_* names Richard Henderson
2017-06-23 10:58   ` Aurelien Jarno
2017-06-20  0:03 ` [Qemu-devel] [PATCH v3 02/18] target/s390x: change PSW_SHIFT_KEY Richard Henderson
2017-06-23 10:59   ` Aurelien Jarno
2017-06-20  0:03 ` [Qemu-devel] [PATCH v3 03/18] target/s390x: implement mvcos instruction Richard Henderson
2017-06-20  0:03 ` [Qemu-devel] [PATCH v3 04/18] target/s390x: Implement CSST Richard Henderson
2017-06-20  0:03 ` [Qemu-devel] [PATCH v3 05/18] target/s390x: Mark FPSEH facility as available Richard Henderson
2017-06-23 10:59   ` Aurelien Jarno
2017-06-20  0:03 ` [Qemu-devel] [PATCH v3 06/18] target/s390x: Implement load-on-condition-2 insns Richard Henderson
2017-06-23 11:00   ` Aurelien Jarno
2017-06-20  0:03 ` [Qemu-devel] [PATCH v3 08/18] target/s390x: Mark STFLE_53 facility as available Richard Henderson
2017-06-23 11:01   ` Aurelien Jarno
2017-06-20  0:03 ` [Qemu-devel] [PATCH v3 10/18] target/s390x: Implement processor-assist insn Richard Henderson
2017-06-23 11:01   ` Aurelien Jarno
2017-06-20  0:03 ` [Qemu-devel] [PATCH v3 11/18] target/s390x: Mark STFLE_49 facility as available Richard Henderson
2017-06-23 11:01   ` Aurelien Jarno
2017-06-20  0:03 ` [Qemu-devel] [PATCH v3 12/18] target/s390x: Finish implementing ETF2-ENH Richard Henderson
2017-06-23 11:02   ` Aurelien Jarno
2017-06-20  0:04 ` [Qemu-devel] [PATCH v3 13/18] target/s390x: Implement CONVERT UNICODE insns Richard Henderson
2017-06-23 15:52   ` Aurelien Jarno
2017-06-20  0:04 ` [Qemu-devel] [PATCH v3 14/18] target/s390x: Tidy SRST Richard Henderson
2017-06-20  7:33   ` David Hildenbrand
2017-06-23 15:52   ` Aurelien Jarno
2017-06-20  0:04 ` [Qemu-devel] [PATCH v3 15/18] target/s390x: Implement SRSTU Richard Henderson
2017-06-20  8:12   ` David Hildenbrand
2017-06-20  8:27     ` David Hildenbrand
2017-06-20 17:21       ` Richard Henderson
2017-06-23 15:52   ` Aurelien Jarno
2017-06-20  0:04 ` [Qemu-devel] [PATCH v3 16/18] target/s390x: Implement TRTR Richard Henderson
2017-06-23 15:53   ` Aurelien Jarno
2017-06-20  0:04 ` [Qemu-devel] [PATCH v3 17/18] target/s390x: Mark ETF3 and ETF3_ENH facilities as available Richard Henderson
2017-06-23 15:53   ` Aurelien Jarno
2017-06-20  0:04 ` [Qemu-devel] [PATCH v3 18/18] target/s390x: Clean up TB flag bits Richard Henderson
2017-06-20  3:16   ` Philippe Mathieu-Daudé [this message]
2017-06-23 15:53   ` Aurelien Jarno
     [not found] ` <20170620000405.3391-8-rth@twiddle.net>
2017-06-23 11:01   ` [Qemu-devel] [PATCH v3 07/18] target/s390x: Implement load-and-zero-rightmost-byte insns Aurelien Jarno
     [not found] ` <20170620000405.3391-10-rth@twiddle.net>
2017-06-23 11:01   ` [Qemu-devel] [PATCH v3 09/18] target/s390x: Implement execution-hint insns Aurelien Jarno
2017-06-23 16:05 ` [Qemu-devel] [PATCH v3 00/18] target/s390x improvements Aurelien Jarno
2017-06-27 15:54   ` David Hildenbrand

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=0448f34c-da90-ef74-b743-7e1f4cf24531@amsat.org \
    --to=f4bug@amsat.org \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=thuth@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.