aboutsummaryrefslogtreecommitdiff
path: root/hw/mem/memory-device.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2018-10-05 11:20:23 +0200
committerEduardo Habkost <ehabkost@redhat.com>2018-10-24 06:44:59 -0300
commit8288590d230c31e891965c30fa579ba3ac0f4c80 (patch)
tree831b06bc961302d7fa45779a86429049b6aea0bb /hw/mem/memory-device.c
parent55d67a04923488cb27f470b37896dde7a8dc0366 (diff)
memory-device: complete factoring out unplug handling
With the new memory device functions in place, we can factor out unplugging of memory devices completely. Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20181005092024.14344-16-david@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.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c
index 6569896b7e..30585d6148 100644
--- a/hw/mem/memory-device.c
+++ b/hw/mem/memory-device.c
@@ -290,9 +290,16 @@ void memory_device_plug(MemoryDeviceState *md, MachineState *ms)
addr - ms->device_memory->base, mr);
}
-void memory_device_unplug_region(MachineState *ms, MemoryRegion *mr)
+void memory_device_unplug(MemoryDeviceState *md, MachineState *ms)
{
- /* we expect a previous call to memory_device_get_free_addr() */
+ const MemoryDeviceClass *mdc = MEMORY_DEVICE_GET_CLASS(md);
+ MemoryRegion *mr;
+
+ /*
+ * We expect that a previous call to memory_device_pre_plug() succeeded, so
+ * it can't fail at this point.
+ */
+ mr = mdc->get_memory_region(md, &error_abort);
g_assert(ms->device_memory);
memory_region_del_subregion(&ms->device_memory->mr, mr);