aboutsummaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2016-10-20 13:26:04 +0200
committerEduardo Habkost <ehabkost@redhat.com>2016-10-24 17:29:16 -0200
commit7bbc124e7e8fb544288ccd1f5185643a7d0554b8 (patch)
treed0859c0549f46cd8a38b3182763d1fe554c6e875 /qom
parentce5b1bbf624b977a55ff7f85bb3871682d03baff (diff)
exec: call cpu_exec_exit() from a CPU unrealize common function
As cpu_exec_exit() mirrors the cpu_exec_realizefn(), rename it as cpu_exec_unrealizefn(). Create and register a cpu_common_unrealizefn() function for the CPU device class and call cpu_exec_unrealizefn() from this function. Remove cpu_exec_exit() from cpu_common_finalize() (which mirrors init, not realize), and as x86_cpu_unrealizefn() and ppc_cpu_unrealizefn() overwrite the device class unrealize function, add a call to a parent_unrealize pointer. Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'qom')
-rw-r--r--qom/cpu.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/qom/cpu.c b/qom/cpu.c
index 85f1132043..03d9190f8c 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -345,6 +345,12 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp)
trace_init_vcpu(cpu);
}
+static void cpu_common_unrealizefn(DeviceState *dev, Error **errp)
+{
+ CPUState *cpu = CPU(dev);
+ cpu_exec_unrealizefn(cpu);
+}
+
static void cpu_common_initfn(Object *obj)
{
CPUState *cpu = CPU(obj);
@@ -369,7 +375,6 @@ static void cpu_common_initfn(Object *obj)
static void cpu_common_finalize(Object *obj)
{
CPUState *cpu = CPU(obj);
- cpu_exec_exit(cpu);
g_free(cpu->trace_dstate);
}
@@ -403,6 +408,7 @@ static void cpu_class_init(ObjectClass *klass, void *data)
k->cpu_exec_exit = cpu_common_noop;
k->cpu_exec_interrupt = cpu_common_exec_interrupt;
dc->realize = cpu_common_realizefn;
+ dc->unrealize = cpu_common_unrealizefn;
/*
* Reason: CPUs still need special care by board code: wiring up
* IRQs, adding reset handlers, halting non-first CPUs, ...