[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/29] tcg_funcs:Add tcg_exec_{realizefn, unrealizefn} to TCGMod
From: |
Gerd Hoffmann |
Subject: |
[PATCH 14/29] tcg_funcs:Add tcg_exec_{realizefn, unrealizefn} to TCGModuleOps |
Date: |
Tue, 31 Aug 2021 14:15:30 +0200 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
include/exec/cpu-all.h | 2 --
include/tcg/tcg-module.h | 2 ++
accel/tcg/cpu-exec.c | 12 ++++++++++--
accel/tcg/tcg-module.c | 6 ++++++
cpu.c | 4 ++--
5 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 32cfb634c6a0..c2bfd0ea1de1 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -440,8 +440,6 @@ void dump_opcount_info(void);
#ifdef CONFIG_TCG
/* accel/tcg/cpu-exec.c */
int cpu_exec(CPUState *cpu);
-void tcg_exec_realizefn(CPUState *cpu, Error **errp);
-void tcg_exec_unrealizefn(CPUState *cpu);
#endif /* CONFIG_TCG */
/* Returns: 0 on success, -1 on error */
diff --git a/include/tcg/tcg-module.h b/include/tcg/tcg-module.h
index 159cbd3e7ce6..5dd4deb9ed57 100644
--- a/include/tcg/tcg-module.h
+++ b/include/tcg/tcg-module.h
@@ -11,6 +11,8 @@ struct TCGModuleOps {
bool (*tlb_plugin_lookup)(CPUState *cpu, target_ulong addr, int mmu_idx,
bool is_store, struct qemu_plugin_hwaddr *data);
#endif
+ void (*tcg_exec_unrealizefn)(CPUState *cpu);
+ void (*tcg_exec_realizefn)(CPUState *cpu, Error **errp);
};
extern struct TCGModuleOps tcg;
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index e5c0ccd1a2ab..d41d1d2bd24f 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -981,7 +981,7 @@ int cpu_exec(CPUState *cpu)
return ret;
}
-void tcg_exec_realizefn(CPUState *cpu, Error **errp)
+static void tcg_exec_realizefn(CPUState *cpu, Error **errp)
{
static bool tcg_target_initialized;
CPUClass *cc = CPU_GET_CLASS(cpu);
@@ -999,7 +999,7 @@ void tcg_exec_realizefn(CPUState *cpu, Error **errp)
}
/* undo the initializations in reverse order */
-void tcg_exec_unrealizefn(CPUState *cpu)
+static void tcg_exec_unrealizefn(CPUState *cpu)
{
#ifndef CONFIG_USER_ONLY
tcg_iommu_free_notifier_list(cpu);
@@ -1031,3 +1031,11 @@ void dump_drift_info(void)
}
#endif /* !CONFIG_USER_ONLY */
+
+static void tcg_module_ops_exec(void)
+{
+ tcg.tcg_exec_realizefn = tcg_exec_realizefn;
+ tcg.tcg_exec_unrealizefn = tcg_exec_unrealizefn;
+}
+
+type_init(tcg_module_ops_exec);
diff --git a/accel/tcg/tcg-module.c b/accel/tcg/tcg-module.c
index db3d3e9e9318..36c1df564f31 100644
--- a/accel/tcg/tcg-module.c
+++ b/accel/tcg/tcg-module.c
@@ -21,6 +21,10 @@ static bool tlb_plugin_lookup_stub(CPUState *cpu,
target_ulong addr, int mmu_idx
}
#endif
+static void tcg_exec_realizefn_stub(CPUState *cpu, Error **errp)
+{
+}
+
struct TCGModuleOps tcg = {
.tlb_flush = update_cpu_stub,
.tlb_flush_page = tlb_flush_page_stub,
@@ -28,4 +32,6 @@ struct TCGModuleOps tcg = {
.tlb_reset_dirty = tlb_reset_dirty_stub,
.tlb_plugin_lookup = tlb_plugin_lookup_stub,
#endif
+ .tcg_exec_realizefn = tcg_exec_realizefn_stub,
+ .tcg_exec_unrealizefn = update_cpu_stub,
};
diff --git a/cpu.c b/cpu.c
index 26277f387baf..d1c9f68a26e7 100644
--- a/cpu.c
+++ b/cpu.c
@@ -140,7 +140,7 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
#ifdef CONFIG_TCG
/* NB: errp parameter is unused currently */
if (tcg_enabled()) {
- tcg_exec_realizefn(cpu, errp);
+ tcg.tcg_exec_realizefn(cpu, errp);
}
#endif /* CONFIG_TCG */
@@ -172,7 +172,7 @@ void cpu_exec_unrealizefn(CPUState *cpu)
#ifdef CONFIG_TCG
/* NB: errp parameter is unused currently */
if (tcg_enabled()) {
- tcg_exec_unrealizefn(cpu);
+ tcg.tcg_exec_unrealizefn(cpu);
}
#endif /* CONFIG_TCG */
--
2.31.1
- [PATCH 03/29] tcg/module: move hmp.c to module, (continued)
- [PATCH 03/29] tcg/module: move hmp.c to module, Gerd Hoffmann, 2021/08/31
- [PATCH 05/29] tcg/module: move tcg_ss to module [accel/tcg], Gerd Hoffmann, 2021/08/31
- [PATCH 04/29] tcg/module: move cputlb.c to module, Gerd Hoffmann, 2021/08/31
- [PATCH 06/29] tcg/module: move tcg_ss to module [tcg], Gerd Hoffmann, 2021/08/31
- [PATCH 07/29] tcg/module: move files to module [target/i386/tcg], Gerd Hoffmann, 2021/08/31
- [PATCH 08/29] move cpu-exec-common.c from tcg module to core qemu [accel/tcg], Gerd Hoffmann, 2021/08/31
- [PATCH 09/29] tcg/module: add tcg-module.[ch] infrastructure, Gerd Hoffmann, 2021/08/31
- [PATCH 10/29] tcg_funcs: Add tlb_flush to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 11/29] tcg_funcs: Add tlb_flush_page to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 12/29] tcg_funcs: Add tlb_reset_dirty to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 14/29] tcg_funcs:Add tcg_exec_{realizefn, unrealizefn} to TCGModuleOps,
Gerd Hoffmann <=
- [PATCH 13/29] tcg_funcs: Add tlb_plugin_lookup to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 15/29] tcg_funcs: Add tb_flush to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 17/29] tcg: drop tb_invalidate_phys_page_range(), Gerd Hoffmann, 2021/08/31
- [PATCH 16/29] tcg: use tb_page_addr_t for tb_invalidate_phys_range(), Gerd Hoffmann, 2021/08/31
- [PATCH 18/29] tcg_funcs: Add tb_invalidate_phys_range to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 19/29] tcg_funcs: Add tb_check_watchpoint to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 21/29] tcg_funcs: Add curr_cflags to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 20/29] tcg_funcs: Add cpu_restore_state to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [PATCH 23/29] tcg_i386_funcs: Add update_mxcsr_status to TCGI386ModuleOps, Gerd Hoffmann, 2021/08/31