[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v3 08/18] spapr: handle pc-dimm unplug via hotplug h
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v3 08/18] spapr: handle pc-dimm unplug via hotplug handler chain |
Date: |
Mon, 14 May 2018 12:00:13 +0200 |
Let's handle it via hotplug_handler_unplug(). E.g. necessary to hotplug/
unplug memory devices (which a pc-dimm is) later.
Signed-off-by: David Hildenbrand <address@hidden>
---
hw/ppc/spapr.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 2f315f963b..286c38c842 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3291,7 +3291,8 @@ static sPAPRDIMMState
*spapr_recover_pending_dimm_state(sPAPRMachineState *ms,
/* Callback to be called during DRC release. */
void spapr_lmb_release(DeviceState *dev)
{
- sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_hotplug_handler(dev));
+ HotplugHandler *hotplug_ctrl = qdev_get_hotplug_handler(dev);
+ sPAPRMachineState *spapr = SPAPR_MACHINE(hotplug_ctrl);
sPAPRDIMMState *ds = spapr_pending_dimm_unplugs_find(spapr, PC_DIMM(dev));
/* This information will get lost if a migration occurs
@@ -3309,9 +3310,21 @@ 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.
+ * unplug handler chain. This can never fail.
*/
- pc_dimm_memory_unplug(dev, MACHINE(spapr));
+ hotplug_ctrl = qdev_get_hotplug_handler(dev);
+ hotplug_handler_unplug(hotplug_ctrl, dev, &error_abort);
+}
+
+static void spapr_memory_unplug(HotplugHandler *hotplug_dev, DeviceState *dev,
+ Error **errp)
+{
+ sPAPRMachineState *spapr = SPAPR_MACHINE(hotplug_dev);
+ sPAPRDIMMState *ds = spapr_pending_dimm_unplugs_find(spapr, PC_DIMM(dev));
+
+ g_assert(ds);
+ g_assert(!ds->nr_lmbs);
+ pc_dimm_memory_unplug(dev, MACHINE(hotplug_dev));
object_unparent(OBJECT(dev));
spapr_pending_dimm_unplugs_remove(spapr, ds);
}
@@ -3608,7 +3621,9 @@ static void spapr_machine_device_unplug(HotplugHandler
*hotplug_dev,
Error *local_err = NULL;
/* final stage hotplug handler */
- if (dev->parent_bus && dev->parent_bus->hotplug_handler) {
+ if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
+ spapr_memory_unplug(hotplug_dev, dev, &local_err);
+ } else if (dev->parent_bus && dev->parent_bus->hotplug_handler) {
hotplug_handler_unplug(dev->parent_bus->hotplug_handler, dev,
&local_err);
}
--
2.14.3
- Re: [qemu-s390x] [Qemu-ppc] [PATCH v3 03/18] qdev: let machine hotplug handler to override bus hotplug handler, (continued)
- [qemu-s390x] [PATCH v3 06/18] spapr: prepare for multi stage hotplug handlers, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 04/18] pc: prepare for multi stage hotplug handlers, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 09/18] spapr: handle cpu core unplug via hotplug handler chain, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 08/18] spapr: handle pc-dimm unplug via hotplug handler chain,
David Hildenbrand <=
- [qemu-s390x] [PATCH v3 11/18] pc-dimm: implement new memory device functions, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 07/18] spapr: route all memory devices through the machine hotplug handler, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 10/18] memory-device: new functions to handle plug/unplug, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 14/18] memory-device: factor out plug into hotplug handler, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 13/18] memory-device: factor out unplug into hotplug handler, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 15/18] s390x/sclp: make sure ram_size and maxram_size stay in sync, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 17/18] s390x: initialize memory region for memory devices, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 12/18] memory-device: factor out pre-plug into hotplug handler, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 18/18] s390x: support memory devices, David Hildenbrand, 2018/05/14