diff options
| author | Tang Chen <tangchen@cn.fujitsu.com> | 2015-04-27 16:47:18 +0800 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2015-04-27 21:07:39 +0200 |
| commit | f7d3e29db5a5900a1f0ed10f8313f7c3f28e5b59 (patch) | |
| tree | f76c897e3773dc31306813a74276bfd042cff798 /hw/acpi/memory_hotplug.c | |
| parent | 64fec58e8ab62490edd2638e4214d8c9f84518c9 (diff) | |
| download | focaccia-qemu-f7d3e29db5a5900a1f0ed10f8313f7c3f28e5b59.tar.gz focaccia-qemu-f7d3e29db5a5900a1f0ed10f8313f7c3f28e5b59.zip | |
acpi, mem-hotplug: add unplug cb for memory device
This patch adds unplug cb for memory device. It resets memory status "is_enabled" in acpi_memory_unplug_cb(), removes the corresponding memory region, unregisters vmstate, and unparents the object. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/acpi/memory_hotplug.c')
| -rw-r--r-- | hw/acpi/memory_hotplug.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c index 42fe66850c..07e281f4a8 100644 --- a/hw/acpi/memory_hotplug.c +++ b/hw/acpi/memory_hotplug.c @@ -237,6 +237,20 @@ void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq, acpi_update_sci(ar, irq); } +void acpi_memory_unplug_cb(MemHotplugState *mem_st, + DeviceState *dev, Error **errp) +{ + MemStatus *mdev; + + mdev = acpi_memory_slot_status(mem_st, dev, errp); + if (!mdev) { + return; + } + + mdev->is_enabled = false; + mdev->dimm = NULL; +} + static const VMStateDescription vmstate_memhp_sts = { .name = "memory hotplug device state", .version_id = 1, |