tcg: some small towards more modular tcg
cover tcg: some small towards more modular tcg
Gerd Hoffmann (7):
plugins: register qemu_plugin_opts using opts_init() tcg/module: move hmp.c to tcg module
tcg/module: move cpu-exec-common.c from tcg_ss to specific_ss tcg/module: add some infrastructure for modular tcg. tcg/module: Add tlb_flush to TCGModuleOps tcg/module: Add tlb_flush_page to TCGModuleOps tcg/module: Add tlb_reset_dirty to TCGModuleOps
include/exec/exec-all.h | 8 +------- include/qemu/plugin.h | 7 ------- include/tcg/tcg-module.h | 15 +++++++++++++++ accel/tcg/cpu-exec-common.c | 8 ++++++++ accel/tcg/cputlb.c | 11 ++++++++++- accel/tcg/tcg-module.c | 24 ++++++++++++++++++++++++ accel/tcg/translate-all.c | 8 -------- cpu.c | 2 +- linux-user/main.c | 2 +- plugins/loader.c | 9 ++++++++- softmmu/physmem.c | 12 ++++++------ softmmu/vl.c | 1 - target/arm/helper.c | 26 +++++++++++++------------- target/i386/helper.c | 8 ++++---- target/i386/machine.c | 2 +- target/i386/tcg/fpu_helper.c | 2 +- target/i386/tcg/misc_helper.c | 2 +- target/mips/sysemu/cp0.c | 2 +- target/s390x/gdbstub.c | 2 +- target/s390x/sigp.c | 2 +- accel/tcg/meson.build | 11 +++++++++-- 21 files changed, 106 insertions(+), 58 deletions(-) create mode 100644 include/tcg/tcg-module.h create mode 100644 accel/tcg/tcg-module.c
Signature · 1 line
2.31.1
PATCH 1/7 plugins: register qemu_plugin_opts using opts_init()
Little preparation for building tcg modular.
No functional change.
--- include/qemu/plugin.h | 7 ------- linux-user/main.c | 2 +- plugins/loader.c | 9 ++++++++- softmmu/vl.c | 1 - 4 files changed, 9 insertions(+), 10 deletions(-)
include/qemu/plugin.h +0 -7
@@ -37,13 +37,6 @@ struct qemu_plugin_desc; typedef QTAILQ_HEAD(, qemu_plugin_desc) QemuPluginList;#ifdef CONFIG_PLUGIN -extern QemuOptsList qemu_plugin_opts; - -static inline void qemu_plugin_add_opts (void ) -{ -qemu_add_opts (&qemu_plugin_opts); -} -void qemu_plugin_opt_parse (const char *optarg,QemuPluginList *head);int qemu_plugin_load_list (QemuPluginList *head,Error **errp);
linux-user/main.c +1 -1
@@ -661,7 +661,7 @@ int main(int argc, char **argv, char **envp) cpu_model =NULL ;qemu_add_opts (&qemu_trace_opts); -qemu_plugin_add_opts (); +module_call_init (MODULE_INIT_OPTS ); optind =parse_args (argc, argv);
plugins/loader.c +8 -1
@@ -53,7 +53,7 @@ struct qemu_plugin_parse_arg {struct qemu_plugin_desc *curr; }; -QemuOptsList qemu_plugin_opts = { +static QemuOptsList qemu_plugin_opts = { .name ="plugin" , .implied_opt_name ="file" , .head =QTAILQ_HEAD_INITIALIZER (qemu_plugin_opts.head),
@@ -403,3 +403,10 @@ void plugin_reset_uninstall(qemu_plugin_id_t id,plugin_reset_destroy (data); } } + +static void plugin_register_config (void ) +{ +qemu_add_opts (&qemu_plugin_opts); +} +opts_init (plugin_register_config); +module_opts ("plugin" );
softmmu/vl.c +0 -1
@@ -2725,7 +2725,6 @@ void qemu_init(int argc, char **argv, char **envp)qemu_add_opts (&qemu_global_opts);qemu_add_opts (&qemu_mon_opts);qemu_add_opts (&qemu_trace_opts); -qemu_plugin_add_opts ();qemu_add_opts (&qemu_option_rom_opts);qemu_add_opts (&qemu_accel_opts);qemu_add_opts (&qemu_mem_opts);
Signature · 1 line
2.31.1
PATCH 2/7 tcg/module: move hmp.c to tcg module
In reply to Gerd HoffmannOne little step in moving more code to the tcg modules.
--- accel/tcg/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
accel/tcg/meson.build +1 -1
@@ -15,7 +15,6 @@ specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_ss) specific_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_TCG'], if_true: files( 'cputlb.c', - 'hmp.c', )) tcg_module_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_TCG'], if_true: files(
@@ -23,4 +22,5 @@ tcg_module_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_TCG'], if_true: files( 'tcg-accel-ops-mttcg.c', 'tcg-accel-ops-icount.c', 'tcg-accel-ops-rr.c', + 'hmp.c', ))
Signature · 1 line
2.31.1
PATCH 3/7 tcg/module: move cpu-exec-common.c from tcg_ss to specific_ss
In reply to Gerd HoffmannThat will build cpu-exec-common.c into core qemu. Moves tcg_allowed variable and some small glue functions.
--- accel/tcg/meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
accel/tcg/meson.build +4 -1
@@ -1,7 +1,10 @@ +specific_ss.add(when: 'CONFIG_TCG', if_true: files( + 'cpu-exec-common.c', +)) + tcg_ss = ss.source_set() tcg_ss.add(files( 'tcg-all.c', - 'cpu-exec-common.c', 'cpu-exec.c', 'tcg-runtime-gvec.c', 'tcg-runtime.c',
Signature · 1 line
2.31.1
PATCH 4/7 tcg/module: add some infrastructure for modular tcg.
In reply to Gerd HoffmannCreate tcg-module.[ch] files, with struct TCGModuleOps, empty for now.
Followup patches will add function pointers to the struct and stub functions to tcg-module.c. That will effectively will switch stubs from compile-time to runtime, which is needed to build tcg as module.
--- include/tcg/tcg-module.h | 8 ++++++++ accel/tcg/tcg-module.c | 5 +++++ accel/tcg/meson.build | 4 ++++ 3 files changed, 17 insertions(+) create mode 100644 include/tcg/tcg-module.h create mode 100644 accel/tcg/tcg-module.c
include/tcg/tcg-module.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef TCG_MODULE_H +#define TCG_MODULE_H + +struct TCGModuleOps { +}; +extern struct TCGModuleOps tcg; + +#endif /* TCG_MODULE_H */
accel/tcg/tcg-module.c new file +5 -0
@@ -0,0 +1,5 @@ +#include "qemu/osdep.h" +#include "tcg/tcg-module.h" + +struct TCGModuleOps tcg = { +};
accel/tcg/meson.build +4 -0
@@ -1,3 +1,7 @@ +specific_ss.add(files( + 'tcg-module.c', +)) + specific_ss.add(when: 'CONFIG_TCG', if_true: files( 'cpu-exec-common.c', ))
Signature · 1 line
2.31.1
PATCH 5/7 tcg/module: Add tlb_flush to TCGModuleOps
In reply to Gerd HoffmannMove stub from exec-all.h to tcg-module.c.
Move tcg_flush_softmmu_tlb to cpu-exec-common.c
so it gets compiled into core qemu.
--- include/exec/exec-all.h | 4 +--- include/tcg/tcg-module.h | 1 + accel/tcg/cpu-exec-common.c | 8 ++++++++ accel/tcg/cputlb.c | 7 +++++++ accel/tcg/tcg-module.c | 5 +++++ accel/tcg/translate-all.c | 8 -------- cpu.c | 2 +- softmmu/physmem.c | 6 +++--- target/arm/helper.c | 22 +++++++++++----------- target/i386/helper.c | 8 ++++---- target/i386/machine.c | 2 +- target/i386/tcg/fpu_helper.c | 2 +- target/i386/tcg/misc_helper.c | 2 +- target/mips/sysemu/cp0.c | 2 +- target/s390x/gdbstub.c | 2 +- target/s390x/sigp.c | 2 +- 16 files changed, 47 insertions(+), 36 deletions(-)
include/exec/exec-all.h +1 -3
@@ -25,6 +25,7 @@#include "exec/cpu_ldst.h" #endif #include "sysemu/cpu-timers.h" +#include "tcg/tcg-module.h" /* allow to see translation results - the slowdown should be negligible, so we leave it */ #define DEBUG_DISAS
@@ -337,9 +338,6 @@ static inline void tlb_flush_page_all_cpus_synced(CPUState *src, target_ulong addr) { } -static inline void tlb_flush (CPUState *cpu) -{ -}static inline void tlb_flush_all_cpus (CPUState *src_cpu) { }
include/tcg/tcg-module.h +1 -0
@@ -2,6 +2,7 @@#define TCG_MODULE_H struct TCGModuleOps { +void (*tlb_flush)(CPUState *cpu); };extern struct TCGModuleOps tcg;
accel/tcg/cpu-exec-common.c +8 -0
@@ -81,3 +81,11 @@ void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc) cpu->exception_index =EXCP_ATOMIC ;cpu_loop_exit_restore (cpu, pc); } + +/* This is a wrapper for common code that can not use CONFIG_SOFTMMU */ +void tcg_flush_softmmu_tlb (CPUState *cs) +{ +#ifdef CONFIG_SOFTMMU + tcg.tlb_flush (cs); +#endif +}
accel/tcg/cputlb.c +7 -0
@@ -2767,3 +2767,10 @@ uint64_t cpu_ldq_code(CPUArchState *env, abi_ptr addr)TCGMemOpIdx oi =make_memop_idx (MO_TEQ ,cpu_mmu_index (env, true));return full_ldq_code (env, addr, oi,0 ); } + +static void tcg_module_ops_tlb (void ) +{ + tcg.tlb_flush = tlb_flush; +} + +type_init (tcg_module_ops_tlb);
accel/tcg/tcg-module.c +5 -0
@@ -1,5 +1,10 @@#include "qemu/osdep.h" #include "tcg/tcg-module.h" +static void update_cpu_stub (CPUState *cpu) +{ +} +struct TCGModuleOps tcg = { + .tlb_flush = update_cpu_stub, };
accel/tcg/translate-all.c +0 -8
@@ -2463,11 +2463,3 @@ int page_unprotect(target_ulong address, uintptr_t pc) return 0; }#endif /* CONFIG_USER_ONLY */ - -/* This is a wrapper for common code that can not use CONFIG_SOFTMMU */ -void tcg_flush_softmmu_tlb (CPUState *cs) -{ -#ifdef CONFIG_SOFTMMU -tlb_flush (cs); -#endif -}
cpu.c +1 -1
@@ -51,7 +51,7 @@ static int cpu_common_post_load(void *opaque, int version_id)/* 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the version_id is increased. */ cpu->interrupt_request &= ~0x01 ; -tlb_flush (cpu); + tcg.tlb_flush (cpu);/* loadvm has just updated the content of RAM, bypassing the * usual mechanisms that ensure we flush TBs for writes to
softmmu/physmem.c +3 -3
@@ -589,7 +589,7 @@ static void tcg_iommu_unmap_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)if (!notifier->active) {return ; } -tlb_flush (notifier->cpu); + tcg.tlb_flush (notifier->cpu); notifier->active = false;/* We leave the notifier struct on the list to avoid reallocating it later. * Generally the number of IOMMUs a CPU deals with will be small.
@@ -796,7 +796,7 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,if (len <= in_page) {tlb_flush_page (cpu, addr); }else { -tlb_flush (cpu); + tcg.tlb_flush (cpu); }if (watchpoint)
@@ -2652,7 +2652,7 @@ static void tcg_commit(MemoryListener *listener)*/ d =address_space_to_dispatch (cpuas->as);qatomic_rcu_set (&cpuas->memory_dispatch, d); -tlb_flush (cpuas->cpu); + tcg.tlb_flush (cpuas->cpu); }static void memory_map_init (void )
target/arm/helper.c +11 -11
@@ -674,7 +674,7 @@ static void dacr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)ARMCPU *cpu =env_archcpu (env);raw_write (env, ri, value); -tlb_flush (CPU (cpu));/* Flush TLB as domain not tracked in TLB */ + tcg.tlb_flush (CPU (cpu));/* Flush TLB as domain not tracked in TLB */ }static void fcse_write (CPUARMState *env,const ARMCPRegInfo *ri,uint64_t value)
@@ -685,7 +685,7 @@ static void fcse_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)/* Unlike real hardware the qemu TLB uses virtual addresses, * not modified virtual addresses, so this causes a TLB flush. */ -tlb_flush (CPU (cpu)); + tcg.tlb_flush (CPU (cpu));raw_write (env, ri, value); } }
@@ -701,7 +701,7 @@ static void contextidr_write(CPUARMState *env, const ARMCPRegInfo *ri,* format) this register includes the ASID, so do a TLB flush. * For PMSA it is purely a process ID and no action is needed. */ -tlb_flush (CPU (cpu)); + tcg.tlb_flush (CPU (cpu)); }raw_write (env, ri, value); }
@@ -758,7 +758,7 @@ static void tlbiall_write(CPUARMState *env, const ARMCPRegInfo *ri,if (tlb_force_broadcast (env)) {tlb_flush_all_cpus_synced (cs); }else { -tlb_flush (cs); + tcg.tlb_flush (cs); } }
@@ -785,7 +785,7 @@ static void tlbiasid_write(CPUARMState *env, const ARMCPRegInfo *ri,if (tlb_force_broadcast (env)) {tlb_flush_all_cpus_synced (cs); }else { -tlb_flush (cs); + tcg.tlb_flush (cs); } }
@@ -3826,7 +3826,7 @@ static void pmsav7_write(CPUARMState *env, const ARMCPRegInfo *ri, } u32p += env->pmsav7.rnr[M_REG_NS ]; -tlb_flush (CPU (cpu));/* Mappings may have changed - purge! */ + tcg.tlb_flush (CPU (cpu));/* Mappings may have changed - purge! */ *u32p = value; }
@@ -3968,7 +3968,7 @@ static void vmsa_ttbcr_write(CPUARMState *env, const ARMCPRegInfo *ri,/* With LPAE the TTBCR could result in a change of ASID * via the TTBCR.A1 bit, so do a TLB flush. */ -tlb_flush (CPU (cpu)); + tcg.tlb_flush (CPU (cpu)); }/* Preserve the high half of TCR_EL1, set via TTBCR2. */ value =deposit64 (tcr->raw_tcr,0 ,32 , value);
@@ -3994,7 +3994,7 @@ static void vmsa_tcr_el12_write(CPUARMState *env, const ARMCPRegInfo *ri,TCR *tcr =raw_ptr (env, ri);/* For AArch64 the A1 bit could result in a change of ASID, so TLB flush. */ -tlb_flush (CPU (cpu)); + tcg.tlb_flush (CPU (cpu)); tcr->raw_tcr = value; }
@@ -4005,7 +4005,7 @@ static void vmsa_ttbr_write(CPUARMState *env, const ARMCPRegInfo *ri,if (cpreg_field_is_64bit (ri) &&extract64 (raw_read (env, ri) ^ value,48 ,16 ) !=0 ) {ARMCPU *cpu =env_archcpu (env); -tlb_flush (CPU (cpu)); + tcg.tlb_flush (CPU (cpu)); }raw_write (env, ri, value); }
@@ -5021,7 +5021,7 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri,raw_write (env, ri, value);/* This may enable/disable the MMU, so do a TLB flush. */ -tlb_flush (CPU (cpu)); + tcg.tlb_flush (CPU (cpu));if (ri->type &ARM_CP_SUPPRESS_TB_END ) {/*
@@ -5560,7 +5560,7 @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask)* HCR_DCT enables tagging on (disabled) stage1 translation */ if ((env->cp15.hcr_el2 ^ value) & (HCR_VM |HCR_PTW |HCR_DC |HCR_DCT )) { -tlb_flush (CPU (cpu)); + tcg.tlb_flush (CPU (cpu)); } env->cp15.hcr_el2 = value;
target/i386/helper.c +4 -4
@@ -103,7 +103,7 @@ void x86_cpu_set_a20(X86CPU *cpu, int a20_state)/* when a20 is changed, all the MMU mappings are invalid, so we must flush everything */ -tlb_flush (cs); + tcg.tlb_flush (cs); env->a20_mask = ~(1 <<20 ) | (a20_state <<20 ); } }
@@ -116,7 +116,7 @@ void cpu_x86_update_cr0(CPUX86State *env, uint32_t new_cr0)qemu_log_mask (CPU_LOG_MMU ,"CR0 update: CR0=0x%08x\n" , new_cr0);if ((new_cr0 & (CR0_PG_MASK |CR0_WP_MASK |CR0_PE_MASK )) != (env->cr[0 ] & (CR0_PG_MASK |CR0_WP_MASK |CR0_PE_MASK ))) { -tlb_flush (CPU (cpu)); + tcg.tlb_flush (CPU (cpu)); }#ifdef TARGET_X86_64
@@ -156,7 +156,7 @@ void cpu_x86_update_cr3(CPUX86State *env, target_ulong new_cr3)if (env->cr[0 ] &CR0_PG_MASK ) {qemu_log_mask (CPU_LOG_MMU ,"CR3 update: CR3=" TARGET_FMT_lx"\n" , new_cr3); -tlb_flush (env_cpu (env)); + tcg.tlb_flush (env_cpu (env)); } }
@@ -170,7 +170,7 @@ void cpu_x86_update_cr4(CPUX86State *env, uint32_t new_cr4)if ((new_cr4 ^ env->cr[4 ]) & (CR4_PGE_MASK |CR4_PAE_MASK |CR4_PSE_MASK |CR4_SMEP_MASK |CR4_SMAP_MASK |CR4_LA57_MASK )) { -tlb_flush (env_cpu (env)); + tcg.tlb_flush (env_cpu (env)); }/* Clear bits we're going to recompute. */
target/i386/machine.c +1 -1
@@ -383,7 +383,7 @@ static int cpu_post_load(void *opaque, int version_id) env->dr[7 ] = dr7 & ~(DR7_GLOBAL_BP_MASK |DR7_LOCAL_BP_MASK );cpu_x86_update_dr7 (env, dr7); } -tlb_flush (cs); + tcg.tlb_flush (cs);return 0 ; }
target/i386/tcg/fpu_helper.c +1 -1
@@ -2874,7 +2874,7 @@ void helper_xrstor(CPUX86State *env, target_ulong ptr, uint64_t rfbm) }if (env->pkru != old_pkru) {CPUState *cs =env_cpu (env); -tlb_flush (cs); + tcg.tlb_flush (cs); } } }
target/i386/tcg/misc_helper.c +1 -1
@@ -142,5 +142,5 @@ void helper_wrpkru(CPUX86State *env, uint32_t ecx, uint64_t val) } env->pkru = val; -tlb_flush (cs); + tcg.tlb_flush (cs); }
target/mips/sysemu/cp0.c +1 -1
@@ -81,7 +81,7 @@ void cpu_mips_store_status(CPUMIPSState *env, target_ulong val)#if defined(TARGET_MIPS64 )if ((env->CP0_Status ^ old) & (old & (7 << CP0St_UX))) {/* Access to at least one of the 64-bit segments has been disabled */ -tlb_flush (env_cpu (env)); + tcg.tlb_flush (env_cpu (env)); }#endif if (ase_mt_available (env)) {
target/s390x/gdbstub.c +1 -1
@@ -191,7 +191,7 @@ static int cpu_write_c_reg(CPUS390XState *env, uint8_t *mem_buf, int n) case S390_C0_REGNUM ... S390_C15_REGNUM: env->cregs[n] =ldtul_p (mem_buf);if (tcg_enabled ()) { -tlb_flush (env_cpu (env)); + tcg.tlb_flush (env_cpu (env)); }cpu_synchronize_post_init (env_cpu (env));return 8 ;
target/s390x/sigp.c +1 -1
@@ -294,7 +294,7 @@ static void sigp_set_prefix(CPUState *cs, run_on_cpu_data arg) } cpu->env.psa = addr; -tlb_flush (cs); + tcg.tlb_flush (cs);cpu_synchronize_post_init (cs); si->cc =SIGP_CC_ORDER_CODE_ACCEPTED ; }
Signature · 1 line
2.31.1
PATCH 6/7 tcg/module: Add tlb_flush_page to TCGModuleOps
In reply to Gerd HoffmannMove stub from exec-all.h to tcg-module.c.
--- include/exec/exec-all.h | 3 --- include/tcg/tcg-module.h | 3 +++ accel/tcg/cputlb.c | 1 + accel/tcg/tcg-module.c | 5 +++++ softmmu/physmem.c | 4 ++-- target/arm/helper.c | 4 ++-- 6 files changed, 13 insertions(+), 7 deletions(-)
include/exec/exec-all.h +0 -3
@@ -328,9 +328,6 @@ static inline void tlb_init(CPUState *cpu)static inline void tlb_destroy (CPUState *cpu) { } -static inline void tlb_flush_page (CPUState *cpu,target_ulong addr) -{ -}static inline void tlb_flush_page_all_cpus (CPUState *src,target_ulong addr) { }
include/tcg/tcg-module.h +3 -0
@@ -1,8 +1,11 @@#ifndef TCG_MODULE_H #define TCG_MODULE_H +#include "exec/exec-all.h" +struct TCGModuleOps {void (*tlb_flush)(CPUState *cpu); +void (*tlb_flush_page)(CPUState *cpu,target_ulong addr); };extern struct TCGModuleOps tcg;
accel/tcg/cputlb.c +1 -0
@@ -2771,6 +2771,7 @@ uint64_t cpu_ldq_code(CPUArchState *env, abi_ptr addr)static void tcg_module_ops_tlb (void ) { tcg.tlb_flush = tlb_flush; + tcg.tlb_flush_page = tlb_flush_page; }type_init (tcg_module_ops_tlb);
accel/tcg/tcg-module.c +5 -0
@@ -5,6 +5,11 @@ static void update_cpu_stub(CPUState *cpu) { } +static void tlb_flush_page_stub (CPUState *cpu,target_ulong addr) +{ +} +struct TCGModuleOps tcg = { .tlb_flush = update_cpu_stub, + .tlb_flush_page = tlb_flush_page_stub, };
softmmu/physmem.c +2 -2
@@ -794,7 +794,7 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, in_page = -(addr |TARGET_PAGE_MASK );if (len <= in_page) { -tlb_flush_page (cpu, addr); + tcg.tlb_flush_page (cpu, addr); }else { tcg.tlb_flush (cpu); }
@@ -825,7 +825,7 @@ void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint) {QTAILQ_REMOVE (&cpu->watchpoints, watchpoint, entry); -tlb_flush_page (cpu, watchpoint->vaddr); + tcg.tlb_flush_page (cpu, watchpoint->vaddr);g_free (watchpoint); }
target/arm/helper.c +2 -2
@@ -772,7 +772,7 @@ static void tlbimva_write(CPUARMState *env, const ARMCPRegInfo *ri,if (tlb_force_broadcast (env)) {tlb_flush_page_all_cpus_synced (cs, value); }else { -tlb_flush_page (cs, value); + tcg.tlb_flush_page (cs, value); } }
@@ -799,7 +799,7 @@ static void tlbimvaa_write(CPUARMState *env, const ARMCPRegInfo *ri,if (tlb_force_broadcast (env)) {tlb_flush_page_all_cpus_synced (cs, value); }else { -tlb_flush_page (cs, value); + tcg.tlb_flush_page (cs, value); } }
Signature · 1 line
2.31.1
PATCH 7/7 tcg/module: Add tlb_reset_dirty to TCGModuleOps
In reply to Gerd HoffmannMove stub from exec-all.h to tcg-module.c.
--- include/exec/exec-all.h | 1 - include/tcg/tcg-module.h | 3 +++ accel/tcg/cputlb.c | 3 ++- accel/tcg/tcg-module.c | 9 +++++++++ softmmu/physmem.c | 2 +- 5 files changed, 15 insertions(+), 3 deletions(-)
include/exec/exec-all.h +0 -1
@@ -691,7 +691,6 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr);tb_page_addr_t get_page_addr_code_hostp (CPUArchState *env,target_ulong addr,void **hostp); -void tlb_reset_dirty (CPUState *cpu,ram_addr_t start1,ram_addr_t length);void tlb_set_dirty (CPUState *cpu,target_ulong vaddr); MemoryRegionSection *
include/tcg/tcg-module.h +3 -0
@@ -6,6 +6,9 @@struct TCGModuleOps {void (*tlb_flush)(CPUState *cpu);void (*tlb_flush_page)(CPUState *cpu,target_ulong addr); +#if defined(CONFIG_SOFTMMU ) +void (*tlb_reset_dirty)(CPUState *cpu,ram_addr_t start1,ram_addr_t length); +#endif };extern struct TCGModuleOps tcg;
accel/tcg/cputlb.c +2 -1
@@ -1004,7 +1004,7 @@ static inline void copy_tlb_helper_locked(CPUTLBEntry *d, const CPUTLBEntry *s)* We must take tlb_c.lock to avoid racing with another vCPU update. The only * thing actually updated is the target TLB entry ->addr_write flags. */ -void tlb_reset_dirty (CPUState *cpu,ram_addr_t start1,ram_addr_t length) +static void tlb_reset_dirty (CPUState *cpu,ram_addr_t start1,ram_addr_t length) {CPUArchState *env;
@@ -2772,6 +2772,7 @@ static void tcg_module_ops_tlb(void) { tcg.tlb_flush = tlb_flush; tcg.tlb_flush_page = tlb_flush_page; + tcg.tlb_reset_dirty = tlb_reset_dirty; }type_init (tcg_module_ops_tlb);
accel/tcg/tcg-module.c +9 -0
@@ -9,7 +9,16 @@ static void tlb_flush_page_stub(CPUState *cpu, target_ulong addr) { } +#if defined(CONFIG_SOFTMMU ) +static void tlb_reset_dirty_stub (CPUState *cpu,ram_addr_t start1,ram_addr_t length) +{ +} +#endif +struct TCGModuleOps tcg = { .tlb_flush = update_cpu_stub, .tlb_flush_page = tlb_flush_page_stub, +#if defined(CONFIG_SOFTMMU) + .tlb_reset_dirty = tlb_reset_dirty_stub, +#endif };
softmmu/physmem.c +1 -1
@@ -1015,7 +1015,7 @@ static void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length)assert (block ==qemu_get_ram_block (end -1 )); start1 = (uintptr_t )ramblock_ptr (block, start - block->offset);CPU_FOREACH (cpu) { -tlb_reset_dirty (cpu, start1, length); + tcg.tlb_reset_dirty (cpu, start1, length); } }
Signature · 1 line
2.31.1