From 72e22d2fe17b85e56b4f0c437c61c6e2de97b308 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 8 Feb 2012 15:05:50 +0200 Subject: memory: switch memory listeners to a QTAILQ This allows reverse iteration, which in turns allows consistent ordering among multiple listeners: l1->add l2->add l2->del l1->del Signed-off-by: Avi Kivity Reviewed-by: Richard Henderson --- xen-all.c | 1 + 1 file changed, 1 insertion(+) (limited to 'xen-all.c') diff --git a/xen-all.c b/xen-all.c index fd3916857c..8cb84efa55 100644 --- a/xen-all.c +++ b/xen-all.c @@ -495,6 +495,7 @@ static MemoryListener xen_memory_listener = { .log_sync = xen_log_sync, .log_global_start = xen_log_global_start, .log_global_stop = xen_log_global_stop, + .priority = 10, }; /* VCPU Operations, MMIO, IO ring ... */ -- cgit v1.2.1 From 80a1ea3748203b840d8bad488ada4d6f5bb66c9d Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 8 Feb 2012 16:39:06 +0200 Subject: memory: move ioeventfd ops to MemoryListener This way the accelerator (kvm) can handle them directly. Signed-off-by: Avi Kivity Reviewed-by: Richard Henderson --- xen-all.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'xen-all.c') diff --git a/xen-all.c b/xen-all.c index 8cb84efa55..e005b63c7e 100644 --- a/xen-all.c +++ b/xen-all.c @@ -487,6 +487,18 @@ static void xen_log_global_stop(MemoryListener *listener) { } +static void xen_eventfd_add(MemoryListener *listener, + MemoryRegionSection *section, + bool match_data, uint64_t data, int fd) +{ +} + +static void xen_eventfd_del(MemoryListener *listener, + MemoryRegionSection *section, + bool match_data, uint64_t data, int fd) +{ +} + static MemoryListener xen_memory_listener = { .region_add = xen_region_add, .region_del = xen_region_del, @@ -495,6 +507,8 @@ static MemoryListener xen_memory_listener = { .log_sync = xen_log_sync, .log_global_start = xen_log_global_start, .log_global_stop = xen_log_global_stop, + .eventfd_add = xen_eventfd_add, + .eventfd_del = xen_eventfd_del, .priority = 10, }; -- cgit v1.2.1 From 7376e5827a898d8ddf10f929047cc84bf65d9f52 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 8 Feb 2012 21:05:17 +0200 Subject: memory: allow MemoryListeners to observe a specific address space Ignore any regions not belonging to a specified address space. Signed-off-by: Avi Kivity --- xen-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xen-all.c') diff --git a/xen-all.c b/xen-all.c index e005b63c7e..dd52f02573 100644 --- a/xen-all.c +++ b/xen-all.c @@ -989,7 +989,7 @@ int xen_hvm_init(void) state->memory_listener = xen_memory_listener; QLIST_INIT(&state->physmap); - memory_listener_register(&state->memory_listener); + memory_listener_register(&state->memory_listener, NULL); state->log_for_dirtybit = NULL; /* Initialize backend core & drivers */ -- cgit v1.2.1 From 947f562c989d034c6a82920e11f4641f1681583d Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 8 Feb 2012 21:10:42 +0200 Subject: xen: ignore I/O memory regions Signed-off-by: Avi Kivity --- xen-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xen-all.c') diff --git a/xen-all.c b/xen-all.c index dd52f02573..a58a397ca4 100644 --- a/xen-all.c +++ b/xen-all.c @@ -989,7 +989,7 @@ int xen_hvm_init(void) state->memory_listener = xen_memory_listener; QLIST_INIT(&state->physmap); - memory_listener_register(&state->memory_listener, NULL); + memory_listener_register(&state->memory_listener, get_system_memory()); state->log_for_dirtybit = NULL; /* Initialize backend core & drivers */ -- cgit v1.2.1 From 50c1e1491e1981ecba14a477897681d8d0602500 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 8 Feb 2012 21:36:02 +0200 Subject: memory: support stateless memory listeners Current memory listeners are incremental; that is, they are expected to maintain their own state, and receive callbacks for changes to that state. This patch adds support for stateless listeners; these work by receiving a ->begin() callback (which tells them that new state is coming), a sequence of ->region_add() and ->region_nop() callbacks, and then a ->commit() callback which signifies the end of the new state. They should ignore ->region_del() callbacks. Signed-off-by: Avi Kivity --- xen-all.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'xen-all.c') diff --git a/xen-all.c b/xen-all.c index a58a397ca4..6a11342665 100644 --- a/xen-all.c +++ b/xen-all.c @@ -394,6 +394,14 @@ static void xen_set_memory(struct MemoryListener *listener, } } +static void xen_begin(MemoryListener *listener) +{ +} + +static void xen_commit(MemoryListener *listener) +{ +} + static void xen_region_add(MemoryListener *listener, MemoryRegionSection *section) { @@ -406,6 +414,11 @@ static void xen_region_del(MemoryListener *listener, xen_set_memory(listener, section, false); } +static void xen_region_nop(MemoryListener *listener, + MemoryRegionSection *section) +{ +} + static void xen_sync_dirty_bitmap(XenIOState *state, target_phys_addr_t start_addr, ram_addr_t size) @@ -500,8 +513,11 @@ static void xen_eventfd_del(MemoryListener *listener, } static MemoryListener xen_memory_listener = { + .begin = xen_begin, + .commit = xen_commit, .region_add = xen_region_add, .region_del = xen_region_del, + .region_nop = xen_region_nop, .log_start = xen_log_start, .log_stop = xen_log_stop, .log_sync = xen_log_sync, -- cgit v1.2.1