From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXVjP-0003Cz-6U for qemu-devel@nongnu.org; Mon, 16 Mar 2015 10:11:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXVjL-00024w-69 for qemu-devel@nongnu.org; Mon, 16 Mar 2015 10:10:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXVjK-00024i-Sa for qemu-devel@nongnu.org; Mon, 16 Mar 2015 10:10:55 -0400 Date: Mon, 16 Mar 2015 15:10:40 +0100 From: Igor Mammedov Message-ID: <20150316151040.26e5cd2a@nial.brq.redhat.com> In-Reply-To: <25454ba4d411914abb12f764ddd82080e7916d70.1426494342.git.zhugh.fnst@cn.fujitsu.com> References: <25454ba4d411914abb12f764ddd82080e7916d70.1426494342.git.zhugh.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RESEND PATCH v4 4/6] acpi, mem-hotplug: Add unplug cb for memory device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhu Guihua Cc: mst@redhat.com, qemu-devel@nongnu.org, tangchen@cn.fujitsu.com, izumi.taku@jp.fujitsu.com, guz.fnst@cn.fujitsu.com, pbonzini@redhat.com On Mon, 16 Mar 2015 16:58:16 +0800 Zhu Guihua wrote: > From: Tang Chen > > This patch adds unplug cb for memory device. It resets some memory status > in acpi_memory_unplug_cb(). 'some' is quite vague. Pls, explain what it does in commit message. [...] > diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c > index f716e91..781ad33 100644 > --- a/hw/acpi/piix4.c > +++ b/hw/acpi/piix4.c > @@ -377,8 +377,14 @@ static void piix4_device_unplug_request_cb(HotplugHandler *hotplug_dev, > static void piix4_device_unplug_cb(HotplugHandler *hotplug_dev, > DeviceState *dev, Error **errp) > { > - error_setg(errp, "acpi: device unplug for not supported device" > - " type: %s", object_get_typename(OBJECT(dev))); > + PIIX4PMState *s = PIIX4_PM(hotplug_dev); > + > + if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { missing condition "pm->acpi_memory_hotplug.is_enabled &&"? > + acpi_memory_unplug_cb(&s->acpi_memory_hotplug, dev, errp); > + } else { > + error_setg(errp, "acpi: device unplug for not supported device" > + " type: %s", object_get_typename(OBJECT(dev))); > + } > } > > static void piix4_update_bus_hotplug(PCIBus *pci_bus, void *opaque) > diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h > index c437a85..15deae0 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(MemHotplugState *mem_st, > + DeviceState *dev, Error **errp); > > extern const VMStateDescription vmstate_memory_hotplug; > #define VMSTATE_MEMORY_HOTPLUG(memhp, state) \