summaryrefslogtreecommitdiff
path: root/hw/acpi/memory_hotplug.c
diff options
context:
space:
mode:
authorTang Chen <tangchen@cn.fujitsu.com>2015-04-27 16:47:17 +0800
committerMichael S. Tsirkin <mst@redhat.com>2015-04-27 21:07:39 +0200
commit64fec58e8ab62490edd2638e4214d8c9f84518c9 (patch)
treea48577cda520f091834296d18eaf6ffe0a5fb1ea /hw/acpi/memory_hotplug.c
parent4aae99b63333e71b2097b106bb15a6fde7f9b55b (diff)
downloadqemu-64fec58e8ab62490edd2638e4214d8c9f84518c9.tar.gz
qemu-64fec58e8ab62490edd2638e4214d8c9f84518c9.tar.bz2
qemu-64fec58e8ab62490edd2638e4214d8c9f84518c9.zip
acpi, mem-hotplug: add unplug request cb for memory device
This patch adds unplug request cb for memory device, and adds the is_removing boolean field to MemStatus. This field is used to indicate whether the memory device in slot has been requested to be ejected. This field is set to true in acpi_memory_unplug_request_cb(). 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.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index 6af93032d2..42fe66850c 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -75,6 +75,7 @@ static uint64_t acpi_memory_hotplug_read(void *opaque, hwaddr addr,
case 0x14: /* pack and return is_* fields */
val |= mdev->is_enabled ? 1 : 0;
val |= mdev->is_inserting ? 2 : 0;
+ val |= mdev->is_removing ? 4 : 0;
trace_mhp_acpi_read_flags(mem_st->selector, val);
break;
default:
@@ -218,6 +219,24 @@ void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st,
return;
}
+void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq,
+ MemHotplugState *mem_st,
+ DeviceState *dev, Error **errp)
+{
+ MemStatus *mdev;
+
+ mdev = acpi_memory_slot_status(mem_st, dev, errp);
+ if (!mdev) {
+ return;
+ }
+
+ mdev->is_removing = true;
+
+ /* Do ACPI magic */
+ ar->gpe.sts[0] |= ACPI_MEMORY_HOTPLUG_STATUS;
+ acpi_update_sci(ar, irq);
+}
+
static const VMStateDescription vmstate_memhp_sts = {
.name = "memory hotplug device state",
.version_id = 1,