aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2018-04-23 18:51:19 +0200
committerEduardo Habkost <ehabkost@redhat.com>2018-05-07 10:00:02 -0300
commitbd6c3e4a4975ee1e5cadbc1826af9bd0ca0954c2 (patch)
tree4eb408b4c4f9303ec23b14b9aff2059581beb9dc /hw
parentacc7fa17e6fe96bd68ad9af04fde5091383ef25e (diff)
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>
Diffstat (limited to 'hw')
-rw-r--r--hw/i386/pc.c4
-rw-r--r--hw/mem/pc-dimm.c8
-rw-r--r--hw/ppc/spapr.c6
3 files changed, 9 insertions, 9 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index e337c6552d..e94e63dc6c 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1715,7 +1715,7 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
goto out;
}
- pc_dimm_memory_plug(dev, MACHINE(pcms)->device_memory, align, &local_err);
+ pc_dimm_memory_plug(dev, MACHINE(pcms), align, &local_err);
if (local_err) {
goto out;
}
@@ -1775,7 +1775,7 @@ static void pc_dimm_unplug(HotplugHandler *hotplug_dev,
goto out;
}
- pc_dimm_memory_unplug(dev, MACHINE(pcms)->device_memory);
+ pc_dimm_memory_unplug(dev, MACHINE(pcms));
object_unparent(OBJECT(dev));
out:
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index aeff369f6f..37b8be80a1 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -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);
}
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index d4917e89c6..4576ad63bc 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3153,7 +3153,7 @@ static void spapr_memory_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
align = memory_region_get_alignment(mr);
size = memory_region_size(mr);
- pc_dimm_memory_plug(dev, MACHINE(ms)->device_memory, align, &local_err);
+ pc_dimm_memory_plug(dev, MACHINE(ms), align, &local_err);
if (local_err) {
goto out;
}
@@ -3174,7 +3174,7 @@ static void spapr_memory_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
return;
out_unplug:
- pc_dimm_memory_unplug(dev, MACHINE(ms)->device_memory);
+ pc_dimm_memory_unplug(dev, MACHINE(ms));
out:
error_propagate(errp, local_err);
}
@@ -3311,7 +3311,7 @@ void spapr_lmb_release(DeviceState *dev)
* Now that all the LMBs have been removed by the guest, call the
* pc-dimm unplug handler to cleanup up the pc-dimm device.
*/
- pc_dimm_memory_unplug(dev, MACHINE(spapr)->device_memory);
+ pc_dimm_memory_unplug(dev, MACHINE(spapr));
object_unparent(OBJECT(dev));
spapr_pending_dimm_unplugs_remove(spapr, ds);
}