[23/28] target/m68k: Use cpu_*_mmuidx_ra instead of MMU_MODE{0, 1}_SUFFIX

Message ID 20191212040039.26546-24-richard.henderson@linaro.org
State New
Headers show
Series
  • cputlb: Remove support for MMU_MODE*_SUFFIX
Related show

Commit Message

Richard Henderson Dec. 12, 2019, 4 a.m.
The generated *_user functions are unused.  The *_kernel functions
have a couple of users in op_helper.c; use *_mmuidx_ra instead,
with MMU_KERNEL_IDX.

Cc: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/m68k/cpu.h       | 2 --
 target/m68k/op_helper.c | 5 +++++
 2 files changed, 5 insertions(+), 2 deletions(-)

-- 
2.20.1

Comments

Laurent Vivier Dec. 12, 2019, 8:53 a.m. | #1
Le 12/12/2019 à 05:00, Richard Henderson a écrit :
> The generated *_user functions are unused.  The *_kernel functions

> have a couple of users in op_helper.c; use *_mmuidx_ra instead,

> with MMU_KERNEL_IDX.

> 

> Cc: Laurent Vivier <laurent@vivier.eu>

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

> ---

>  target/m68k/cpu.h       | 2 --

>  target/m68k/op_helper.c | 5 +++++

>  2 files changed, 5 insertions(+), 2 deletions(-)

> 

> diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h

> index 20de3c379a..89af14e899 100644

> --- a/target/m68k/cpu.h

> +++ b/target/m68k/cpu.h

> @@ -516,8 +516,6 @@ enum {

>  #define cpu_list m68k_cpu_list

>  

>  /* MMU modes definitions */

> -#define MMU_MODE0_SUFFIX _kernel

> -#define MMU_MODE1_SUFFIX _user

>  #define MMU_KERNEL_IDX 0

>  #define MMU_USER_IDX 1

>  static inline int cpu_mmu_index (CPUM68KState *env, bool ifetch)

> diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c

> index bc4f845e3f..96a4951c21 100644

> --- a/target/m68k/op_helper.c

> +++ b/target/m68k/op_helper.c

> @@ -36,6 +36,11 @@ static inline void do_interrupt_m68k_hardirq(CPUM68KState *env)

>  

>  #else

>  

> +#define cpu_lduw_kernel(e, p)    cpu_lduw_mmuidx_ra(e, p, MMU_KERNEL_IDX, 0)

> +#define cpu_ldl_kernel(e, p)     cpu_ldl_mmuidx_ra(e, p, MMU_KERNEL_IDX, 0)

> +#define cpu_stw_kernel(e, p, v)  cpu_stw_mmuidx_ra(e, p, v, MMU_KERNEL_IDX, 0)

> +#define cpu_stl_kernel(e, p, v)  cpu_stl_mmuidx_ra(e, p, v, MMU_KERNEL_IDX, 0)

> +

>  static void cf_rte(CPUM68KState *env)

>  {

>      uint32_t sp;

> 


Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Laurent Vivier Dec. 12, 2019, 9:44 a.m. | #2
Le 12/12/2019 à 05:00, Richard Henderson a écrit :
> The generated *_user functions are unused.  The *_kernel functions

> have a couple of users in op_helper.c; use *_mmuidx_ra instead,

> with MMU_KERNEL_IDX.

> 

> Cc: Laurent Vivier <laurent@vivier.eu>

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

> ---

>  target/m68k/cpu.h       | 2 --

>  target/m68k/op_helper.c | 5 +++++

>  2 files changed, 5 insertions(+), 2 deletions(-)

> 

> diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h

> index 20de3c379a..89af14e899 100644

> --- a/target/m68k/cpu.h

> +++ b/target/m68k/cpu.h

> @@ -516,8 +516,6 @@ enum {

>  #define cpu_list m68k_cpu_list

>  

>  /* MMU modes definitions */

> -#define MMU_MODE0_SUFFIX _kernel

> -#define MMU_MODE1_SUFFIX _user

>  #define MMU_KERNEL_IDX 0

>  #define MMU_USER_IDX 1

>  static inline int cpu_mmu_index (CPUM68KState *env, bool ifetch)

> diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c

> index bc4f845e3f..96a4951c21 100644

> --- a/target/m68k/op_helper.c

> +++ b/target/m68k/op_helper.c

> @@ -36,6 +36,11 @@ static inline void do_interrupt_m68k_hardirq(CPUM68KState *env)

>  

>  #else

>  

> +#define cpu_lduw_kernel(e, p)    cpu_lduw_mmuidx_ra(e, p, MMU_KERNEL_IDX, 0)

> +#define cpu_ldl_kernel(e, p)     cpu_ldl_mmuidx_ra(e, p, MMU_KERNEL_IDX, 0)

> +#define cpu_stw_kernel(e, p, v)  cpu_stw_mmuidx_ra(e, p, v, MMU_KERNEL_IDX, 0)

> +#define cpu_stl_kernel(e, p, v)  cpu_stl_mmuidx_ra(e, p, v, MMU_KERNEL_IDX, 0)


Do you think it would be a reasonable cleanup to replace the _kernel
functions by the _mmuidx_ra functions directly in the code in a future
patch?

Thanks,
Laurent
Richard Henderson Dec. 12, 2019, 2:27 p.m. | #3
On 12/12/19 1:44 AM, Laurent Vivier wrote:
>> +#define cpu_lduw_kernel(e, p)    cpu_lduw_mmuidx_ra(e, p, MMU_KERNEL_IDX, 0)

>> +#define cpu_ldl_kernel(e, p)     cpu_ldl_mmuidx_ra(e, p, MMU_KERNEL_IDX, 0)

>> +#define cpu_stw_kernel(e, p, v)  cpu_stw_mmuidx_ra(e, p, v, MMU_KERNEL_IDX, 0)

>> +#define cpu_stl_kernel(e, p, v)  cpu_stl_mmuidx_ra(e, p, v, MMU_KERNEL_IDX, 0)

> 

> Do you think it would be a reasonable cleanup to replace the _kernel

> functions by the _mmuidx_ra functions directly in the code in a future

> patch?


I can do this in v2, as David asked for the same thing for s390x.


r~

Patch

diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
index 20de3c379a..89af14e899 100644
--- a/target/m68k/cpu.h
+++ b/target/m68k/cpu.h
@@ -516,8 +516,6 @@  enum {
 #define cpu_list m68k_cpu_list
 
 /* MMU modes definitions */
-#define MMU_MODE0_SUFFIX _kernel
-#define MMU_MODE1_SUFFIX _user
 #define MMU_KERNEL_IDX 0
 #define MMU_USER_IDX 1
 static inline int cpu_mmu_index (CPUM68KState *env, bool ifetch)
diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
index bc4f845e3f..96a4951c21 100644
--- a/target/m68k/op_helper.c
+++ b/target/m68k/op_helper.c
@@ -36,6 +36,11 @@  static inline void do_interrupt_m68k_hardirq(CPUM68KState *env)
 
 #else
 
+#define cpu_lduw_kernel(e, p)    cpu_lduw_mmuidx_ra(e, p, MMU_KERNEL_IDX, 0)
+#define cpu_ldl_kernel(e, p)     cpu_ldl_mmuidx_ra(e, p, MMU_KERNEL_IDX, 0)
+#define cpu_stw_kernel(e, p, v)  cpu_stw_mmuidx_ra(e, p, v, MMU_KERNEL_IDX, 0)
+#define cpu_stl_kernel(e, p, v)  cpu_stl_mmuidx_ra(e, p, v, MMU_KERNEL_IDX, 0)
+
 static void cf_rte(CPUM68KState *env)
 {
     uint32_t sp;