mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
accel/tcg: Make TCGCPUOps::cpu_exec_halt mandatory
Now that all targets set TCGCPUOps::cpu_exec_halt, we can make it mandatory and remove the fallback handling that calls cpu_has_work. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
4f7b1ecba8
commit
0487c63180
2 changed files with 11 additions and 9 deletions
|
@ -682,13 +682,8 @@ static inline bool cpu_handle_halt(CPUState *cpu)
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
if (cpu->halted) {
|
if (cpu->halted) {
|
||||||
const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops;
|
const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops;
|
||||||
bool leave_halt;
|
bool leave_halt = tcg_ops->cpu_exec_halt(cpu);
|
||||||
|
|
||||||
if (tcg_ops->cpu_exec_halt) {
|
|
||||||
leave_halt = tcg_ops->cpu_exec_halt(cpu);
|
|
||||||
} else {
|
|
||||||
leave_halt = cpu_has_work(cpu);
|
|
||||||
}
|
|
||||||
if (!leave_halt) {
|
if (!leave_halt) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1082,6 +1077,10 @@ bool tcg_exec_realizefn(CPUState *cpu, Error **errp)
|
||||||
static bool tcg_target_initialized;
|
static bool tcg_target_initialized;
|
||||||
|
|
||||||
if (!tcg_target_initialized) {
|
if (!tcg_target_initialized) {
|
||||||
|
/* Check mandatory TCGCPUOps handlers */
|
||||||
|
#ifndef CONFIG_USER_ONLY
|
||||||
|
assert(cpu->cc->tcg_ops->cpu_exec_halt);
|
||||||
|
#endif /* !CONFIG_USER_ONLY */
|
||||||
cpu->cc->tcg_ops->initialize();
|
cpu->cc->tcg_ops->initialize();
|
||||||
tcg_target_initialized = true;
|
tcg_target_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,10 +122,13 @@ struct TCGCPUOps {
|
||||||
* to do when the CPU is in the halted state.
|
* to do when the CPU is in the halted state.
|
||||||
*
|
*
|
||||||
* Return true to indicate that the CPU should now leave halt, false
|
* Return true to indicate that the CPU should now leave halt, false
|
||||||
* if it should remain in the halted state.
|
* if it should remain in the halted state. (This should generally
|
||||||
|
* be the same value that cpu_has_work() would return.)
|
||||||
*
|
*
|
||||||
* If this method is not provided, the default is to do nothing, and
|
* This method must be provided. If the target does not need to
|
||||||
* to leave halt if cpu_has_work() returns true.
|
* do anything special for halt, the same function used for its
|
||||||
|
* CPUClass::has_work method can be used here, as they have the
|
||||||
|
* same function signature.
|
||||||
*/
|
*/
|
||||||
bool (*cpu_exec_halt)(CPUState *cpu);
|
bool (*cpu_exec_halt)(CPUState *cpu);
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue