From e9e51b7154404efc9af8735ab87c658a9c434cfd Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Thu, 4 Feb 2021 17:39:09 +0100 Subject: cpu: Introduce TCGCpuOperations struct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The TCG-specific CPU methods will be moved to a separate struct, to make it easier to move accel-specific code outside generic CPU code in the future. Start by moving tcg_initialize(). The new CPUClass.tcg_opts field may eventually become a pointer, but keep it an embedded struct for now, to make code conversion easier. Signed-off-by: Eduardo Habkost [claudio: move TCGCpuOperations inside include/hw/core/cpu.h] Reviewed-by: Alex Bennée Message-Id: <20210204163931.7358-2-cfontana@suse.de> Signed-off-by: Richard Henderson --- cpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cpu.c') diff --git a/cpu.c b/cpu.c index 0b245cda2e..79a2bf12b3 100644 --- a/cpu.c +++ b/cpu.c @@ -159,14 +159,18 @@ void cpu_exec_initfn(CPUState *cpu) void cpu_exec_realizefn(CPUState *cpu, Error **errp) { CPUClass *cc = CPU_GET_CLASS(cpu); +#ifdef CONFIG_TCG static bool tcg_target_initialized; +#endif /* CONFIG_TCG */ cpu_list_add(cpu); +#ifdef CONFIG_TCG if (tcg_enabled() && !tcg_target_initialized) { tcg_target_initialized = true; - cc->tcg_initialize(); + cc->tcg_ops.initialize(); } +#endif /* CONFIG_TCG */ tlb_init(cpu); qemu_plugin_vcpu_init_hook(cpu); -- cgit v1.2.3