[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 42/42] DO NOT APPLY: simulate CPU unplug when executin
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [RFC 42/42] DO NOT APPLY: simulate CPU unplug when executin cpu-add on a present CPU |
Date: |
Mon, 2 May 2016 14:33:51 +0200 |
Signed-off-by: Igor Mammedov <address@hidden>
---
hw/i386/pc.c | 8 ++++++++
include/qom/cpu.h | 2 +-
qom/cpu.c | 6 +++---
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 2d29b5e..7072fb5 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1063,6 +1063,9 @@ out:
return cpu;
}
+static void pc_machine_device_unplug_request_cb(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error
**errp);
+
void pc_hot_add_cpu(const int64_t id, Error **errp)
{
X86CPU *cpu;
@@ -1076,6 +1079,11 @@ void pc_hot_add_cpu(const int64_t id, Error **errp)
}
if (cpu_exists(apic_id)) {
+ DeviceState *dev = DEVICE(cpu_exists(apic_id));
+ pc_machine_device_unplug_request_cb(
+ qdev_get_hotplug_handler(dev),
+ dev,
+ &local_err);
error_setg(errp, "Unable to add CPU: %" PRIi64
", it already exists", id);
return;
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index b7a10f7..da55899 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -629,7 +629,7 @@ CPUState *qemu_get_cpu(int index);
*
* Returns: %true - CPU is found, %false - CPU isn't found.
*/
-bool cpu_exists(int64_t id);
+CPUState *cpu_exists(int64_t id);
/**
* cpu_throttle_set:
diff --git a/qom/cpu.c b/qom/cpu.c
index c9007d3..f3210a2 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -29,7 +29,7 @@
#include "qemu/error-report.h"
#include "sysemu/sysemu.h"
-bool cpu_exists(int64_t id)
+CPUState *cpu_exists(int64_t id)
{
CPUState *cpu;
@@ -37,10 +37,10 @@ bool cpu_exists(int64_t id)
CPUClass *cc = CPU_GET_CLASS(cpu);
if (cc->get_arch_id(cpu) == id) {
- return true;
+ return cpu;
}
}
- return false;
+ return NULL;
}
CPUState *cpu_generic_init(const char *typename, const char *cpu_model)
--
1.8.3.1
- [Qemu-devel] [RFC 32/42] pc: set X86CPU.node property if QEMU starts with numa enabled, (continued)
- [Qemu-devel] [RFC 32/42] pc: set X86CPU.node property if QEMU starts with numa enabled, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 29/42] tests: acpi: update expected files with new CPU AML description, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 14/42] tests: acpi: check legacy CPU hotplug AML is present for 2.6 machine type, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 23/42] tests: pc-cpu-test: turn on cpu-hotplug explicily, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 30/42] qdev: hotplug: Introduce HotplugHandler.pre_plug() callback, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 34/42] acpi: cpuhp: add command and data registers, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 35/42] acpi: cpuhp: provide cpu._PXM method if running in numa mode, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 40/42] tests: acpi: extend CPU hotplug test with NUMA support, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 38/42] tests: acpi: add CPU hotplug testcase, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 42/42] DO NOT APPLY: simulate CPU unplug when executin cpu-add on a present CPU,
Igor Mammedov <=
- [Qemu-devel] [RFC 36/42] acpi: cpuhp: add cpu._OST handling, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 37/42] tests: acpi: report names of expected files in verbose mode, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 33/42] target-i386: add X86CPU.node property, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 41/42] tests: acpi: cpuhp: add expected SRAT tables and update DSDT with _PXM support, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 39/42] tests: acpi: add expected tables for CPU hotplug case, Igor Mammedov, 2016/05/02