qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: "Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br>
Cc: farosas@linux.ibm.com, richard.henderson@linaro.org,
	qemu-devel@nongnu.org, lucas.araujo@eldorado.org.br,
	fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org,
	matheus.ferst@eldorado.org.br, luis.pires@eldorado.org.br
Subject: Re: [PATCH 01/11] target/ppc: created ppc_{store,get}_vscr for generic vscr usage
Date: Thu, 13 May 2021 13:48:40 +1000	[thread overview]
Message-ID: <YJyhmJTLiylQU1le@yekko> (raw)
In-Reply-To: <20210512140813.112884-2-bruno.larsen@eldorado.org.br>

[-- Attachment #1: Type: text/plain, Size: 5445 bytes --]

On Wed, May 12, 2021 at 11:08:03AM -0300, Bruno Larsen (billionai) wrote:
> Some functions unrelated to TCG use helper_m{t,f}vscr, so generic versions
> of those functions were added to cpu.c, in preparation for compilation
> without TCG
> 
> Signed-off-by: Bruno Larsen (billionai)
> <bruno.larsen@eldorado.org.br>

Applied to ppc-for-6.1, thanks.

> ---
>  target/ppc/arch_dump.c  |  3 +--
>  target/ppc/cpu.c        | 16 ++++++++++++++++
>  target/ppc/cpu.h        |  2 ++
>  target/ppc/cpu_init.c   |  2 +-
>  target/ppc/gdbstub.c    |  4 ++--
>  target/ppc/int_helper.c |  9 ++-------
>  6 files changed, 24 insertions(+), 12 deletions(-)
> 
> diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c
> index 9ab04b2c38..9210e61ef4 100644
> --- a/target/ppc/arch_dump.c
> +++ b/target/ppc/arch_dump.c
> @@ -17,7 +17,6 @@
>  #include "elf.h"
>  #include "sysemu/dump.h"
>  #include "sysemu/kvm.h"
> -#include "exec/helper-proto.h"
>  
>  #ifdef TARGET_PPC64
>  #define ELFCLASS ELFCLASS64
> @@ -176,7 +175,7 @@ static void ppc_write_elf_vmxregset(NoteFuncArg *arg, PowerPCCPU *cpu)
>              vmxregset->avr[i].u64[1] = avr->u64[1];
>          }
>      }
> -    vmxregset->vscr.u32[3] = cpu_to_dump32(s, helper_mfvscr(&cpu->env));
> +    vmxregset->vscr.u32[3] = cpu_to_dump32(s, ppc_get_vscr(&cpu->env));
>  }
>  
>  static void ppc_write_elf_vsxregset(NoteFuncArg *arg, PowerPCCPU *cpu)
> diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c
> index e501a7ff6f..cb794e9f4f 100644
> --- a/target/ppc/cpu.c
> +++ b/target/ppc/cpu.c
> @@ -20,6 +20,7 @@
>  #include "qemu/osdep.h"
>  #include "cpu.h"
>  #include "cpu-models.h"
> +#include "fpu/softfloat-helpers.h"
>  
>  target_ulong cpu_read_xer(CPUPPCState *env)
>  {
> @@ -45,3 +46,18 @@ void cpu_write_xer(CPUPPCState *env, target_ulong xer)
>                         (1ul << XER_OV) | (1ul << XER_CA) |
>                         (1ul << XER_OV32) | (1ul << XER_CA32));
>  }
> +
> +void ppc_store_vscr(CPUPPCState *env, uint32_t vscr)
> +{
> +    env->vscr = vscr & ~(1u << VSCR_SAT);
> +    /* Which bit we set is completely arbitrary, but clear the rest.  */
> +    env->vscr_sat.u64[0] = vscr & (1u << VSCR_SAT);
> +    env->vscr_sat.u64[1] = 0;
> +    set_flush_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status);
> +}
> +
> +uint32_t ppc_get_vscr(CPUPPCState *env)
> +{
> +    uint32_t sat = (env->vscr_sat.u64[0] | env->vscr_sat.u64[1]) != 0;
> +    return env->vscr | (sat << VSCR_SAT);
> +}
> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> index 98fcf1c4d6..f43ceec5cb 100644
> --- a/target/ppc/cpu.h
> +++ b/target/ppc/cpu.h
> @@ -2651,4 +2651,6 @@ static inline bool ppc_has_spr(PowerPCCPU *cpu, int spr)
>  void dump_mmu(CPUPPCState *env);
>  
>  void ppc_maybe_bswap_register(CPUPPCState *env, uint8_t *mem_buf, int len);
> +void ppc_store_vscr(CPUPPCState *env, uint32_t vscr);
> +uint32_t ppc_get_vscr(CPUPPCState *env);
>  #endif /* PPC_CPU_H */
> diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> index faece1dca2..b4a2d15c6a 100644
> --- a/target/ppc/cpu_init.c
> +++ b/target/ppc/cpu_init.c
> @@ -55,7 +55,7 @@ static inline void vscr_init(CPUPPCState *env, uint32_t val)
>  {
>      /* Altivec always uses round-to-nearest */
>      set_float_rounding_mode(float_round_nearest_even, &env->vec_status);
> -    helper_mtvscr(env, val);
> +    ppc_store_vscr(env, val);
>  }
>  
>  /**
> diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c
> index 94a7273ee0..9339e7eafe 100644
> --- a/target/ppc/gdbstub.c
> +++ b/target/ppc/gdbstub.c
> @@ -498,7 +498,7 @@ static int gdb_get_avr_reg(CPUPPCState *env, GByteArray *buf, int n)
>          return 16;
>      }
>      if (n == 32) {
> -        gdb_get_reg32(buf, helper_mfvscr(env));
> +        gdb_get_reg32(buf, ppc_get_vscr(env));
>          mem_buf = gdb_get_reg_ptr(buf, 4);
>          ppc_maybe_bswap_register(env, mem_buf, 4);
>          return 4;
> @@ -529,7 +529,7 @@ static int gdb_set_avr_reg(CPUPPCState *env, uint8_t *mem_buf, int n)
>      }
>      if (n == 32) {
>          ppc_maybe_bswap_register(env, mem_buf, 4);
> -        helper_mtvscr(env, ldl_p(mem_buf));
> +        ppc_store_vscr(env, ldl_p(mem_buf));
>          return 4;
>      }
>      if (n == 33) {
> diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c
> index a44c2d90ea..41f8477d4b 100644
> --- a/target/ppc/int_helper.c
> +++ b/target/ppc/int_helper.c
> @@ -462,17 +462,12 @@ SATCVT(sd, uw, int64_t, uint32_t, 0, UINT32_MAX)
>  
>  void helper_mtvscr(CPUPPCState *env, uint32_t vscr)
>  {
> -    env->vscr = vscr & ~(1u << VSCR_SAT);
> -    /* Which bit we set is completely arbitrary, but clear the rest.  */
> -    env->vscr_sat.u64[0] = vscr & (1u << VSCR_SAT);
> -    env->vscr_sat.u64[1] = 0;
> -    set_flush_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status);
> +    ppc_store_vscr(env, vscr);
>  }
>  
>  uint32_t helper_mfvscr(CPUPPCState *env)
>  {
> -    uint32_t sat = (env->vscr_sat.u64[0] | env->vscr_sat.u64[1]) != 0;
> -    return env->vscr | (sat << VSCR_SAT);
> +    return ppc_get_vscr(env);
>  }
>  
>  static inline void set_vscr_sat(CPUPPCState *env)

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2021-05-13  4:24 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12 14:08 [RFC PATCH 00/11] target/ppc: add support to disable-tcg Bruno Larsen (billionai)
2021-05-12 14:08 ` [PATCH 01/11] target/ppc: created ppc_{store, get}_vscr for generic vscr usage Bruno Larsen (billionai)
2021-05-12 16:48   ` [PATCH 01/11] target/ppc: created ppc_{store,get}_vscr " Richard Henderson
2021-05-13  3:48   ` David Gibson [this message]
2021-05-12 14:08 ` [PATCH 02/11] target/ppc: moved ppc_store_sdr1 to cpu.c Bruno Larsen (billionai)
2021-05-12 16:54   ` Richard Henderson
2021-05-13  3:50   ` David Gibson
2021-05-31 18:17     ` Bruno Piazera Larsen
2021-06-07  3:50       ` David Gibson
2021-05-12 14:08 ` [PATCH 03/11] target/ppc: moved ppc_cpu_dump_state to cpu_init.c Bruno Larsen (billionai)
2021-05-12 16:58   ` Richard Henderson
2021-05-12 17:00     ` Richard Henderson
2021-05-13  3:51   ` David Gibson
2021-05-12 14:08 ` [PATCH 04/11] target/ppc: moved ppc_store_msr into gdbstub.c Bruno Larsen (billionai)
2021-05-12 17:05   ` Richard Henderson
2021-05-13  3:52     ` David Gibson
2021-05-12 14:08 ` [PATCH 05/11] target/ppc: moved ppc_store_lpcr to cpu.c Bruno Larsen (billionai)
2021-05-12 17:07   ` Richard Henderson
2021-05-13  3:53   ` David Gibson
2021-05-12 14:08 ` [PATCH 06/11] target/ppc: updated vscr manipulation in machine.c Bruno Larsen (billionai)
2021-05-12 17:08   ` Richard Henderson
2021-05-13  3:54     ` David Gibson
2021-05-12 14:08 ` [PATCH 07/11] target/ppc: added KVM fallback to fpscr manipulation Bruno Larsen (billionai)
2021-05-12 18:20   ` Richard Henderson
2021-05-12 19:15     ` Bruno Piazera Larsen
2021-05-13 16:36     ` Bruno Piazera Larsen
2021-05-13 22:45       ` Richard Henderson
2021-05-14 11:12         ` Bruno Piazera Larsen
2021-05-12 14:08 ` [RFC PATCH 08/11] target/ppc: wrapped some TCG only logic with ifdefs Bruno Larsen (billionai)
2021-05-12 18:33   ` Richard Henderson
2021-05-12 18:57     ` Bruno Piazera Larsen
2021-05-14 13:29       ` Bruno Piazera Larsen
2021-05-14 14:44         ` Richard Henderson
2021-05-14 16:22           ` Bruno Piazera Larsen
2021-05-17  4:10             ` David Gibson
2021-05-17 16:07               ` Richard Henderson
2021-05-17  4:00           ` David Gibson
2021-05-24 18:01     ` Bruno Piazera Larsen
2021-05-24 20:03       ` Richard Henderson
2021-05-12 14:08 ` [PATCH 09/11] include/exec: added functions to the stubs in exec-all.h Bruno Larsen (billionai)
2021-05-12 18:34   ` Richard Henderson
2021-05-13 14:03     ` Lucas Mateus Martins Araujo e Castro
2021-05-13 23:44       ` Richard Henderson
2021-05-17  3:58         ` David Gibson
2021-05-17 16:59           ` Lucas Mateus Martins Araujo e Castro
2021-05-17 18:02             ` Richard Henderson
2021-05-18 18:45               ` Bruno Piazera Larsen
2021-05-24  3:18             ` David Gibson
2021-05-17  3:55       ` David Gibson
2021-05-17 11:07         ` Bruno Piazera Larsen
2021-05-24  3:15           ` David Gibson
2021-05-12 14:08 ` [RFC PATCH 10/11] target/ppc: created tcg-stub.c file Bruno Larsen (billionai)
2021-05-12 18:39   ` Richard Henderson
2021-05-12 19:09     ` Bruno Piazera Larsen
2021-05-14 18:07     ` Bruno Piazera Larsen
2021-05-13  3:59   ` David Gibson
2021-05-13 12:56     ` Bruno Piazera Larsen
2021-05-17  3:53       ` David Gibson
2021-05-12 14:08 ` [PATCH 11/11] target/ppc: updated meson.build to support disable-tcg Bruno Larsen (billionai)

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=YJyhmJTLiylQU1le@yekko \
    --to=david@gibson.dropbear.id.au \
    --cc=bruno.larsen@eldorado.org.br \
    --cc=farosas@linux.ibm.com \
    --cc=fernando.valle@eldorado.org.br \
    --cc=lucas.araujo@eldorado.org.br \
    --cc=luis.pires@eldorado.org.br \
    --cc=matheus.ferst@eldorado.org.br \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=richard.henderson@linaro.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).