aboutsummaryrefslogtreecommitdiff
path: root/hw/mem/pc-dimm.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/pc-dimm.c
parent1b6d6af21bd614d61b55a28177299a5c93b95cd9 (diff)
downloadqemu-18d11dc910ca2a292b3f12c6a4a7c927b0f226f4.zip
qemu-18d11dc910ca2a292b3f12c6a4a7c927b0f226f4.tar.gz
qemu-18d11dc910ca2a292b3f12c6a4a7c927b0f226f4.tar.bz2
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/pc-dimm.c')
-rw-r--r--hw/mem/pc-dimm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 8aa2d36..0119c68 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -36,7 +36,6 @@ void pc_dimm_memory_plug(DeviceState *dev, MachineState *machine,
uint64_t align, Error **errp)
{
int slot;
- MemoryHotplugState *hpms = machine->device_memory;
PCDIMMDevice *dimm = PC_DIMM(dev);
PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
MemoryRegion *vmstate_mr = ddc->get_vmstate_memory_region(dimm);
@@ -83,7 +82,7 @@ void pc_dimm_memory_plug(DeviceState *dev, MachineState *machine,
}
trace_mhp_pc_dimm_assigned_slot(slot);
- memory_region_add_subregion(&hpms->mr, addr - hpms->base, mr);
+ memory_device_plug_region(machine, mr, addr);
vmstate_register_ram(vmstate_mr, dev);
out:
@@ -97,7 +96,7 @@ void pc_dimm_memory_unplug(DeviceState *dev, MachineState *machine)
MemoryRegion *vmstate_mr = ddc->get_vmstate_memory_region(dimm);
MemoryRegion *mr = ddc->get_memory_region(dimm, &error_abort);
- memory_region_del_subregion(&machine->device_memory->mr, mr);
+ memory_device_unplug_region(machine, mr);
vmstate_unregister_ram(vmstate_mr, dev);
}