[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/5] pc: add cpu hotplug handler to PC_MACHINE
From: |
Gu Zheng |
Subject: |
[Qemu-devel] [PATCH 4/5] pc: add cpu hotplug handler to PC_MACHINE |
Date: |
Wed, 3 Sep 2014 17:06:16 +0800 |
Add cpu hotplug handler to PC_MACHINE, which will perform the acpi
cpu hotplug callback via hotplug_handler API.
Signed-off-by: Gu Zheng <address@hidden>
---
hw/i386/pc.c | 26 +++++++++++++++++++++++++-
qom/cpu.c | 1 -
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 8fa8d2f..c2956f9 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1607,11 +1607,34 @@ out:
error_propagate(errp, local_err);
}
+static void pc_cpu_plug(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ HotplugHandlerClass *hhc;
+ Error *local_err = NULL;
+ PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+
+ if (dev->hotplugged) {
+ if (!pcms->acpi_dev) {
+ error_setg(&local_err,
+ "cpu hotplug is not enabled: missing acpi device");
+ goto out;
+ }
+
+ hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
+ hhc->plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
+out:
+ error_propagate(errp, local_err);
+ }
+}
+
static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
pc_dimm_plug(hotplug_dev, dev, errp);
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
+ pc_cpu_plug(hotplug_dev, dev, errp);
}
}
@@ -1620,7 +1643,8 @@ static HotplugHandler *pc_get_hotpug_handler(MachineState
*machine,
{
PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(machine);
- if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
+ if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)
+ || object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
return HOTPLUG_HANDLER(machine);
}
diff --git a/qom/cpu.c b/qom/cpu.c
index b32dd0a..af8e83f 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -304,7 +304,6 @@ static void cpu_common_realizefn(DeviceState *dev, Error
**errp)
if (dev->hotplugged) {
cpu_synchronize_post_init(cpu);
notifier_list_notify(&cpu_added_notifiers, dev);
- cpu_resume(cpu);
}
}
--
1.7.7
[Qemu-devel] [PATCH 2/5] acpi:ich9: convert cpu hotplug handle to hotplug_handler API, Gu Zheng, 2014/09/03
[Qemu-devel] [PATCH 3/5] acpi:piix4: convert cpu hotplug handle to hotplug_handler API, Gu Zheng, 2014/09/03
[Qemu-devel] [PATCH 4/5] pc: add cpu hotplug handler to PC_MACHINE,
Gu Zheng <=
Re: [Qemu-devel] [PATCH 4/5] pc: add cpu hotplug handler to PC_MACHINE, Igor Mammedov, 2014/09/10
[Qemu-devel] [PATCH 5/5] cpu/hotplug: remove the left unused cpu hotplug notifier function, Gu Zheng, 2014/09/03
Re: [Qemu-devel] [PATCH 0/5] cpu/acpi: convert cpu hot plug to hotplug_handler API, Igor Mammedov, 2014/09/10