On Mon, 16 Mar 2015 16:58:16 +0800 Zhu Guihua <zhugh.f...@cn.fujitsu.com> wrote:
> From: Tang Chen <tangc...@cn.fujitsu.com> > > 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) \