aboutsummaryrefslogtreecommitdiff
path: root/kvm-all.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-02-08 21:36:02 +0200
committerAvi Kivity <avi@redhat.com>2012-02-29 13:44:42 +0200
commit50c1e1491e1981ecba14a477897681d8d0602500 (patch)
treeb978d61c3b39d9ed2f811df18f13fad93097d372 /kvm-all.c
parent4855d41a61301a04e54c074f1139040e4cb4dd00 (diff)
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 <avi@redhat.com>
Diffstat (limited to 'kvm-all.c')
-rw-r--r--kvm-all.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/kvm-all.c b/kvm-all.c
index 15bc42fcdb..c07823df98 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -680,6 +680,14 @@ static void kvm_set_phys_mem(MemoryRegionSection *section, bool add)
}
}
+static void kvm_begin(MemoryListener *listener)
+{
+}
+
+static void kvm_commit(MemoryListener *listener)
+{
+}
+
static void kvm_region_add(MemoryListener *listener,
MemoryRegionSection *section)
{
@@ -692,6 +700,11 @@ static void kvm_region_del(MemoryListener *listener,
kvm_set_phys_mem(section, false);
}
+static void kvm_region_nop(MemoryListener *listener,
+ MemoryRegionSection *section)
+{
+}
+
static void kvm_log_sync(MemoryListener *listener,
MemoryRegionSection *section)
{
@@ -795,8 +808,11 @@ static void kvm_eventfd_del(MemoryListener *listener,
}
static MemoryListener kvm_memory_listener = {
+ .begin = kvm_begin,
+ .commit = kvm_commit,
.region_add = kvm_region_add,
.region_del = kvm_region_del,
+ .region_nop = kvm_region_nop,
.log_start = kvm_log_start,
.log_stop = kvm_log_stop,
.log_sync = kvm_log_sync,