Signed-off-by: Gerd Hoffmann <kra...@redhat.com> --- include/tcg/tcg-module.h | 2 ++ accel/tcg/cputlb.c | 3 +++ accel/tcg/tcg-module.c | 7 +++++++ plugins/api.c | 4 ++-- 4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/include/tcg/tcg-module.h b/include/tcg/tcg-module.h index a14dcdb002db..159cbd3e7ce6 100644 --- a/include/tcg/tcg-module.h +++ b/include/tcg/tcg-module.h @@ -8,6 +8,8 @@ struct TCGModuleOps { 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); + bool (*tlb_plugin_lookup)(CPUState *cpu, target_ulong addr, int mmu_idx, + bool is_store, struct qemu_plugin_hwaddr *data); #endif }; extern struct TCGModuleOps tcg; diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index fa9c9064848c..6a7872dff488 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -2773,6 +2773,9 @@ 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; +#ifdef CONFIG_PLUGIN + tcg.tlb_plugin_lookup = tlb_plugin_lookup; +#endif } type_init(tcg_module_ops_tlb); diff --git a/accel/tcg/tcg-module.c b/accel/tcg/tcg-module.c index febf4e49981c..db3d3e9e9318 100644 --- a/accel/tcg/tcg-module.c +++ b/accel/tcg/tcg-module.c @@ -13,6 +13,12 @@ static void tlb_flush_page_stub(CPUState *cpu, target_ulong addr) static void tlb_reset_dirty_stub(CPUState *cpu, ram_addr_t start1, ram_addr_t length) { } + +static bool tlb_plugin_lookup_stub(CPUState *cpu, target_ulong addr, int mmu_idx, + bool is_store, struct qemu_plugin_hwaddr *data) +{ + return false; +} #endif struct TCGModuleOps tcg = { @@ -20,5 +26,6 @@ struct TCGModuleOps tcg = { .tlb_flush_page = tlb_flush_page_stub, #if defined(CONFIG_SOFTMMU) .tlb_reset_dirty = tlb_reset_dirty_stub, + .tlb_plugin_lookup = tlb_plugin_lookup_stub, #endif }; diff --git a/plugins/api.c b/plugins/api.c index 2d521e6ba825..12b4cb914320 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -280,8 +280,8 @@ struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info, unsigned int mmu_idx = info >> TRACE_MEM_MMU_SHIFT; hwaddr_info.is_store = info & TRACE_MEM_ST; - if (!tlb_plugin_lookup(cpu, vaddr, mmu_idx, - info & TRACE_MEM_ST, &hwaddr_info)) { + if (!tcg.tlb_plugin_lookup(cpu, vaddr, mmu_idx, + info & TRACE_MEM_ST, &hwaddr_info)) { error_report("invalid use of qemu_plugin_get_hwaddr"); return NULL; } -- 2.31.1