[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 7/8] cpu: add initialization helper without realize
From: |
Greg Kurz |
Subject: |
[Qemu-devel] [PATCH 7/8] cpu: add initialization helper without realize |
Date: |
Wed, 29 Jun 2016 22:51:38 +0200 |
User-agent: |
StGit/0.17.1-dirty |
This will allow PowerPC machines to compute the device-tree cpu id
between initialization and realization of the cpu.
Signed-off-by: Greg Kurz <address@hidden>
---
include/qom/cpu.h | 12 ++++++++++++
qom/cpu.c | 19 ++++++++++++++++---
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 63e77607f644..8b3adbbff060 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -557,8 +557,20 @@ ObjectClass *cpu_class_by_name(const char *typename, const
char *cpu_model);
*/
CPUState *cpu_generic_init(const char *typename, const char *cpu_model);
/**
+ * cpu_generic_init_no_realize:
+ * @typename: The CPU base type.
+ * @cpu_model: The model string including optional parameters.
+ *
+ * Instantiates a CPU, processes optional parameters.
+ *
+ * Returns: A #CPUState or %NULL if an error occurred.
+ */
+CPUState *cpu_generic_init_no_realize(const char *typename,
+ const char *cpu_model);
+
+/**
* cpu_has_work:
* @cpu: The vCPU to check.
*
* Checks whether the CPU has work to do.
diff --git a/qom/cpu.c b/qom/cpu.c
index 751e992de882..dfe3289991ab 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -42,9 +42,10 @@ bool cpu_exists(int64_t id)
}
return false;
}
-CPUState *cpu_generic_init(const char *typename, const char *cpu_model)
+static CPUState *cpu_generic_init_common(const char *typename,
+ const char *cpu_model, bool realize)
{
char *str, *name, *featurestr;
CPUState *cpu;
ObjectClass *oc;
@@ -69,10 +70,11 @@ CPUState *cpu_generic_init(const char *typename, const char
*cpu_model)
if (err != NULL) {
goto out;
}
- object_property_set_bool(OBJECT(cpu), true, "realized", &err);
-
+ if (realize) {
+ object_property_set_bool(OBJECT(cpu), true, "realized", &err);
+ }
out:
if (err != NULL) {
error_report_err(err);
object_unref(OBJECT(cpu));
@@ -81,8 +83,19 @@ out:
return cpu;
}
+CPUState *cpu_generic_init(const char *typename, const char *cpu_model)
+{
+ return cpu_generic_init_common(typename, cpu_model, true);
+}
+
+CPUState *cpu_generic_init_no_realize(const char *typename,
+ const char *cpu_model)
+{
+ return cpu_generic_init_common(typename, cpu_model, false);
+}
+
bool cpu_paging_enabled(const CPUState *cpu)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
- [Qemu-devel] [PATCH 0/8] ppc: compute cpu_dt_id in the machine code, Greg Kurz, 2016/06/29
- [Qemu-devel] [PATCH 1/8] spapr: drop reference on child object during core realization, Greg Kurz, 2016/06/29
- [Qemu-devel] [PATCH 2/8] spapr: do proper error propagation in spapr_cpu_core_realize_child(), Greg Kurz, 2016/06/29
- [Qemu-devel] [PATCH 3/8] spapr: drop duplicate variable in spapr_core_release(), Greg Kurz, 2016/06/29
- [Qemu-devel] [PATCH 4/8] exec: add missing conditional compilation, Greg Kurz, 2016/06/29
- [Qemu-devel] [PATCH 5/8] exec: move cpu_index init and exit to their own function, Greg Kurz, 2016/06/29
- [Qemu-devel] [PATCH 6/8] ppc: move cpu index setup to instance_init/finalize, Greg Kurz, 2016/06/29
- [Qemu-devel] [PATCH 7/8] cpu: add initialization helper without realize,
Greg Kurz <=
- [Qemu-devel] [PATCH 8/8] hw/ppc: move DT cpu id generation to machine code, Greg Kurz, 2016/06/29
- Re: [Qemu-devel] [Qemu-ppc] [PATCH 0/8] ppc: compute cpu_dt_id in the machine code, Greg Kurz, 2016/06/29
- Re: [Qemu-devel] [PATCH 0/8] ppc: compute cpu_dt_id in the machine code, David Gibson, 2016/06/30
- Re: [Qemu-devel] [PATCH 0/8] ppc: compute cpu_dt_id in the machine code, Igor Mammedov, 2016/06/30