CPUXtensa::runstall and CPUState::start_powered_off are
semantically equivalent. Replace the target specific field
by the generic one.

Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
 target/xtensa/cpu.h    | 1 -
 target/xtensa/cpu.c    | 8 ++++++--
 target/xtensa/helper.c | 6 ++++--
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h
index 74122ebe15c..43b8cabdcd3 100644
--- a/target/xtensa/cpu.h
+++ b/target/xtensa/cpu.h
@@ -529,7 +529,6 @@ struct CPUArchState {
     xtensa_tlb_entry dtlb[10][MAX_TLB_WAY_SIZE];
     xtensa_mpu_entry mpu_fg[MAX_MPU_FOREGROUND_SEGMENTS];
     unsigned autorefill_idx;
-    bool runstall;
     AddressSpace *address_space_er;
     MemoryRegion *system_er;
     int pending_irq_level; /* level of last raised IRQ */
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
index ea9b6df3aa2..65f0e778775 100644
--- a/target/xtensa/cpu.c
+++ b/target/xtensa/cpu.c
@@ -143,7 +143,7 @@ static bool xtensa_cpu_has_work(CPUState *cs)
 {
     CPUXtensaState *env = cpu_env(cs);
 
-    return !env->runstall && env->pending_irq_level;
+    return !cs->start_powered_off && env->pending_irq_level;
 }
 #endif /* !CONFIG_USER_ONLY */
 
@@ -204,7 +204,11 @@ static void xtensa_cpu_reset_hold(Object *obj, ResetType 
type)
 
 #ifndef CONFIG_USER_ONLY
     reset_mmu(env);
-    cs->halted = env->runstall;
+    if (cs->start_powered_off) {
+        cs->halted = 1;
+    } else {
+        cs->halted = 0;
+    }
 #endif
     /* For inf * 0 + NaN, return the input NaN */
     set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c
index 2d93b45036d..a64df1cadac 100644
--- a/target/xtensa/helper.c
+++ b/target/xtensa/helper.c
@@ -311,11 +311,13 @@ void xtensa_runstall(CPUXtensaState *env, bool runstall)
 {
     CPUState *cpu = env_cpu(env);
 
-    env->runstall = runstall;
-    cpu->halted = runstall;
     if (runstall) {
+        cpu->start_powered_off = true;
+        cpu->halted = 1;
         cpu_interrupt(cpu, CPU_INTERRUPT_HALT);
     } else {
+        cpu->start_powered_off = false;
+        cpu->halted = 0;
         qemu_cpu_kick(cpu);
     }
 }
-- 
2.51.0


Reply via email to