On 12/9/20 11:42 AM, Alex Bennée wrote: > > Claudio Fontana <cfont...@suse.de> writes: > >> move away TCG-only code, make it compile only on TCG. >> >> Signed-off-by: Claudio Fontana <cfont...@suse.de> >> --- >> accel/tcg/cpu-exec.c | 28 +++++++++++++++++ >> cpu.c | 70 ++++++++++++++++++++----------------------- >> hw/core/cpu.c | 6 +++- >> include/hw/core/cpu.h | 8 +++++ >> 4 files changed, 74 insertions(+), 38 deletions(-) >> >> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c >> index 64cba89356..436dfbf155 100644 >> --- a/accel/tcg/cpu-exec.c >> +++ b/accel/tcg/cpu-exec.c >> @@ -801,6 +801,34 @@ int cpu_exec(CPUState *cpu) >> return ret; >> } >> >> +void tcg_exec_realizefn(CPUState *cpu, Error **errp) >> +{ >> + static bool tcg_target_initialized; >> + CPUClass *cc = CPU_GET_CLASS(cpu); >> + >> + if (!tcg_target_initialized) { >> + tcg_target_initialized = true; >> + cc->tcg_ops.initialize(); > > nit: it makes no difference but stylistically it makes sense to set > tcg_target_initialized after we have in fact initialised. > > Also we've dropped the tcg_enabled() check,
The tcg_enabled() check should be there, not here but in cpu_exec_realizefn, if (tcg_enabled()) { tcg_exec_realizefn(...) } will check, thanks! > if indeed it will always be > true should we not assert it to ensure the statement for tcg_exec_init > remains the case: "Must be called before using the QEMU cpus." > > Otherwise LGTM: > > Reviewed-by: Alex Bennée <alex.ben...@linaro.org> >