mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
pc-dimm: pass in the machine and to the MemoryHotplugState
We use the machine internally either way, so let's just pass it in then. Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20180423165126.15441-5-david@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
acc7fa17e6
commit
bd6c3e4a49
4 changed files with 11 additions and 11 deletions
|
@ -36,11 +36,11 @@ typedef struct pc_dimms_capacity {
|
|||
Error **errp;
|
||||
} pc_dimms_capacity;
|
||||
|
||||
void pc_dimm_memory_plug(DeviceState *dev, MemoryHotplugState *hpms,
|
||||
void pc_dimm_memory_plug(DeviceState *dev, MachineState *machine,
|
||||
uint64_t align, Error **errp)
|
||||
{
|
||||
int slot;
|
||||
MachineState *machine = MACHINE(qdev_get_machine());
|
||||
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);
|
||||
|
@ -122,14 +122,14 @@ out:
|
|||
error_propagate(errp, local_err);
|
||||
}
|
||||
|
||||
void pc_dimm_memory_unplug(DeviceState *dev, MemoryHotplugState *hpms)
|
||||
void pc_dimm_memory_unplug(DeviceState *dev, MachineState *machine)
|
||||
{
|
||||
PCDIMMDevice *dimm = PC_DIMM(dev);
|
||||
PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
|
||||
MemoryRegion *vmstate_mr = ddc->get_vmstate_memory_region(dimm);
|
||||
MemoryRegion *mr = ddc->get_memory_region(dimm, &error_abort);
|
||||
|
||||
memory_region_del_subregion(&hpms->mr, mr);
|
||||
memory_region_del_subregion(&machine->device_memory->mr, mr);
|
||||
vmstate_unregister_ram(vmstate_mr, dev);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue