Skip to content

Commit

Permalink
Revert "[ot] hw/core: Use resettable API to maintain CPU on reset"
Browse files Browse the repository at this point in the history
This reverts commit 6a70093.
  • Loading branch information
loiclefort committed Dec 13, 2023
1 parent 1542589 commit 3cf6563
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 26 deletions.
4 changes: 2 additions & 2 deletions accel/tcg/cpu-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,11 +689,11 @@ static inline bool cpu_handle_halt(CPUState *cpu)
return true;
}

cpu->halted = cpu->on_reset;
cpu->halted = 0;
}
#endif /* !CONFIG_USER_ONLY */

return cpu->on_reset;
return false;
}

static inline void cpu_handle_debug_exception(CPUState *cpu)
Expand Down
25 changes: 2 additions & 23 deletions hw/core/cpu-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,34 +116,15 @@ void cpu_reset(CPUState *cpu)
trace_cpu_reset(cpu->cpu_index);
}

static void cpu_common_reset_enter(Object *obj, ResetType type)
static void cpu_common_reset_hold(Object *obj)
{
CPUState *cpu = CPU(obj);
CPUClass *cc = CPU_GET_CLASS(cpu);
cpu->on_reset = true;

if (qemu_loglevel_mask(CPU_LOG_RESET)) {
qemu_log("CPU Reset Enter (CPU %d)\n", cpu->cpu_index);
qemu_log("CPU Reset (CPU %d)\n", cpu->cpu_index);
log_cpu_state(cpu, cc->reset_dump_flags);
}
}

static void cpu_common_reset_exit(Object *obj)
{
CPUState *cpu = CPU(obj);
cpu->on_reset = false;
cpu->halted = 0;
if (qemu_loglevel_mask(CPU_LOG_RESET)) {
CPUClass *cc = CPU_GET_CLASS(cpu);
qemu_log("CPU Reset Exit (CPU %d) PC:0x%" VADDR_PRIx "\n",
cpu->cpu_index, cc->get_pc(cpu));
}
cpu_resume(cpu);
}

static void cpu_common_reset_hold(Object *obj)
{
CPUState *cpu = CPU(obj);

cpu->interrupt_request = 0;
cpu->halted = cpu->start_powered_off;
Expand Down Expand Up @@ -289,9 +270,7 @@ static void cpu_class_init(ObjectClass *klass, void *data)
set_bit(DEVICE_CATEGORY_CPU, dc->categories);
dc->realize = cpu_common_realizefn;
dc->unrealize = cpu_common_unrealizefn;
rc->phases.enter = cpu_common_reset_enter;
rc->phases.hold = cpu_common_reset_hold;
rc->phases.exit = cpu_common_reset_exit;
cpu_class_init_props(dc);
/*
* Reason: CPUs still need special care by board code: wiring up
Expand Down
1 change: 0 additions & 1 deletion include/hw/core/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ struct CPUState {

/* Should CPU start in powered-off state? */
bool start_powered_off;
bool on_reset;

bool unplug;
bool crash_occurred;
Expand Down

0 comments on commit 3cf6563

Please sign in to comment.