Skip to content

Commit f37799c

Browse files
committed
target/xtensa: Move has_work() from CPUClass to SysemuCPUOps
Move has_work() from CPUClass to SysemuCPUOps, simplifying xtensa_cpu_has_work() by directly using CPU env. Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-Id: <[email protected]>
1 parent d55ea95 commit f37799c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

target/xtensa/cpu.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,14 @@ static void xtensa_restore_state_to_opc(CPUState *cs,
6363
cpu->env.pc = data[0];
6464
}
6565

66+
#ifndef CONFIG_USER_ONLY
6667
static bool xtensa_cpu_has_work(CPUState *cs)
6768
{
68-
#ifndef CONFIG_USER_ONLY
69-
XtensaCPU *cpu = XTENSA_CPU(cs);
69+
CPUXtensaState *env = cpu_env(cs);
7070

71-
return !cpu->env.runstall && cpu->env.pending_irq_level;
72-
#else
73-
return true;
74-
#endif
71+
return !env->runstall && env->pending_irq_level;
7572
}
73+
#endif /* !CONFIG_USER_ONLY */
7674

7775
static int xtensa_cpu_mmu_index(CPUState *cs, bool ifetch)
7876
{
@@ -226,6 +224,7 @@ static const VMStateDescription vmstate_xtensa_cpu = {
226224
#include "hw/core/sysemu-cpu-ops.h"
227225

228226
static const struct SysemuCPUOps xtensa_sysemu_ops = {
227+
.has_work = xtensa_cpu_has_work,
229228
.get_phys_page_debug = xtensa_cpu_get_phys_page_debug,
230229
};
231230
#endif
@@ -263,7 +262,6 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
263262
&xcc->parent_phases);
264263

265264
cc->class_by_name = xtensa_cpu_class_by_name;
266-
cc->has_work = xtensa_cpu_has_work;
267265
cc->mmu_index = xtensa_cpu_mmu_index;
268266
cc->dump_state = xtensa_cpu_dump_state;
269267
cc->set_pc = xtensa_cpu_set_pc;

0 commit comments

Comments
 (0)