From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:39722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxEgJ-0002zK-QY for qemu-devel@nongnu.org; Tue, 14 Feb 2012 04:28:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RxEg9-0003UF-E6 for qemu-devel@nongnu.org; Tue, 14 Feb 2012 04:28:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxEg9-0003Tq-66 for qemu-devel@nongnu.org; Tue, 14 Feb 2012 04:28:05 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1E9S4XF014682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 14 Feb 2012 04:28:04 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q1E9S3ds012955 for ; Tue, 14 Feb 2012 04:28:03 -0500 From: Avi Kivity Date: Tue, 14 Feb 2012 11:27:33 +0200 Message-Id: <1329211670-11548-4-git-send-email-avi@redhat.com> In-Reply-To: <1329211670-11548-1-git-send-email-avi@redhat.com> References: <1329211670-11548-1-git-send-email-avi@redhat.com> Subject: [Qemu-devel] [PATCH 03/20] memory: split memory listener for the two address spaces List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The memory and I/O address spaces do different things, so split them into two memory listeners. Signed-off-by: Avi Kivity --- exec.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 66 insertions(+), 14 deletions(-) diff --git a/exec.c b/exec.c index aa54eb1..16973a6 100644 --- a/exec.c +++ b/exec.c @@ -3491,24 +3491,13 @@ static void io_mem_init(void) static void core_region_add(MemoryListener *listener, MemoryRegionSection *section) { - if (section->address_space == get_system_memory()) { - cpu_register_physical_memory_log(section, section->readonly); - } else { - iorange_init(§ion->mr->iorange, &memory_region_iorange_ops, - section->offset_within_address_space, section->size); - ioport_register(§ion->mr->iorange); - } + cpu_register_physical_memory_log(section, section->readonly); } static void core_region_del(MemoryListener *listener, MemoryRegionSection *section) { - if (section->address_space == get_system_memory()) { - cpu_register_physical_memory_log(section, false); - } else { - isa_unassign_ioport(section->offset_within_address_space, - section->size); - } + cpu_register_physical_memory_log(section, false); } static void core_log_start(MemoryListener *listener, @@ -3548,6 +3537,55 @@ static void core_eventfd_del(MemoryListener *listener, { } +static void io_region_add(MemoryListener *listener, + MemoryRegionSection *section) +{ + iorange_init(§ion->mr->iorange, &memory_region_iorange_ops, + section->offset_within_address_space, section->size); + ioport_register(§ion->mr->iorange); +} + +static void io_region_del(MemoryListener *listener, + MemoryRegionSection *section) +{ + isa_unassign_ioport(section->offset_within_address_space, section->size); +} + +static void io_log_start(MemoryListener *listener, + MemoryRegionSection *section) +{ +} + +static void io_log_stop(MemoryListener *listener, + MemoryRegionSection *section) +{ +} + +static void io_log_sync(MemoryListener *listener, + MemoryRegionSection *section) +{ +} + +static void io_log_global_start(MemoryListener *listener) +{ +} + +static void io_log_global_stop(MemoryListener *listener) +{ +} + +static void io_eventfd_add(MemoryListener *listener, + MemoryRegionSection *section, + bool match_data, uint64_t data, int fd) +{ +} + +static void io_eventfd_del(MemoryListener *listener, + MemoryRegionSection *section, + bool match_data, uint64_t data, int fd) +{ +} + static MemoryListener core_memory_listener = { .region_add = core_region_add, .region_del = core_region_del, @@ -3561,6 +3599,19 @@ static void core_eventfd_del(MemoryListener *listener, .priority = 0, }; +static MemoryListener io_memory_listener = { + .region_add = io_region_add, + .region_del = io_region_del, + .log_start = io_log_start, + .log_stop = io_log_stop, + .log_sync = io_log_sync, + .log_global_start = io_log_global_start, + .log_global_stop = io_log_global_stop, + .eventfd_add = io_eventfd_add, + .eventfd_del = io_eventfd_del, + .priority = 0, +}; + static void memory_map_init(void) { system_memory = g_malloc(sizeof(*system_memory)); @@ -3571,7 +3622,8 @@ static void memory_map_init(void) memory_region_init(system_io, "io", 65536); set_system_io_map(system_io); - memory_listener_register(&core_memory_listener, NULL); + memory_listener_register(&core_memory_listener, system_memory); + memory_listener_register(&io_memory_listener, system_io); } MemoryRegion *get_system_memory(void) -- 1.7.9