qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 09/20] cpu: introduce cpu_realize()


From: Eduardo Habkost
Subject: [Qemu-devel] [RFC 09/20] cpu: introduce cpu_realize()
Date: Tue, 18 Dec 2012 18:04:02 -0200

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 <address@hidden>
---
 include/qemu/cpu.h | 13 +++++++++++++
 qom/cpu.c          | 10 ++++++++++
 2 files changed, 23 insertions(+)

diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h
index b27b353..90bb27d 100644
--- a/include/qemu/cpu.h
+++ b/include/qemu/cpu.h
@@ -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.
diff --git a/qom/cpu.c b/qom/cpu.c
index 5b36046..a96f6ee 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -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)
 {
 }
-- 
1.7.11.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]