qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aleksandar Markovic <aleksandar.m.mail@gmail.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH 06/28] cputlb: Rename helper_ret_ld*_cmmu to cpu_ld*_code
Date: Thu, 12 Dec 2019 10:33:19 +0100	[thread overview]
Message-ID: <CAL1e-=g14O66k5E9CF9vRZgkOw3yMB35rpRKfrf9AG=xDiuCJA@mail.gmail.com> (raw)
In-Reply-To: <20191212040039.26546-7-richard.henderson@linaro.org>

On Thu, Dec 12, 2019 at 5:07 AM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> There are no uses of the *_cmmu names other than the bare wrapping
> within the *_code inlines.  Therefore rename the functions so we
> can drop the inlines.
>
> Use abi_ptr instead of target_ulong in preparation for user-only;
> the two types are identical for softmmu.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>

>  include/exec/cpu_ldst.h          | 29 ++++------
>  include/exec/cpu_ldst_template.h | 21 -------
>  tcg/tcg.h                        | 29 ----------
>  accel/tcg/cputlb.c               | 94 ++++++++------------------------
>  docs/devel/loads-stores.rst      |  4 +-
>  5 files changed, 36 insertions(+), 141 deletions(-)
>
> diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
> index 399ff6c3da..ef59ed61e4 100644
> --- a/include/exec/cpu_ldst.h
> +++ b/include/exec/cpu_ldst.h
> @@ -450,25 +450,20 @@ void cpu_stq_mmuidx_ra(CPUArchState *env, abi_ptr addr, uint64_t val,
>  #undef CPU_MMU_INDEX
>  #undef MEMSUFFIX
>
> -#define CPU_MMU_INDEX (cpu_mmu_index(env, true))
> -#define MEMSUFFIX _code
> -#define SOFTMMU_CODE_ACCESS
> +uint32_t cpu_ldub_code(CPUArchState *env, abi_ptr addr);
> +uint32_t cpu_lduw_code(CPUArchState *env, abi_ptr addr);
> +uint32_t cpu_ldl_code(CPUArchState *env, abi_ptr addr);
> +uint64_t cpu_ldq_code(CPUArchState *env, abi_ptr addr);
>
> -#define DATA_SIZE 1
> -#include "exec/cpu_ldst_template.h"
> +static inline int cpu_ldsb_code(CPUArchState *env, abi_ptr addr)
> +{
> +    return (int8_t)cpu_ldub_code(env, addr);
> +}
>
> -#define DATA_SIZE 2
> -#include "exec/cpu_ldst_template.h"
> -
> -#define DATA_SIZE 4
> -#include "exec/cpu_ldst_template.h"
> -
> -#define DATA_SIZE 8
> -#include "exec/cpu_ldst_template.h"
> -
> -#undef CPU_MMU_INDEX
> -#undef MEMSUFFIX
> -#undef SOFTMMU_CODE_ACCESS
> +static inline int cpu_ldsw_code(CPUArchState *env, abi_ptr addr)
> +{
> +    return (int16_t)cpu_lduw_code(env, addr);
> +}
>
>  #endif /* defined(CONFIG_USER_ONLY) */
>
> diff --git a/include/exec/cpu_ldst_template.h b/include/exec/cpu_ldst_template.h
> index ea39e29c19..e400979f23 100644
> --- a/include/exec/cpu_ldst_template.h
> +++ b/include/exec/cpu_ldst_template.h
> @@ -58,25 +58,6 @@
>
>  /* generic load/store macros */
>
> -#ifdef SOFTMMU_CODE_ACCESS
> -
> -static inline RES_TYPE
> -glue(glue(cpu_ld, USUFFIX), _code)(CPUArchState *env, target_ulong ptr)
> -{
> -    TCGMemOpIdx oi = make_memop_idx(MO_TE | SHIFT, CPU_MMU_INDEX);
> -    return glue(glue(helper_ret_ld, USUFFIX), _cmmu)(env, ptr, oi, 0);
> -}
> -
> -#if DATA_SIZE <= 2
> -static inline int
> -glue(glue(cpu_lds, SUFFIX), _code)(CPUArchState *env, target_ulong ptr)
> -{
> -    return (DATA_STYPE)glue(glue(cpu_ld, USUFFIX), _code)(env, ptr);
> -}
> -#endif
> -
> -#else
> -
>  static inline RES_TYPE
>  glue(glue(glue(cpu_ld, USUFFIX), MEMSUFFIX), _ra)(CPUArchState *env,
>                                                    target_ulong ptr,
> @@ -127,8 +108,6 @@ glue(glue(cpu_st, SUFFIX), MEMSUFFIX)(CPUArchState *env, target_ulong ptr,
>      glue(glue(cpu_st, SUFFIX), _mmuidx_ra)(env, ptr, v, CPU_MMU_INDEX, 0);
>  }
>
> -#endif /* !SOFTMMU_CODE_ACCESS */
> -
>  #undef RES_TYPE
>  #undef DATA_TYPE
>  #undef DATA_STYPE
> diff --git a/tcg/tcg.h b/tcg/tcg.h
> index 92ca10dffc..3b4f79301c 100644
> --- a/tcg/tcg.h
> +++ b/tcg/tcg.h
> @@ -1290,27 +1290,6 @@ void helper_be_stl_mmu(CPUArchState *env, target_ulong addr, uint32_t val,
>  void helper_be_stq_mmu(CPUArchState *env, target_ulong addr, uint64_t val,
>                         TCGMemOpIdx oi, uintptr_t retaddr);
>
> -uint8_t helper_ret_ldub_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr);
> -int8_t helper_ret_ldsb_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr);
> -uint16_t helper_le_lduw_cmmu(CPUArchState *env, target_ulong addr,
> -                             TCGMemOpIdx oi, uintptr_t retaddr);
> -int16_t helper_le_ldsw_cmmu(CPUArchState *env, target_ulong addr,
> -                             TCGMemOpIdx oi, uintptr_t retaddr);
> -uint32_t helper_le_ldl_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr);
> -uint64_t helper_le_ldq_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr);
> -uint16_t helper_be_lduw_cmmu(CPUArchState *env, target_ulong addr,
> -                             TCGMemOpIdx oi, uintptr_t retaddr);
> -int16_t helper_be_ldsw_cmmu(CPUArchState *env, target_ulong addr,
> -                             TCGMemOpIdx oi, uintptr_t retaddr);
> -uint32_t helper_be_ldl_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr);
> -uint64_t helper_be_ldq_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr);
> -
>  /* Temporary aliases until backends are converted.  */
>  #ifdef TARGET_WORDS_BIGENDIAN
>  # define helper_ret_ldsw_mmu  helper_be_ldsw_mmu
> @@ -1322,10 +1301,6 @@ uint64_t helper_be_ldq_cmmu(CPUArchState *env, target_ulong addr,
>  # define helper_ret_stw_mmu   helper_be_stw_mmu
>  # define helper_ret_stl_mmu   helper_be_stl_mmu
>  # define helper_ret_stq_mmu   helper_be_stq_mmu
> -# define helper_ret_lduw_cmmu  helper_be_lduw_cmmu
> -# define helper_ret_ldsw_cmmu  helper_be_ldsw_cmmu
> -# define helper_ret_ldl_cmmu  helper_be_ldl_cmmu
> -# define helper_ret_ldq_cmmu  helper_be_ldq_cmmu
>  #else
>  # define helper_ret_ldsw_mmu  helper_le_ldsw_mmu
>  # define helper_ret_lduw_mmu  helper_le_lduw_mmu
> @@ -1336,10 +1311,6 @@ uint64_t helper_be_ldq_cmmu(CPUArchState *env, target_ulong addr,
>  # define helper_ret_stw_mmu   helper_le_stw_mmu
>  # define helper_ret_stl_mmu   helper_le_stl_mmu
>  # define helper_ret_stq_mmu   helper_le_stq_mmu
> -# define helper_ret_lduw_cmmu  helper_le_lduw_cmmu
> -# define helper_ret_ldsw_cmmu  helper_le_ldsw_cmmu
> -# define helper_ret_ldl_cmmu  helper_le_ldl_cmmu
> -# define helper_ret_ldq_cmmu  helper_le_ldq_cmmu
>  #endif
>
>  uint32_t helper_atomic_cmpxchgb_mmu(CPUArchState *env, target_ulong addr,
> diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
> index 4d3ec1d35a..7d519738bb 100644
> --- a/accel/tcg/cputlb.c
> +++ b/accel/tcg/cputlb.c
> @@ -2028,98 +2028,50 @@ void cpu_stq_mmuidx_ra(CPUArchState *env, target_ulong addr, uint64_t val,
>
>  /* Code access functions.  */
>
> -static uint64_t full_ldub_cmmu(CPUArchState *env, target_ulong addr,
> +static uint64_t full_ldub_code(CPUArchState *env, target_ulong addr,
>                                 TCGMemOpIdx oi, uintptr_t retaddr)
>  {
> -    return load_helper(env, addr, oi, retaddr, MO_8, true, full_ldub_cmmu);
> +    return load_helper(env, addr, oi, retaddr, MO_8, true, full_ldub_code);
>  }
>
> -uint8_t helper_ret_ldub_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr)
> +uint32_t cpu_ldub_code(CPUArchState *env, abi_ptr addr)
>  {
> -    return full_ldub_cmmu(env, addr, oi, retaddr);
> +    TCGMemOpIdx oi = make_memop_idx(MO_UB, cpu_mmu_index(env, true));
> +    return full_ldub_code(env, addr, oi, 0);
>  }
>
> -int8_t helper_ret_ldsb_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr)
> +static uint64_t full_lduw_code(CPUArchState *env, target_ulong addr,
> +                               TCGMemOpIdx oi, uintptr_t retaddr)
>  {
> -    return (int8_t) full_ldub_cmmu(env, addr, oi, retaddr);
> +    return load_helper(env, addr, oi, retaddr, MO_TEUW, true, full_lduw_code);
>  }
>
> -static uint64_t full_le_lduw_cmmu(CPUArchState *env, target_ulong addr,
> -                                  TCGMemOpIdx oi, uintptr_t retaddr)
> +uint32_t cpu_lduw_code(CPUArchState *env, abi_ptr addr)
>  {
> -    return load_helper(env, addr, oi, retaddr, MO_LEUW, true,
> -                       full_le_lduw_cmmu);
> +    TCGMemOpIdx oi = make_memop_idx(MO_TEUW, cpu_mmu_index(env, true));
> +    return full_lduw_code(env, addr, oi, 0);
>  }
>
> -uint16_t helper_le_lduw_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr)
> +static uint64_t full_ldl_code(CPUArchState *env, target_ulong addr,
> +                              TCGMemOpIdx oi, uintptr_t retaddr)
>  {
> -    return full_le_lduw_cmmu(env, addr, oi, retaddr);
> +    return load_helper(env, addr, oi, retaddr, MO_TEUL, true, full_ldl_code);
>  }
>
> -int16_t helper_le_ldsw_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr)
> +uint32_t cpu_ldl_code(CPUArchState *env, abi_ptr addr)
>  {
> -    return (int16_t) full_le_lduw_cmmu(env, addr, oi, retaddr);
> +    TCGMemOpIdx oi = make_memop_idx(MO_TEUL, cpu_mmu_index(env, true));
> +    return full_ldl_code(env, addr, oi, 0);
>  }
>
> -static uint64_t full_be_lduw_cmmu(CPUArchState *env, target_ulong addr,
> -                                  TCGMemOpIdx oi, uintptr_t retaddr)
> +static uint64_t full_ldq_code(CPUArchState *env, target_ulong addr,
> +                              TCGMemOpIdx oi, uintptr_t retaddr)
>  {
> -    return load_helper(env, addr, oi, retaddr, MO_BEUW, true,
> -                       full_be_lduw_cmmu);
> +    return load_helper(env, addr, oi, retaddr, MO_TEQ, true, full_ldq_code);
>  }
>
> -uint16_t helper_be_lduw_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr)
> +uint64_t cpu_ldq_code(CPUArchState *env, abi_ptr addr)
>  {
> -    return full_be_lduw_cmmu(env, addr, oi, retaddr);
> -}
> -
> -int16_t helper_be_ldsw_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr)
> -{
> -    return (int16_t) full_be_lduw_cmmu(env, addr, oi, retaddr);
> -}
> -
> -static uint64_t full_le_ldul_cmmu(CPUArchState *env, target_ulong addr,
> -                                  TCGMemOpIdx oi, uintptr_t retaddr)
> -{
> -    return load_helper(env, addr, oi, retaddr, MO_LEUL, true,
> -                       full_le_ldul_cmmu);
> -}
> -
> -uint32_t helper_le_ldl_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr)
> -{
> -    return full_le_ldul_cmmu(env, addr, oi, retaddr);
> -}
> -
> -static uint64_t full_be_ldul_cmmu(CPUArchState *env, target_ulong addr,
> -                                  TCGMemOpIdx oi, uintptr_t retaddr)
> -{
> -    return load_helper(env, addr, oi, retaddr, MO_BEUL, true,
> -                       full_be_ldul_cmmu);
> -}
> -
> -uint32_t helper_be_ldl_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr)
> -{
> -    return full_be_ldul_cmmu(env, addr, oi, retaddr);
> -}
> -
> -uint64_t helper_le_ldq_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr)
> -{
> -    return load_helper(env, addr, oi, retaddr, MO_LEQ, true,
> -                       helper_le_ldq_cmmu);
> -}
> -
> -uint64_t helper_be_ldq_cmmu(CPUArchState *env, target_ulong addr,
> -                            TCGMemOpIdx oi, uintptr_t retaddr)
> -{
> -    return load_helper(env, addr, oi, retaddr, MO_BEQ, true,
> -                       helper_be_ldq_cmmu);
> +    TCGMemOpIdx oi = make_memop_idx(MO_TEQ, cpu_mmu_index(env, true));
> +    return full_ldq_code(env, addr, oi, 0);
>  }
> diff --git a/docs/devel/loads-stores.rst b/docs/devel/loads-stores.rst
> index c74cd090e6..8a5bc912a5 100644
> --- a/docs/devel/loads-stores.rst
> +++ b/docs/devel/loads-stores.rst
> @@ -171,8 +171,6 @@ more in line with the other memory access functions.
>
>  load: ``helper_{endian}_ld{sign}{size}_mmu(env, addr, opindex, retaddr)``
>
> -load (code): ``helper_{endian}_ld{sign}{size}_cmmu(env, addr, opindex, retaddr)``
> -
>  store: ``helper_{endian}_st{size}_mmu(env, addr, val, opindex, retaddr)``
>
>  ``sign``
> @@ -192,7 +190,7 @@ store: ``helper_{endian}_st{size}_mmu(env, addr, val, opindex, retaddr)``
>   - ``ret`` : target endianness
>
>  Regexes for git grep
> - - ``\<helper_\(le\|be\|ret\)_ld[us]\?[bwlq]_c\?mmu\>``
> + - ``\<helper_\(le\|be\|ret\)_ld[us]\?[bwlq]_mmu\>``
>   - ``\<helper_\(le\|be\|ret\)_st[bwlq]_mmu\>``
>
>  ``address_space_*``
> --
> 2.20.1
>
>


  reply	other threads:[~2019-12-12  9:34 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12  4:00 [PATCH 00/28] cputlb: Remove support for MMU_MODE*_SUFFIX Richard Henderson
2019-12-12  4:00 ` [PATCH 01/28] target/xtensa: Use probe_access for itlb_hit_test Richard Henderson
2019-12-12 18:45   ` Max Filippov
2019-12-12  4:00 ` [PATCH 02/28] cputlb: Use trace_mem_get_info instead of trace_mem_build_info Richard Henderson
2019-12-12  4:00 ` [PATCH 03/28] trace: Remove trace_mem_build_info_no_se_[bl]e Richard Henderson
2019-12-12  4:00 ` [PATCH 04/28] cputlb: Move body of cpu_ldst_template.h out of line Richard Henderson
2019-12-12  4:00 ` [PATCH 05/28] translator: Use cpu_ld*_code instead of open-coding Richard Henderson
2019-12-12  4:00 ` [PATCH 06/28] cputlb: Rename helper_ret_ld*_cmmu to cpu_ld*_code Richard Henderson
2019-12-12  9:33   ` Aleksandar Markovic [this message]
2019-12-12  4:00 ` [PATCH 07/28] cputlb: Provide cpu_(ld,st}*_mmuidx_ra for user-only Richard Henderson
2019-12-12  4:00 ` [PATCH 08/28] target/i386: Use cpu_*_mmuidx_ra instead of templates Richard Henderson
2019-12-12  7:19   ` Paolo Bonzini
2019-12-12  4:00 ` [PATCH 09/28] target/s390x: Include tcg.h in mem_helper.c Richard Henderson
2019-12-12 10:36   ` David Hildenbrand
2019-12-12  4:00 ` [PATCH 10/28] target/arm: Include tcg.h in sve_helper.c Richard Henderson
2019-12-12  4:00 ` [PATCH 11/28] accel/tcg: Include tcg.h in tcg-runtime.c Richard Henderson
2019-12-12 12:28   ` Alex Bennée
2019-12-12  4:00 ` [PATCH 12/28] linux-user: Include tcg.h in syscall.c Richard Henderson
2019-12-12  4:00 ` [PATCH 13/28] linux-user: Include trace-root.h in syscall-trace.h Richard Henderson
2019-12-12  4:00 ` [PATCH 14/28] cputlb: Expand cpu_ldst_useronly_template.h in user-exec.c Richard Henderson
2019-12-12 20:02   ` Aleksandar Markovic
2019-12-12  4:00 ` [PATCH 15/28] target/nios2: Remove MMU_MODE{0,1}_SUFFIX Richard Henderson
2019-12-12  4:00 ` [PATCH 16/28] target/alpha: " Richard Henderson
2019-12-12  4:00 ` [PATCH 17/28] target/cris: " Richard Henderson
2019-12-12  4:00 ` [PATCH 18/28] target/i386: Remove MMU_MODE{0,1,2}_SUFFIX Richard Henderson
2019-12-12  8:11   ` Paolo Bonzini
2019-12-12  4:00 ` [PATCH 19/28] target/microblaze: " Richard Henderson
2019-12-12  4:00 ` [PATCH 20/28] target/sh4: Remove MMU_MODE{0,1}_SUFFIX Richard Henderson
2019-12-12  4:00 ` [PATCH 21/28] target/unicore32: " Richard Henderson
2019-12-12  4:00 ` [PATCH 22/28] target/xtensa: Remove MMU_MODE{0,1,2,3}_SUFFIX Richard Henderson
2019-12-12 18:46   ` Max Filippov
2019-12-12  4:00 ` [PATCH 23/28] target/m68k: Use cpu_*_mmuidx_ra instead of MMU_MODE{0, 1}_SUFFIX Richard Henderson
2019-12-12  8:53   ` [PATCH 23/28] target/m68k: Use cpu_*_mmuidx_ra instead of MMU_MODE{0,1}_SUFFIX Laurent Vivier
2019-12-12  9:44   ` [PATCH 23/28] target/m68k: Use cpu_*_mmuidx_ra instead of MMU_MODE{0, 1}_SUFFIX Laurent Vivier
2019-12-12 14:27     ` Richard Henderson
2019-12-12  4:00 ` [PATCH 24/28] target/mips: Use cpu_*_mmuidx_ra instead of MMU_MODE*_SUFFIX Richard Henderson
2019-12-12  9:32   ` Aleksandar Markovic
2019-12-12  4:00 ` [PATCH 25/28] target/s390x: " Richard Henderson
2019-12-12 10:38   ` David Hildenbrand
2019-12-12  4:00 ` [PATCH 26/28] target/ppc: " Richard Henderson
2019-12-12  5:13   ` David Gibson
2019-12-12  4:00 ` [PATCH 27/28] cputlb: Remove support for MMU_MODE*_SUFFIX Richard Henderson
2019-12-12  4:00 ` [PATCH 28/28] cputlb: Expand cpu_ldst_template.h in cputlb.c Richard Henderson
2019-12-12 10:00   ` Aleksandar Markovic
2019-12-12 20:34 ` [PATCH 00/28] cputlb: Remove support for MMU_MODE*_SUFFIX Aleksandar Markovic

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='CAL1e-=g14O66k5E9CF9vRZgkOw3yMB35rpRKfrf9AG=xDiuCJA@mail.gmail.com' \
    --to=aleksandar.m.mail@gmail.com \
    --cc=qemu-devel@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).