[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/29] tcg_funcs: Add tlb_reset_dirty to TCGModuleOps
From: |
Gerd Hoffmann |
Subject: |
[PATCH 12/29] tcg_funcs: Add tlb_reset_dirty to TCGModuleOps |
Date: |
Tue, 31 Aug 2021 14:15:28 +0200 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
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(-)
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 43d89699e989..27fc489c57b5 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -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 *
diff --git a/include/tcg/tcg-module.h b/include/tcg/tcg-module.h
index a903e3ee62c0..a14dcdb002db 100644
--- a/include/tcg/tcg-module.h
+++ b/include/tcg/tcg-module.h
@@ -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;
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 1fcdb71a10a0..fa9c9064848c 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -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);
diff --git a/accel/tcg/tcg-module.c b/accel/tcg/tcg-module.c
index 4d62160628bd..febf4e49981c 100644
--- a/accel/tcg/tcg-module.c
+++ b/accel/tcg/tcg-module.c
@@ -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
};
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 8fa5376de1c9..8b27827c533d 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -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);
}
}
--
2.31.1
- [PATCH 02/29] plugins: register qemu_plugin_opts using opts_init(), (continued)
- [PATCH 02/29] plugins: register qemu_plugin_opts using opts_init(), Gerd Hoffmann, 2021/08/31
- [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 <=
- [PATCH 14/29] tcg_funcs:Add tcg_exec_{realizefn, unrealizefn} to TCGModuleOps, Gerd Hoffmann, 2021/08/31
- [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