aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--exec.c32
-rw-r--r--hw/vhost.c16
-rw-r--r--kvm-all.c16
-rw-r--r--memory.c5
-rw-r--r--memory.h3
-rw-r--r--xen-all.c16
6 files changed, 88 insertions, 0 deletions
diff --git a/exec.c b/exec.c
index 16973a675..6726afd34 100644
--- a/exec.c
+++ b/exec.c
@@ -3488,6 +3488,14 @@ static void io_mem_init(void)
"watch", UINT64_MAX);
}
+static void core_begin(MemoryListener *listener)
+{
+}
+
+static void core_commit(MemoryListener *listener)
+{
+}
+
static void core_region_add(MemoryListener *listener,
MemoryRegionSection *section)
{
@@ -3500,6 +3508,11 @@ static void core_region_del(MemoryListener *listener,
cpu_register_physical_memory_log(section, false);
}
+static void core_region_nop(MemoryListener *listener,
+ MemoryRegionSection *section)
+{
+}
+
static void core_log_start(MemoryListener *listener,
MemoryRegionSection *section)
{
@@ -3537,6 +3550,14 @@ static void core_eventfd_del(MemoryListener *listener,
{
}
+static void io_begin(MemoryListener *listener)
+{
+}
+
+static void io_commit(MemoryListener *listener)
+{
+}
+
static void io_region_add(MemoryListener *listener,
MemoryRegionSection *section)
{
@@ -3551,6 +3572,11 @@ static void io_region_del(MemoryListener *listener,
isa_unassign_ioport(section->offset_within_address_space, section->size);
}
+static void io_region_nop(MemoryListener *listener,
+ MemoryRegionSection *section)
+{
+}
+
static void io_log_start(MemoryListener *listener,
MemoryRegionSection *section)
{
@@ -3587,8 +3613,11 @@ static void io_eventfd_del(MemoryListener *listener,
}
static MemoryListener core_memory_listener = {
+ .begin = core_begin,
+ .commit = core_commit,
.region_add = core_region_add,
.region_del = core_region_del,
+ .region_nop = core_region_nop,
.log_start = core_log_start,
.log_stop = core_log_stop,
.log_sync = core_log_sync,
@@ -3600,8 +3629,11 @@ static MemoryListener core_memory_listener = {
};
static MemoryListener io_memory_listener = {
+ .begin = io_begin,
+ .commit = io_commit,
.region_add = io_region_add,
.region_del = io_region_del,
+ .region_nop = io_region_nop,
.log_start = io_log_start,
.log_stop = io_log_stop,
.log_sync = io_log_sync,
diff --git a/hw/vhost.c b/hw/vhost.c
index 01f676a95..8d3ba5b60 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -436,6 +436,14 @@ static bool vhost_section(MemoryRegionSection *section)
&& memory_region_is_ram(section->mr);
}
+static void vhost_begin(MemoryListener *listener)
+{
+}
+
+static void vhost_commit(MemoryListener *listener)
+{
+}
+
static void vhost_region_add(MemoryListener *listener,
MemoryRegionSection *section)
{
@@ -476,6 +484,11 @@ static void vhost_region_del(MemoryListener *listener,
}
}
+static void vhost_region_nop(MemoryListener *listener,
+ MemoryRegionSection *section)
+{
+}
+
static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
struct vhost_virtqueue *vq,
unsigned idx, bool enable_log)
@@ -756,8 +769,11 @@ int vhost_dev_init(struct vhost_dev *hdev, int devfd, bool force)
hdev->features = features;
hdev->memory_listener = (MemoryListener) {
+ .begin = vhost_begin,
+ .commit = vhost_commit,
.region_add = vhost_region_add,
.region_del = vhost_region_del,
+ .region_nop = vhost_region_nop,
.log_start = vhost_log_start,
.log_stop = vhost_log_stop,
.log_sync = vhost_log_sync,
diff --git a/kvm-all.c b/kvm-all.c
index 15bc42fcd..c07823df9 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,
diff --git a/memory.c b/memory.c
index 35e148385..6565e2e69 100644
--- a/memory.c
+++ b/memory.c
@@ -676,6 +676,7 @@ static void address_space_update_topology_pass(AddressSpace *as,
/* In both (logging may have changed) */
if (adding) {
+ MEMORY_LISTENER_UPDATE_REGION(frnew, as, Forward, region_nop);
if (frold->dirty_log_mask && !frnew->dirty_log_mask) {
MEMORY_LISTENER_UPDATE_REGION(frnew, as, Reverse, log_stop);
} else if (frnew->dirty_log_mask && !frold->dirty_log_mask) {
@@ -722,6 +723,8 @@ static void memory_region_update_topology(MemoryRegion *mr)
return;
}
+ MEMORY_LISTENER_CALL_GLOBAL(begin, Forward);
+
if (address_space_memory.root) {
address_space_update_topology(&address_space_memory);
}
@@ -729,6 +732,8 @@ static void memory_region_update_topology(MemoryRegion *mr)
address_space_update_topology(&address_space_io);
}
+ MEMORY_LISTENER_CALL_GLOBAL(commit, Forward);
+
memory_region_update_pending = false;
}
diff --git a/memory.h b/memory.h
index bc9600b40..b7bccd196 100644
--- a/memory.h
+++ b/memory.h
@@ -180,8 +180,11 @@ typedef struct MemoryListener MemoryListener;
* Use with memory_listener_register() and memory_listener_unregister().
*/
struct MemoryListener {
+ void (*begin)(MemoryListener *listener);
+ void (*commit)(MemoryListener *listener);
void (*region_add)(MemoryListener *listener, MemoryRegionSection *section);
void (*region_del)(MemoryListener *listener, MemoryRegionSection *section);
+ void (*region_nop)(MemoryListener *listener, MemoryRegionSection *section);
void (*log_start)(MemoryListener *listener, MemoryRegionSection *section);
void (*log_stop)(MemoryListener *listener, MemoryRegionSection *section);
void (*log_sync)(MemoryListener *listener, MemoryRegionSection *section);
diff --git a/xen-all.c b/xen-all.c
index a58a397ca..6a1134266 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,