From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGp0p-0001Ui-1n for qemu-devel@nongnu.org; Thu, 29 Jan 2015 08:20:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGp0l-0002sF-9K for qemu-devel@nongnu.org; Thu, 29 Jan 2015 08:19:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51061) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGp0k-0002s8-Ti for qemu-devel@nongnu.org; Thu, 29 Jan 2015 08:19:55 -0500 Date: Thu, 29 Jan 2015 14:19:44 +0100 From: Igor Mammedov Message-ID: <20150129141944.533cceaf@nial.brq.redhat.com> In-Reply-To: <1420679180-14883-9-git-send-email-tangchen@cn.fujitsu.com> References: <1420679180-14883-1-git-send-email-tangchen@cn.fujitsu.com> <1420679180-14883-9-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 08/13] acpi, mem-hotplug: Add unplug cb for memory device. 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:15 +0800 Tang Chen wrote: > Reset all memory status, and unparent the memory device. > --- > hw/acpi/memory_hotplug.c | 16 ++++++++++++++++ > include/hw/acpi/memory_hotplug.h | 2 ++ > 2 files changed, 18 insertions(+) > > diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c > index 3d8e398..2b0c8ca 100644 > --- a/hw/acpi/memory_hotplug.c > +++ b/hw/acpi/memory_hotplug.c > @@ -227,6 +227,22 @@ void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq, > acpi_memory_hotplug_sci(ar, irq); > } > > +void acpi_memory_unplug_cb(ACPIREGS *ar, qemu_irq irq, > + MemHotplugState *mem_st, > + DeviceState *dev, Error **errp) > +{ > + MemStatus *mdev; > + > + mdev = acpi_memory_get_slot_status_descriptor(mem_st, dev, errp); > + if (!mdev) > + return; > + > + mdev->is_removing = false; should be done in acpi_memory_hotplug_write() in the same manner as it's done for is_inserting field > + mdev->is_enabled = false; > + object_unparent(OBJECT(mdev->dimm)); it seem wrong, does acpi_memory_plug_cb() do parenting? Unparenting probably should be done as the last step by PC_MACHINE when it's cleaned up all connections to dimm. > + mdev->dimm = NULL; > +} > + > static const VMStateDescription vmstate_memhp_sts = { > .name = "memory hotplug device state", > .version_id = 1, > diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h > index c437a85..6b8d9f7 100644 > --- a/include/hw/acpi/memory_hotplug.h > +++ b/include/hw/acpi/memory_hotplug.h > @@ -32,6 +32,8 @@ void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st, > void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq, > MemHotplugState *mem_st, > DeviceState *dev, Error **errp); > +void acpi_memory_unplug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st, > + DeviceState *dev, Error **errp); > > extern const VMStateDescription vmstate_memory_hotplug; > #define VMSTATE_MEMORY_HOTPLUG(memhp, state) \