aboutsummaryrefslogtreecommitdiff
path: root/hw/mem/memory-device.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2018-04-23 18:51:22 +0200
committerEduardo Habkost <ehabkost@redhat.com>2018-05-07 10:00:02 -0300
commit18d11dc910ca2a292b3f12c6a4a7c927b0f226f4 (patch)
tree99130bedeb745ca043dca307415ec92e7840291a /hw/mem/memory-device.c
parent1b6d6af21bd614d61b55a28177299a5c93b95cd9 (diff)
pc-dimm: move actual plug/unplug of a memory region to MemoryDevice
Registering the memory region for migration has do be done by the owner. There could be cases, where we don't want to migrate the memory. Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20180423165126.15441-8-david@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw/mem/memory-device.c')
-rw-r--r--hw/mem/memory-device.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c
index 8535ddcb14..3e04f3954e 100644
--- a/hw/mem/memory-device.c
+++ b/hw/mem/memory-device.c
@@ -243,6 +243,24 @@ uint64_t get_plugged_memory_size(void)
return size;
}
+void memory_device_plug_region(MachineState *ms, MemoryRegion *mr,
+ uint64_t addr)
+{
+ /* we expect a previous call to memory_device_get_free_addr() */
+ g_assert(ms->device_memory);
+
+ memory_region_add_subregion(&ms->device_memory->mr,
+ addr - ms->device_memory->base, mr);
+}
+
+void memory_device_unplug_region(MachineState *ms, MemoryRegion *mr)
+{
+ /* we expect a previous call to memory_device_get_free_addr() */
+ g_assert(ms->device_memory);
+
+ memory_region_del_subregion(&ms->device_memory->mr, mr);
+}
+
static const TypeInfo memory_device_info = {
.name = TYPE_MEMORY_DEVICE,
.parent = TYPE_INTERFACE,