[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH v2 23/26] qom: add cpu_generic_init_unrealized()
From: |
Michael Davidsaver |
Subject: |
[Qemu-arm] [PATCH v2 23/26] qom: add cpu_generic_init_unrealized() |
Date: |
Wed, 2 Dec 2015 19:18:50 -0500 |
cpu_generic_init() without realized=true.
Gives board code an opportunity to change
CPU properties.
---
include/qom/cpu.h | 12 ++++++++++++
qom/cpu.c | 23 +++++++++++++++++------
2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 51a1323..9093500 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -489,6 +489,18 @@ 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_unrealized:
+ * @typename: The CPU base type.
+ * @cpu_model: The model string including optional parameters.
+ *
+ * Instantiates a CPU, processes optional parameters but does not realize it.
+ *
+ * Returns: A #CPUState or %NULL if an error occurred.
+ */
+CPUState *cpu_generic_init_unrealized(const char *typename,
+ const char *cpu_model);
+
+/**
* cpu_has_work:
* @cpu: The vCPU to check.
*
diff --git a/qom/cpu.c b/qom/cpu.c
index fb80d13..f622fc2 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -42,6 +42,23 @@ bool cpu_exists(int64_t id)
CPUState *cpu_generic_init(const char *typename, const char *cpu_model)
{
+ CPUState *cpu = cpu_generic_init_unrealized(typename, cpu_model);
+ if (cpu) {
+ Error *err = NULL;
+ object_property_set_bool(OBJECT(cpu), true, "realized", &err);
+
+ if (err != NULL) {
+ error_report_err(err);
+ object_unref(OBJECT(cpu));
+ return NULL;
+ }
+ }
+ return cpu;
+}
+
+CPUState *cpu_generic_init_unrealized(const char *typename,
+ const char *cpu_model)
+{
char *str, *name, *featurestr;
CPUState *cpu;
ObjectClass *oc;
@@ -63,13 +80,7 @@ CPUState *cpu_generic_init(const char *typename, const char
*cpu_model)
featurestr = strtok(NULL, ",");
cc->parse_features(cpu, featurestr, &err);
g_free(str);
- if (err != NULL) {
- goto out;
- }
-
- object_property_set_bool(OBJECT(cpu), true, "realized", &err);
-out:
if (err != NULL) {
error_report_err(err);
object_unref(OBJECT(cpu));
--
2.1.4
- [Qemu-arm] [PATCH v2 15/26] armv7m: add MPU to cortex-m3 and cortex-m4, (continued)
- [Qemu-arm] [PATCH v2 15/26] armv7m: add MPU to cortex-m3 and cortex-m4, Michael Davidsaver, 2015/12/02
- [Qemu-arm] [PATCH v2 14/26] armv7m: prevent unprivileged write to STIR, Michael Davidsaver, 2015/12/02
- [Qemu-arm] [PATCH v2 19/26] armv7m: mpu not allowed to map exception return codes, Michael Davidsaver, 2015/12/02
- [Qemu-arm] [PATCH v2 13/26] armv7m: implement CCR, Michael Davidsaver, 2015/12/02
- [Qemu-arm] [PATCH v2 12/26] armv7m: check exception return consistency, Michael Davidsaver, 2015/12/02
- [Qemu-arm] [PATCH v2 20/26] armv7m: observable initial register state, Michael Davidsaver, 2015/12/02
- [Qemu-arm] [PATCH v2 18/26] armv7m: update base region policy, Michael Davidsaver, 2015/12/02
- [Qemu-arm] [PATCH v2 23/26] qom: add cpu_generic_init_unrealized(),
Michael Davidsaver <=
- [Qemu-arm] [PATCH v2 08/26] armv7m: rewrite NVIC, Michael Davidsaver, 2015/12/02
- [Qemu-arm] [PATCH v2 26/26] armv7m: decide whether faults are MemManage or BusFault, Michael Davidsaver, 2015/12/02
- Re: [Qemu-arm] [PATCH v2 00/26] armv7m: exception handling, MPU, and more, Peter Maydell, 2015/12/17