[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC V2 05/10] i386: add cpu device_del support
From: |
Gu Zheng |
Subject: |
[Qemu-devel] [RFC V2 05/10] i386: add cpu device_del support |
Date: |
Thu, 28 Aug 2014 11:36:37 +0800 |
In order to add cpu(i386) device_del support, introduce the cpu hot
unplug hanlde(x86_cpu_unplug) which will trigger the unrealize routine,
and just register it to the cpu class unplug handle.
Signed-off-by: Chen Fan <address@hidden>
Signed-off-by: Gu Zheng <address@hidden>
---
target-i386/cpu.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 72a94a6..dc5153e 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2993,6 +2993,27 @@ static Property x86_cpu_properties[] = {
DEFINE_PROP_END_OF_LIST()
};
+static int x86_cpu_unplug(DeviceState *dev)
+{
+ CPUState *cpu = CPU(dev);
+ X86CPUClass *xcc;
+ Error *err = NULL;
+
+ if (cpu == first_cpu) {
+ error_report("Can not remove the first cpu!\n");
+ return -1;
+ }
+
+ xcc = X86_CPU_GET_CLASS(DEVICE(cpu));
+ xcc->parent_unrealize(DEVICE(cpu), &err);
+ if (err != NULL) {
+ error_report("%s", error_get_pretty(err));
+ error_free(err);
+ return -1;
+ }
+ return 0;
+}
+
static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
{
X86CPUClass *xcc = X86_CPU_CLASS(oc);
@@ -3005,6 +3026,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc,
void *data)
dc->unrealize = x86_cpu_unrealizefn;
dc->bus_type = TYPE_ICC_BUS;
dc->props = x86_cpu_properties;
+ dc->unplug = x86_cpu_unplug;
xcc->parent_reset = cc->reset;
cc->reset = x86_cpu_reset;
--
1.7.7
- [Qemu-devel] [RFC V2 00/10] cpu: add device_add foo-x86_64-cpu and i386 cpu hot remove support, Gu Zheng, 2014/08/27
- [Qemu-devel] [RFC V2 01/10] cpu: introduce CpuTopoInfo structure for argument simplification, Gu Zheng, 2014/08/27
- [Qemu-devel] [RFC V2 05/10] i386: add cpu device_del support,
Gu Zheng <=
- [Qemu-devel] [RFC V2 06/10] qom cpu: rename variable 'cpu_added_notifier' to 'cpu_hotplug_notifier', Gu Zheng, 2014/08/27
- [Qemu-devel] [RFC V2 04/10] x86: add x86_cpu_unrealizefn() for cpu apic remove, Gu Zheng, 2014/08/27
- [Qemu-devel] [RFC V2 07/10] qom cpu: add UNPLUG cpu notify support, Gu Zheng, 2014/08/28
- [Qemu-devel] [RFC V2 03/10] cpu: add device_add foo-x86_64-cpu support, Gu Zheng, 2014/08/28
- [Qemu-devel] [RFC V2 08/10] i386: implement pc interface cpu_common_unrealizefn() in qom/cpu.c, Gu Zheng, 2014/08/28
- [Qemu-devel] [RFC V2 09/10] cpu hotplug: implement function cpu_status_write() for vcpu ejection, Gu Zheng, 2014/08/28
- [Qemu-devel] [RFC V2 10/10] cpus: reclaim allocated vCPU objects, Gu Zheng, 2014/08/28
- [Qemu-devel] [RFC V2 02/10] qom/cpu: move register_vmstate to common CPUClass.realizefn, Gu Zheng, 2014/08/28