From patchwork Wed Oct 3 16:03:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RFC,v1,16/22] memory: move tcg flush into a tcg memory listener Date: Wed, 03 Oct 2012 06:03:59 -0000 From: Avi Kivity X-Patchwork-Id: 188860 Message-Id: <1349280245-16341-17-git-send-email-avi@redhat.com> To: qemu-devel@nongnu.org, Anthony Liguori , liu ping fan , "Michael S. Tsirkin" , Paolo Bonzini , Blue Swirl We plan to make the core listener listen to all address spaces; this will cause many more flushes than necessary. Prepare for that by moving the flush into a tcg-specific listener. Later we can avoid registering the listener if tcg is disabled. Signed-off-by: Avi Kivity --- exec.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index e5f26fb..3c46298 100644 --- a/exec.c +++ b/exec.c @@ -3174,7 +3174,7 @@ static void core_begin(MemoryListener *listener) phys_section_watch = dummy_section(&io_mem_watch); } -static void core_commit(MemoryListener *listener) +static void tcg_commit(MemoryListener *listener) { CPUArchState *env; @@ -3229,7 +3229,6 @@ static void io_region_del(MemoryListener *listener, static MemoryListener core_memory_listener = { MEMORY_LISTENER_DEFAULT_OPS, .begin = core_begin, - .commit = core_commit, .region_add = core_region_add, .region_nop = core_region_nop, .log_global_start = core_log_global_start, @@ -3244,6 +3243,11 @@ static void io_region_del(MemoryListener *listener, .priority = 0, }; +static MemoryListener tcg_memory_listener = { + MEMORY_LISTENER_DEFAULT_OPS, + .commit = tcg_commit, +}; + static void memory_map_init(void) { system_memory = g_malloc(sizeof(*system_memory)); @@ -3258,6 +3262,7 @@ static void memory_map_init(void) memory_listener_register(&core_memory_listener, system_memory); memory_listener_register(&io_memory_listener, system_io); + memory_listener_register(&tcg_memory_listener, system_memory); } MemoryRegion *get_system_memory(void)