From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGoWx-0004uB-Dd for qemu-devel@nongnu.org; Thu, 29 Jan 2015 07:49:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGoWt-0007hL-Cw for qemu-devel@nongnu.org; Thu, 29 Jan 2015 07:49:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGoWt-0007hB-3d for qemu-devel@nongnu.org; Thu, 29 Jan 2015 07:49:03 -0500 Date: Thu, 29 Jan 2015 13:48:53 +0100 From: Igor Mammedov Message-ID: <20150129134853.40f5ae21@nial.brq.redhat.com> In-Reply-To: <1420679180-14883-8-git-send-email-tangchen@cn.fujitsu.com> References: <1420679180-14883-1-git-send-email-tangchen@cn.fujitsu.com> <1420679180-14883-8-git-send-email-tangchen@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RESEND PATCH v1 07/13] pc-dimm: Add memory hot unplug request support for pc-dimm. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tang Chen Cc: zhugh.fnst@cn.fujitsu.com, mst@redhat.com, hutao@cn.fujitsu.com, qemu-devel@nongnu.org, isimatu.yasuaki@jp.fujitsu.com, guz.fnst@cn.fujitsu.com, pbonzini@redhat.com On Thu, 8 Jan 2015 09:06:14 +0800 Tang Chen wrote: > Implement memory unplug request cb for pc-dimm, and call it in > pc_machine_device_unplug_request_cb(). > --- > hw/i386/pc.c | 28 ++++++++++++++++++++++++++-- > 1 file changed, 26 insertions(+), 2 deletions(-) > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > index 0f3b1e0..f501f1f 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -1671,6 +1671,26 @@ out: > error_propagate(errp, local_err); > } > > +static void pc_dimm_unplug_request(HotplugHandler *hotplug_dev, > + DeviceState *dev, Error **errp) > +{ > + HotplugHandlerClass *hhc; > + Error *local_err = NULL; > + PCMachineState *pcms = PC_MACHINE(hotplug_dev); > + > + if (!pcms->acpi_dev) { > + error_setg(&local_err, > + "memory hotplug is not enabled: missing acpi device"); > + goto out; wrong indent > + } > + > + hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); > + hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err); > + > +out: > + error_propagate(errp, local_err); > +} > + > static void pc_cpu_plug(HotplugHandler *hotplug_dev, > DeviceState *dev, Error **errp) > { > @@ -1713,8 +1733,12 @@ static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev, > static void pc_machine_device_unplug_request_cb(HotplugHandler *hotplug_dev, > DeviceState *dev, Error **errp) > { > - error_setg(errp, "acpi: device unplug request for not supported device" > - " type: %s", object_get_typename(OBJECT(dev))); > + if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { > + pc_dimm_unplug_request(hotplug_dev, dev, errp); > + } else { > + error_setg(errp, "acpi: device unplug request for not supported device" > + " type: %s", object_get_typename(OBJECT(dev))); > + } > } > > static void pc_machine_device_unplug_cb(HotplugHandler *hotplug_dev,