diff mbox series

[v3,13/39] target/hppa: Use env_cpu, env_archcpu

Message ID 20190508000641.19090-14-richard.henderson@linaro.org
State Superseded
Headers show
Series tcg: Move the softmmu tlb to CPUNegativeOffsetState | expand

Commit Message

Richard Henderson May 8, 2019, 12:06 a.m. UTC
Combined uses of CPU(hppa_env_get_cpu()) were failures to use
the more proper, ENV_GET_CPU macro, now replaced by env_cpu.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

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

---
 target/hppa/cpu.h          |  5 -----
 linux-user/hppa/cpu_loop.c |  2 +-
 target/hppa/helper.c       |  3 +--
 target/hppa/int_helper.c   |  4 ++--
 target/hppa/mem_helper.c   | 10 ++++------
 target/hppa/op_helper.c    |  8 +++-----
 6 files changed, 11 insertions(+), 21 deletions(-)

-- 
2.17.1

Comments

Alistair Francis May 9, 2019, 6:05 p.m. UTC | #1
On Tue, May 7, 2019 at 5:21 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
>

> Combined uses of CPU(hppa_env_get_cpu()) were failures to use

> the more proper, ENV_GET_CPU macro, now replaced by env_cpu.

>

> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

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


Reviewed-by: Alistair Francis <alistair.francis@wdc.com>


Alistair

> ---

>  target/hppa/cpu.h          |  5 -----

>  linux-user/hppa/cpu_loop.c |  2 +-

>  target/hppa/helper.c       |  3 +--

>  target/hppa/int_helper.c   |  4 ++--

>  target/hppa/mem_helper.c   | 10 ++++------

>  target/hppa/op_helper.c    |  8 +++-----

>  6 files changed, 11 insertions(+), 21 deletions(-)

>

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

> index 887e10398a..a5ddc53bf1 100644

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

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

> @@ -222,11 +222,6 @@ struct HPPACPU {

>      QEMUTimer *alarm_timer;

>  };

>

> -static inline HPPACPU *hppa_env_get_cpu(CPUHPPAState *env)

> -{

> -    return container_of(env, HPPACPU, env);

> -}

> -

>  #define ENV_OFFSET      offsetof(HPPACPU, env)

>

>  typedef CPUHPPAState CPUArchState;

> diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c

> index 880955fdef..9915456a1d 100644

> --- a/linux-user/hppa/cpu_loop.c

> +++ b/linux-user/hppa/cpu_loop.c

> @@ -105,7 +105,7 @@ static abi_ulong hppa_lws(CPUHPPAState *env)

>

>  void cpu_loop(CPUHPPAState *env)

>  {

> -    CPUState *cs = CPU(hppa_env_get_cpu(env));

> +    CPUState *cs = env_cpu(env);

>      target_siginfo_t info;

>      abi_ulong ret;

>      int trapnr;

> diff --git a/target/hppa/helper.c b/target/hppa/helper.c

> index 11c61b3ca2..0dcd105b88 100644

> --- a/target/hppa/helper.c

> +++ b/target/hppa/helper.c

> @@ -71,8 +71,7 @@ void cpu_hppa_put_psw(CPUHPPAState *env, target_ureg psw)

>      /* If PSW_P changes, it affects how we translate addresses.  */

>      if ((psw ^ old_psw) & PSW_P) {

>  #ifndef CONFIG_USER_ONLY

> -        CPUState *src = CPU(hppa_env_get_cpu(env));

> -        tlb_flush_by_mmuidx(src, 0xf);

> +        tlb_flush_by_mmuidx(env_cpu(env), 0xf);

>  #endif

>      }

>  }

> diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c

> index 8d5edd3a20..89241c31e7 100644

> --- a/target/hppa/int_helper.c

> +++ b/target/hppa/int_helper.c

> @@ -77,7 +77,7 @@ void HELPER(write_eirr)(CPUHPPAState *env, target_ureg val)

>  {

>      env->cr[CR_EIRR] &= ~val;

>      qemu_mutex_lock_iothread();

> -    eval_interrupt(hppa_env_get_cpu(env));

> +    eval_interrupt(env_archcpu(env));

>      qemu_mutex_unlock_iothread();

>  }

>

> @@ -85,7 +85,7 @@ void HELPER(write_eiem)(CPUHPPAState *env, target_ureg val)

>  {

>      env->cr[CR_EIEM] = val;

>      qemu_mutex_lock_iothread();

> -    eval_interrupt(hppa_env_get_cpu(env));

> +    eval_interrupt(env_archcpu(env));

>      qemu_mutex_unlock_iothread();

>  }

>  #endif /* !CONFIG_USER_ONLY */

> diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c

> index 77fb544838..e2f464c78c 100644

> --- a/target/hppa/mem_helper.c

> +++ b/target/hppa/mem_helper.c

> @@ -55,7 +55,7 @@ static hppa_tlb_entry *hppa_find_tlb(CPUHPPAState *env, vaddr addr)

>

>  static void hppa_flush_tlb_ent(CPUHPPAState *env, hppa_tlb_entry *ent)

>  {

> -    CPUState *cs = CPU(hppa_env_get_cpu(env));

> +    CPUState *cs = env_cpu(env);

>      unsigned i, n = 1 << (2 * ent->page_size);

>      uint64_t addr = ent->va_b;

>

> @@ -323,7 +323,7 @@ static void ptlb_work(CPUState *cpu, run_on_cpu_data data)

>

>  void HELPER(ptlb)(CPUHPPAState *env, target_ulong addr)

>  {

> -    CPUState *src = CPU(hppa_env_get_cpu(env));

> +    CPUState *src = env_cpu(env);

>      CPUState *cpu;

>      trace_hppa_tlb_ptlb(env);

>      run_on_cpu_data data = RUN_ON_CPU_TARGET_PTR(addr);

> @@ -340,17 +340,15 @@ void HELPER(ptlb)(CPUHPPAState *env, target_ulong addr)

>     number of pages/entries (we choose all), and is local to the cpu.  */

>  void HELPER(ptlbe)(CPUHPPAState *env)

>  {

> -    CPUState *src = CPU(hppa_env_get_cpu(env));

>      trace_hppa_tlb_ptlbe(env);

>      memset(env->tlb, 0, sizeof(env->tlb));

> -    tlb_flush_by_mmuidx(src, 0xf);

> +    tlb_flush_by_mmuidx(env_cpu(env), 0xf);

>  }

>

>  void cpu_hppa_change_prot_id(CPUHPPAState *env)

>  {

>      if (env->psw & PSW_P) {

> -        CPUState *src = CPU(hppa_env_get_cpu(env));

> -        tlb_flush_by_mmuidx(src, 0xf);

> +        tlb_flush_by_mmuidx(env_cpu(env), 0xf);

>      }

>  }

>

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

> index 952e97a7d7..04d23c1b22 100644

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

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

> @@ -29,8 +29,7 @@

>

>  void QEMU_NORETURN HELPER(excp)(CPUHPPAState *env, int excp)

>  {

> -    HPPACPU *cpu = hppa_env_get_cpu(env);

> -    CPUState *cs = CPU(cpu);

> +    CPUState *cs = env_cpu(env);

>

>      cs->exception_index = excp;

>      cpu_loop_exit(cs);

> @@ -38,8 +37,7 @@ void QEMU_NORETURN HELPER(excp)(CPUHPPAState *env, int excp)

>

>  void QEMU_NORETURN hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra)

>  {

> -    HPPACPU *cpu = hppa_env_get_cpu(env);

> -    CPUState *cs = CPU(cpu);

> +    CPUState *cs = env_cpu(env);

>

>      cs->exception_index = excp;

>      cpu_loop_exit_restore(cs, ra);

> @@ -630,7 +628,7 @@ target_ureg HELPER(read_interval_timer)(void)

>  #ifndef CONFIG_USER_ONLY

>  void HELPER(write_interval_timer)(CPUHPPAState *env, target_ureg val)

>  {

> -    HPPACPU *cpu = hppa_env_get_cpu(env);

> +    HPPACPU *cpu = env_archcpu(env);

>      uint64_t current = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);

>      uint64_t timeout;

>

> --

> 2.17.1

>

>
diff mbox series

Patch

diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h
index 887e10398a..a5ddc53bf1 100644
--- a/target/hppa/cpu.h
+++ b/target/hppa/cpu.h
@@ -222,11 +222,6 @@  struct HPPACPU {
     QEMUTimer *alarm_timer;
 };
 
-static inline HPPACPU *hppa_env_get_cpu(CPUHPPAState *env)
-{
-    return container_of(env, HPPACPU, env);
-}
-
 #define ENV_OFFSET      offsetof(HPPACPU, env)
 
 typedef CPUHPPAState CPUArchState;
diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c
index 880955fdef..9915456a1d 100644
--- a/linux-user/hppa/cpu_loop.c
+++ b/linux-user/hppa/cpu_loop.c
@@ -105,7 +105,7 @@  static abi_ulong hppa_lws(CPUHPPAState *env)
 
 void cpu_loop(CPUHPPAState *env)
 {
-    CPUState *cs = CPU(hppa_env_get_cpu(env));
+    CPUState *cs = env_cpu(env);
     target_siginfo_t info;
     abi_ulong ret;
     int trapnr;
diff --git a/target/hppa/helper.c b/target/hppa/helper.c
index 11c61b3ca2..0dcd105b88 100644
--- a/target/hppa/helper.c
+++ b/target/hppa/helper.c
@@ -71,8 +71,7 @@  void cpu_hppa_put_psw(CPUHPPAState *env, target_ureg psw)
     /* If PSW_P changes, it affects how we translate addresses.  */
     if ((psw ^ old_psw) & PSW_P) {
 #ifndef CONFIG_USER_ONLY
-        CPUState *src = CPU(hppa_env_get_cpu(env));
-        tlb_flush_by_mmuidx(src, 0xf);
+        tlb_flush_by_mmuidx(env_cpu(env), 0xf);
 #endif
     }
 }
diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c
index 8d5edd3a20..89241c31e7 100644
--- a/target/hppa/int_helper.c
+++ b/target/hppa/int_helper.c
@@ -77,7 +77,7 @@  void HELPER(write_eirr)(CPUHPPAState *env, target_ureg val)
 {
     env->cr[CR_EIRR] &= ~val;
     qemu_mutex_lock_iothread();
-    eval_interrupt(hppa_env_get_cpu(env));
+    eval_interrupt(env_archcpu(env));
     qemu_mutex_unlock_iothread();
 }
 
@@ -85,7 +85,7 @@  void HELPER(write_eiem)(CPUHPPAState *env, target_ureg val)
 {
     env->cr[CR_EIEM] = val;
     qemu_mutex_lock_iothread();
-    eval_interrupt(hppa_env_get_cpu(env));
+    eval_interrupt(env_archcpu(env));
     qemu_mutex_unlock_iothread();
 }
 #endif /* !CONFIG_USER_ONLY */
diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c
index 77fb544838..e2f464c78c 100644
--- a/target/hppa/mem_helper.c
+++ b/target/hppa/mem_helper.c
@@ -55,7 +55,7 @@  static hppa_tlb_entry *hppa_find_tlb(CPUHPPAState *env, vaddr addr)
 
 static void hppa_flush_tlb_ent(CPUHPPAState *env, hppa_tlb_entry *ent)
 {
-    CPUState *cs = CPU(hppa_env_get_cpu(env));
+    CPUState *cs = env_cpu(env);
     unsigned i, n = 1 << (2 * ent->page_size);
     uint64_t addr = ent->va_b;
 
@@ -323,7 +323,7 @@  static void ptlb_work(CPUState *cpu, run_on_cpu_data data)
 
 void HELPER(ptlb)(CPUHPPAState *env, target_ulong addr)
 {
-    CPUState *src = CPU(hppa_env_get_cpu(env));
+    CPUState *src = env_cpu(env);
     CPUState *cpu;
     trace_hppa_tlb_ptlb(env);
     run_on_cpu_data data = RUN_ON_CPU_TARGET_PTR(addr);
@@ -340,17 +340,15 @@  void HELPER(ptlb)(CPUHPPAState *env, target_ulong addr)
    number of pages/entries (we choose all), and is local to the cpu.  */
 void HELPER(ptlbe)(CPUHPPAState *env)
 {
-    CPUState *src = CPU(hppa_env_get_cpu(env));
     trace_hppa_tlb_ptlbe(env);
     memset(env->tlb, 0, sizeof(env->tlb));
-    tlb_flush_by_mmuidx(src, 0xf);
+    tlb_flush_by_mmuidx(env_cpu(env), 0xf);
 }
 
 void cpu_hppa_change_prot_id(CPUHPPAState *env)
 {
     if (env->psw & PSW_P) {
-        CPUState *src = CPU(hppa_env_get_cpu(env));
-        tlb_flush_by_mmuidx(src, 0xf);
+        tlb_flush_by_mmuidx(env_cpu(env), 0xf);
     }
 }
 
diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c
index 952e97a7d7..04d23c1b22 100644
--- a/target/hppa/op_helper.c
+++ b/target/hppa/op_helper.c
@@ -29,8 +29,7 @@ 
 
 void QEMU_NORETURN HELPER(excp)(CPUHPPAState *env, int excp)
 {
-    HPPACPU *cpu = hppa_env_get_cpu(env);
-    CPUState *cs = CPU(cpu);
+    CPUState *cs = env_cpu(env);
 
     cs->exception_index = excp;
     cpu_loop_exit(cs);
@@ -38,8 +37,7 @@  void QEMU_NORETURN HELPER(excp)(CPUHPPAState *env, int excp)
 
 void QEMU_NORETURN hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra)
 {
-    HPPACPU *cpu = hppa_env_get_cpu(env);
-    CPUState *cs = CPU(cpu);
+    CPUState *cs = env_cpu(env);
 
     cs->exception_index = excp;
     cpu_loop_exit_restore(cs, ra);
@@ -630,7 +628,7 @@  target_ureg HELPER(read_interval_timer)(void)
 #ifndef CONFIG_USER_ONLY
 void HELPER(write_interval_timer)(CPUHPPAState *env, target_ureg val)
 {
-    HPPACPU *cpu = hppa_env_get_cpu(env);
+    HPPACPU *cpu = env_archcpu(env);
     uint64_t current = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
     uint64_t timeout;