[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 11/20] memory-device: complete factoring out unpl
From: |
David Hildenbrand |
Subject: |
[Qemu-devel] [PATCH v2 11/20] memory-device: complete factoring out unplug handling |
Date: |
Wed, 29 Aug 2018 17:36:15 +0200 |
With the new memory device functions in place, we can factor out
unplugging of memory devices completely.
Signed-off-by: David Hildenbrand <address@hidden>
---
hw/mem/memory-device.c | 8 ++++++--
hw/mem/pc-dimm.c | 3 +--
include/hw/mem/memory-device.h | 2 +-
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c
index c7a12ff2c4..5f62eb6a94 100644
--- a/hw/mem/memory-device.c
+++ b/hw/mem/memory-device.c
@@ -292,9 +292,13 @@ 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 a previous call to memory_device_pre_plug() */
+ mr = mdc->get_memory_region(md, &error_abort);
g_assert(ms->device_memory);
memory_region_del_subregion(&ms->device_memory->mr, mr);
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 9d3dcc8da9..634335f984 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -76,9 +76,8 @@ void pc_dimm_unplug(DeviceState *dev, MachineState *machine)
PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
MemoryRegion *vmstate_mr = ddc->get_vmstate_memory_region(dimm,
&error_abort);
- MemoryRegion *mr = ddc->get_memory_region(dimm, &error_abort);
- memory_device_unplug_region(machine, mr);
+ memory_device_unplug(MEMORY_DEVICE(dev), machine);
vmstate_unregister_ram(vmstate_mr, dev);
}
diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h
index 49cf2d498b..05cb9437b7 100644
--- a/include/hw/mem/memory-device.h
+++ b/include/hw/mem/memory-device.h
@@ -59,6 +59,6 @@ uint64_t get_plugged_memory_size(void);
void memory_device_pre_plug(MemoryDeviceState *md, MachineState *ms,
const uint64_t *legacy_align, Error **errp);
void memory_device_plug(MemoryDeviceState *md, MachineState *ms);
-void memory_device_unplug_region(MachineState *ms, MemoryRegion *mr);
+void memory_device_unplug(MemoryDeviceState *md, MachineState *ms);
#endif
--
2.17.1
- [Qemu-devel] [PATCH v2 01/20] memory-device: fix error message when hinted address is too small, (continued)
- [Qemu-devel] [PATCH v2 01/20] memory-device: fix error message when hinted address is too small, David Hildenbrand, 2018/08/29
- [Qemu-devel] [PATCH v2 03/20] memory-device: introduce separate config option, David Hildenbrand, 2018/08/29
- [Qemu-devel] [PATCH v2 04/20] memory-device: get_region_size()/get_plugged_size() might fail, David Hildenbrand, 2018/08/29
- [Qemu-devel] [PATCH v2 05/20] memory-device: convert get_region_size() to get_memory_region(), David Hildenbrand, 2018/08/29
- [Qemu-devel] [PATCH v2 06/20] memory-device: document MemoryDeviceClass, David Hildenbrand, 2018/08/29
- [Qemu-devel] [PATCH v2 07/20] memory-device: add device class function set_addr(), David Hildenbrand, 2018/08/29
- [Qemu-devel] [PATCH v2 08/20] pc-dimm: implement memory device class function set_addr(), David Hildenbrand, 2018/08/29
- [Qemu-devel] [PATCH v2 09/20] memory-device: complete factoring out pre_plug handling, David Hildenbrand, 2018/08/29
- [Qemu-devel] [PATCH v2 10/20] memory-device: complete factoring out plug handling, David Hildenbrand, 2018/08/29
- [Qemu-devel] [PATCH v2 11/20] memory-device: complete factoring out unplug handling,
David Hildenbrand <=
- [Qemu-devel] [PATCH v2 12/20] memory-device: trace when pre_assigning/assigning/unassigning addresses, David Hildenbrand, 2018/08/29
- [Qemu-devel] [PATCH v2 13/20] hw/acpi-build: only indicate nvdimm and pc-dimm, David Hildenbrand, 2018/08/29
- [Qemu-devel] [PATCH v2 14/20] memory-device: ids of virtio based devices are special, David Hildenbrand, 2018/08/29
- Re: [Qemu-devel] [PATCH v2 14/20] memory-device: ids of virtio based devices are special, Dr. David Alan Gilbert, 2018/08/31
- Re: [Qemu-devel] [PATCH v2 14/20] memory-device: ids of virtio based devices are special, Dr. David Alan Gilbert, 2018/08/31
- Re: [Qemu-devel] [PATCH v2 14/20] memory-device: ids of virtio based devices are special, David Hildenbrand, 2018/08/31
- Re: [Qemu-devel] [PATCH v2 14/20] memory-device: ids of virtio based devices are special, Dr. David Alan Gilbert, 2018/08/31
- Re: [Qemu-devel] [PATCH v2 14/20] memory-device: ids of virtio based devices are special, David Hildenbrand, 2018/08/31
- Re: [Qemu-devel] [PATCH v2 14/20] memory-device: ids of virtio based devices are special, Dr. David Alan Gilbert, 2018/08/31
- Re: [Qemu-devel] [PATCH v2 14/20] memory-device: ids of virtio based devices are special, Eric Blake, 2018/08/31