|
@@ -193,6 +193,20 @@ static void cpu_common_parse_features(const char *typename, char *features,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+bool cpu_exec_realizefn(CPUState *cpu, Error **errp)
|
|
|
+{
|
|
|
+ if (!accel_cpu_common_realize(cpu, errp)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Wait until cpu initialization complete before exposing cpu. */
|
|
|
+ cpu_list_add(cpu);
|
|
|
+
|
|
|
+ cpu_vmstate_register(cpu);
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
static void cpu_common_realizefn(DeviceState *dev, Error **errp)
|
|
|
{
|
|
|
CPUState *cpu = CPU(dev);
|
|
@@ -234,6 +248,18 @@ static void cpu_common_unrealizefn(DeviceState *dev)
|
|
|
cpu_exec_unrealizefn(cpu);
|
|
|
}
|
|
|
|
|
|
+void cpu_exec_unrealizefn(CPUState *cpu)
|
|
|
+{
|
|
|
+ cpu_vmstate_unregister(cpu);
|
|
|
+
|
|
|
+ cpu_list_remove(cpu);
|
|
|
+ /*
|
|
|
+ * Now that the vCPU has been removed from the RCU list, we can call
|
|
|
+ * accel_cpu_common_unrealize, which may free fields using call_rcu.
|
|
|
+ */
|
|
|
+ accel_cpu_common_unrealize(cpu);
|
|
|
+}
|
|
|
+
|
|
|
static void cpu_common_initfn(Object *obj)
|
|
|
{
|
|
|
CPUState *cpu = CPU(obj);
|