@@ -20,6 +20,7 @@
#ifndef QEMU_CPU_H
#define QEMU_CPU_H
+#include "error.h"
#include "qemu/object.h"
#include "qemu-thread.h"
@@ -41,6 +42,7 @@ typedef struct CPUState CPUState;
/**
* CPUClass:
* @reset: Callback to reset the #CPUState to its initial state.
+ * @realize: Realize function to finish CPU initialization.
*
* Represents a CPU family or model.
*/
@@ -50,6 +52,7 @@ typedef struct CPUClass {
/*< public >*/
void (*reset)(CPUState *cpu);
+ void (*realize)(CPUState *cpu, Error **errp);
} CPUClass;
/**
@@ -88,6 +91,16 @@ struct CPUState {
*/
void cpu_reset(CPUState *cpu);
+
+/**
+ * cpu_realize:
+ * @cpu: The CPU that is going to be "realized".
+ *
+ * Finishes initialization of the CPU object, after properties have been
+ * set.
+ */
+void cpu_realize(CPUState *cpu, Error **errp);
+
/**
* qemu_cpu_has_work:
* @cpu: The vCPU to check.
@@ -30,6 +30,16 @@ void cpu_reset(CPUState *cpu)
}
}
+void cpu_realize(CPUState *cpu, Error **errp)
+{
+ CPUClass *klass = CPU_GET_CLASS(cpu);
+
+ if (klass->realize) {
+ (*klass->realize)(cpu, errp);
+ }
+}
+
+
static void cpu_common_reset(CPUState *cpu)
{
}
This is just for testing/demonstration purposes. Probably this will be replaced by the more generic DeviceState realize() method, later. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- include/qemu/cpu.h | 13 +++++++++++++ qom/cpu.c | 10 ++++++++++ 2 files changed, 23 insertions(+)