[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [qemu-s390x] [PATCH v1 6/8] spapr: handle pc-dimm unplug via hotplug
From: |
David Gibson |
Subject: |
Re: [qemu-s390x] [PATCH v1 6/8] spapr: handle pc-dimm unplug via hotplug handler chain |
Date: |
Fri, 8 Jun 2018 13:30:32 +1000 |
User-agent: |
Mutt/1.9.5 (2018-04-13) |
On Thu, Jun 07, 2018 at 06:52:16PM +0200, David Hildenbrand wrote:
> 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>
Acked-by: David Gibson <address@hidden>
> ---
> hw/ppc/spapr.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index bcb72d9fa7..0a8a3455d6 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -3298,7 +3298,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
> @@ -3316,9 +3317,17 @@ 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_handler_unplug(hotplug_ctrl, dev, &error_abort);
> +}
> +
> +static void spapr_memory_unplug(HotplugHandler *hotplug_dev, DeviceState
> *dev)
> +{
> + sPAPRMachineState *spapr = SPAPR_MACHINE(hotplug_dev);
> + sPAPRDIMMState *ds = spapr_pending_dimm_unplugs_find(spapr,
> PC_DIMM(dev));
> +
> + pc_dimm_memory_unplug(dev, MACHINE(hotplug_dev));
> object_unparent(OBJECT(dev));
> spapr_pending_dimm_unplugs_remove(spapr, ds);
> }
> @@ -3589,6 +3598,9 @@ static void spapr_machine_device_plug(HotplugHandler
> *hotplug_dev,
> static void spapr_machine_device_unplug(HotplugHandler *hotplug_dev,
> DeviceState *dev, Error **errp)
> {
> + if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
> + spapr_memory_unplug(hotplug_dev, dev);
> + }
> }
>
> static void spapr_machine_device_unplug_request(HotplugHandler *hotplug_dev,
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
- Re: [qemu-s390x] [PATCH v1 3/8] spapr: move all DIMM checks into spapr_memory_plug, (continued)
[qemu-s390x] [PATCH v1 5/8] spapr: introduce machine unplug handler, David Hildenbrand, 2018/06/07
[qemu-s390x] [PATCH v1 4/8] spapr: local error handling in hotplug handler functions, David Hildenbrand, 2018/06/07
[qemu-s390x] [PATCH v1 6/8] spapr: handle pc-dimm unplug via hotplug handler chain, David Hildenbrand, 2018/06/07
Re: [qemu-s390x] [PATCH v1 6/8] spapr: handle pc-dimm unplug via hotplug handler chain, Greg Kurz, 2018/06/08
[qemu-s390x] [PATCH v1 7/8] spapr: handle cpu core unplug via hotplug handler chain, David Hildenbrand, 2018/06/07
[qemu-s390x] [PATCH v1 8/8] s390x: local error handling in hotplug handler functions, David Hildenbrand, 2018/06/07