[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/12] i386/cpu: add instance finalize callback
From: |
Gu Zheng |
Subject: |
[Qemu-devel] [PATCH 02/12] i386/cpu: add instance finalize callback |
Date: |
Fri, 12 Dec 2014 16:43:08 +0800 |
Signed-off-by: Gu Zheng <address@hidden>
Signed-off-by: Zhu Guihua <address@hidden>
---
include/qom/cpu.h | 1 +
target-i386/cpu.c | 8 ++++++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 936afcd..f663199 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -305,6 +305,7 @@ struct CPUState {
QTAILQ_HEAD(CPUTailQ, CPUState);
extern struct CPUTailQ cpus;
#define CPU_NEXT(cpu) QTAILQ_NEXT(cpu, node)
+#define CPU_REMOVE(cpu) QTAILQ_REMOVE(&cpus, cpu, node)
#define CPU_FOREACH(cpu) QTAILQ_FOREACH(cpu, &cpus, node)
#define CPU_FOREACH_SAFE(cpu, next_cpu) \
QTAILQ_FOREACH_SAFE(cpu, &cpus, node, next_cpu)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 9618bc7..718670a 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2970,6 +2970,13 @@ static void x86_cpu_initfn(Object *obj)
}
}
+static void x86_cpu_finalizefn(Object *obj)
+{
+ CPUState *cs = CPU(obj);
+
+ CPU_REMOVE(cs);
+}
+
static int64_t x86_cpu_get_arch_id(CPUState *cs)
{
X86CPU *cpu = X86_CPU(cs);
@@ -3083,6 +3090,7 @@ static const TypeInfo x86_cpu_type_info = {
.parent = TYPE_CPU,
.instance_size = sizeof(X86CPU),
.instance_init = x86_cpu_initfn,
+ .instance_finalize = x86_cpu_finalizefn,
.abstract = true,
.class_size = sizeof(X86CPUClass),
.class_init = x86_cpu_common_class_init,
--
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 <=
- [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, 2014/12/12
- [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