[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/12] pc: add cpu hot unplug callback support
From: |
Gu Zheng |
Subject: |
[Qemu-devel] [PATCH 10/12] pc: add cpu hot unplug callback support |
Date: |
Fri, 12 Dec 2014 16:43:16 +0800 |
Signed-off-by: Gu Zheng <address@hidden>
Signed-off-by: Zhu Guihua <address@hidden>
---
hw/i386/pc.c | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index ace7dc2..a8e34db 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1721,6 +1721,24 @@ out:
error_propagate(errp, local_err);
}
+static void pc_cpu_unplug(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ HotplugHandlerClass *hhc;
+ Error *local_err = NULL;
+ PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+
+ hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
+ hhc->unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+
+ /* decrement the number of CPUs */
+ rtc_set_memory(pcms->rtc, 0x5f, rtc_get_memory(pcms->rtc, 0x5f) - 1);
+}
+
static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
@@ -1745,8 +1763,12 @@ static void
pc_machine_device_unplug_request_cb(HotplugHandler *hotplug_dev,
static void pc_machine_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)));
+ if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
+ pc_cpu_unplug(hotplug_dev, dev, errp);
+ } else {
+ error_setg(errp, "acpi: device unplug for not supported device"
+ " type: %s", object_get_typename(OBJECT(dev)));
+ }
}
static HotplugHandler *pc_get_hotpug_handler(MachineState *machine,
--
1.7.7
- [Qemu-devel] [PATCH 00/12] cpu: add i386 cpu hot remove support, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 01/12] x86: add x86_cpu_unrealizefn() for cpu apic remove, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 03/12] acpi/cpu: add cpu hot unplug request callback function, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 02/12] i386/cpu: add instance finalize callback, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 05/12] acpi/ich9: add cpu hot unplug request callback support, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 06/12] pc: add cpu hot unplug request callback support, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 04/12] acpi/piix4: add cpu hot unplug request callback support, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 07/12] acpi/cpu: add cpu hot unplug callback function, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 08/12] acpi/piix4: add cpu hot unplug callback support, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 09/12] acpi/ich9: add cpu hot unplug support, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 10/12] pc: add cpu hot unplug callback support,
Gu Zheng <=
- [Qemu-devel] [PATCH 11/12] cpu hotplug: implement function cpu_status_write() for vcpu ejection, Gu Zheng, 2014/12/12
- [Qemu-devel] [PATCH 12/12] cpus: reclaim allocated vCPU objects, Gu Zheng, 2014/12/12
- Re: [Qemu-devel] [PATCH 00/12] cpu: add i386 cpu hot remove support, Gu Zheng, 2014/12/19