diff mbox series

[v3,20/39] target/nios2: Use env_cpu, env_archcpu

Message ID 20190508000641.19090-21-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
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

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

---
 target/nios2/cpu.h |  5 -----
 hw/nios2/cpu_pic.c |  5 +----
 target/nios2/mmu.c | 10 +++++-----
 3 files changed, 6 insertions(+), 14 deletions(-)

-- 
2.17.1

Comments

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

> 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/nios2/cpu.h |  5 -----

>  hw/nios2/cpu_pic.c |  5 +----

>  target/nios2/mmu.c | 10 +++++-----

>  3 files changed, 6 insertions(+), 14 deletions(-)

>

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

> index b14095b8dc..f2ffc1469f 100644

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

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

> @@ -193,11 +193,6 @@ typedef struct Nios2CPU {

>      uint32_t fast_tlb_miss_addr;

>  } Nios2CPU;

>

> -static inline Nios2CPU *nios2_env_get_cpu(CPUNios2State *env)

> -{

> -    return NIOS2_CPU(container_of(env, Nios2CPU, env));

> -}

> -

>  #define ENV_OFFSET offsetof(Nios2CPU, env)

>

>  void nios2_tcg_init(void);

> diff --git a/hw/nios2/cpu_pic.c b/hw/nios2/cpu_pic.c

> index 6bccce2f32..9e39955bd1 100644

> --- a/hw/nios2/cpu_pic.c

> +++ b/hw/nios2/cpu_pic.c

> @@ -54,12 +54,9 @@ static void nios2_pic_cpu_handler(void *opaque, int irq, int level)

>

>  void nios2_check_interrupts(CPUNios2State *env)

>  {

> -    Nios2CPU *cpu = nios2_env_get_cpu(env);

> -    CPUState *cs = CPU(cpu);

> -

>      if (env->irq_pending) {

>          env->irq_pending = 0;

> -        cpu_interrupt(cs, CPU_INTERRUPT_HARD);

> +        cpu_interrupt(env_cpu(env), CPU_INTERRUPT_HARD);

>      }

>  }

>

> diff --git a/target/nios2/mmu.c b/target/nios2/mmu.c

> index 33382bad1b..61eaa06b3e 100644

> --- a/target/nios2/mmu.c

> +++ b/target/nios2/mmu.c

> @@ -73,7 +73,7 @@ unsigned int mmu_translate(CPUNios2State *env,

>                             Nios2MMULookup *lu,

>                             target_ulong vaddr, int rw, int mmu_idx)

>  {

> -    Nios2CPU *cpu = nios2_env_get_cpu(env);

> +    Nios2CPU *cpu = env_archcpu(env);

>      int pid = (env->mmu.tlbmisc_wr & CR_TLBMISC_PID_MASK) >> 4;

>      int vpn = vaddr >> 12;

>

> @@ -115,7 +115,7 @@ unsigned int mmu_translate(CPUNios2State *env,

>  static void mmu_flush_pid(CPUNios2State *env, uint32_t pid)

>  {

>      CPUState *cs = env_cpu(env);

> -    Nios2CPU *cpu = nios2_env_get_cpu(env);

> +    Nios2CPU *cpu = env_archcpu(env);

>      int idx;

>      MMU_LOG(qemu_log("TLB Flush PID %d\n", pid));

>

> @@ -139,7 +139,7 @@ static void mmu_flush_pid(CPUNios2State *env, uint32_t pid)

>  void mmu_write(CPUNios2State *env, uint32_t rn, uint32_t v)

>  {

>      CPUState *cs = env_cpu(env);

> -    Nios2CPU *cpu = nios2_env_get_cpu(env);

> +    Nios2CPU *cpu = env_archcpu(env);

>

>      MMU_LOG(qemu_log("mmu_write %08X = %08X\n", rn, v));

>

> @@ -256,7 +256,7 @@ void mmu_write(CPUNios2State *env, uint32_t rn, uint32_t v)

>

>  void mmu_init(CPUNios2State *env)

>  {

> -    Nios2CPU *cpu = nios2_env_get_cpu(env);

> +    Nios2CPU *cpu = env_archcpu(env);

>      Nios2MMU *mmu = &env->mmu;

>

>      MMU_LOG(qemu_log("mmu_init\n"));

> @@ -267,7 +267,7 @@ void mmu_init(CPUNios2State *env)

>

>  void dump_mmu(CPUNios2State *env)

>  {

> -    Nios2CPU *cpu = nios2_env_get_cpu(env);

> +    Nios2CPU *cpu = env_archcpu(env);

>      int i;

>

>      qemu_printf("MMU: ways %d, entries %d, pid bits %d\n",

> --

> 2.17.1

>

>
diff mbox series

Patch

diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h
index b14095b8dc..f2ffc1469f 100644
--- a/target/nios2/cpu.h
+++ b/target/nios2/cpu.h
@@ -193,11 +193,6 @@  typedef struct Nios2CPU {
     uint32_t fast_tlb_miss_addr;
 } Nios2CPU;
 
-static inline Nios2CPU *nios2_env_get_cpu(CPUNios2State *env)
-{
-    return NIOS2_CPU(container_of(env, Nios2CPU, env));
-}
-
 #define ENV_OFFSET offsetof(Nios2CPU, env)
 
 void nios2_tcg_init(void);
diff --git a/hw/nios2/cpu_pic.c b/hw/nios2/cpu_pic.c
index 6bccce2f32..9e39955bd1 100644
--- a/hw/nios2/cpu_pic.c
+++ b/hw/nios2/cpu_pic.c
@@ -54,12 +54,9 @@  static void nios2_pic_cpu_handler(void *opaque, int irq, int level)
 
 void nios2_check_interrupts(CPUNios2State *env)
 {
-    Nios2CPU *cpu = nios2_env_get_cpu(env);
-    CPUState *cs = CPU(cpu);
-
     if (env->irq_pending) {
         env->irq_pending = 0;
-        cpu_interrupt(cs, CPU_INTERRUPT_HARD);
+        cpu_interrupt(env_cpu(env), CPU_INTERRUPT_HARD);
     }
 }
 
diff --git a/target/nios2/mmu.c b/target/nios2/mmu.c
index 33382bad1b..61eaa06b3e 100644
--- a/target/nios2/mmu.c
+++ b/target/nios2/mmu.c
@@ -73,7 +73,7 @@  unsigned int mmu_translate(CPUNios2State *env,
                            Nios2MMULookup *lu,
                            target_ulong vaddr, int rw, int mmu_idx)
 {
-    Nios2CPU *cpu = nios2_env_get_cpu(env);
+    Nios2CPU *cpu = env_archcpu(env);
     int pid = (env->mmu.tlbmisc_wr & CR_TLBMISC_PID_MASK) >> 4;
     int vpn = vaddr >> 12;
 
@@ -115,7 +115,7 @@  unsigned int mmu_translate(CPUNios2State *env,
 static void mmu_flush_pid(CPUNios2State *env, uint32_t pid)
 {
     CPUState *cs = env_cpu(env);
-    Nios2CPU *cpu = nios2_env_get_cpu(env);
+    Nios2CPU *cpu = env_archcpu(env);
     int idx;
     MMU_LOG(qemu_log("TLB Flush PID %d\n", pid));
 
@@ -139,7 +139,7 @@  static void mmu_flush_pid(CPUNios2State *env, uint32_t pid)
 void mmu_write(CPUNios2State *env, uint32_t rn, uint32_t v)
 {
     CPUState *cs = env_cpu(env);
-    Nios2CPU *cpu = nios2_env_get_cpu(env);
+    Nios2CPU *cpu = env_archcpu(env);
 
     MMU_LOG(qemu_log("mmu_write %08X = %08X\n", rn, v));
 
@@ -256,7 +256,7 @@  void mmu_write(CPUNios2State *env, uint32_t rn, uint32_t v)
 
 void mmu_init(CPUNios2State *env)
 {
-    Nios2CPU *cpu = nios2_env_get_cpu(env);
+    Nios2CPU *cpu = env_archcpu(env);
     Nios2MMU *mmu = &env->mmu;
 
     MMU_LOG(qemu_log("mmu_init\n"));
@@ -267,7 +267,7 @@  void mmu_init(CPUNios2State *env)
 
 void dump_mmu(CPUNios2State *env)
 {
-    Nios2CPU *cpu = nios2_env_get_cpu(env);
+    Nios2CPU *cpu = env_archcpu(env);
     int i;
 
     qemu_printf("MMU: ways %d, entries %d, pid bits %d\n",