[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH-for-9.1 08/21] target/sparc: Make SPARC_CPU common to new SPARC32
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH-for-9.1 08/21] target/sparc: Make SPARC_CPU common to new SPARC32_CPU/SPARC64_CPU types |
Date: |
Fri, 15 Mar 2024 14:08:56 +0100 |
"target/foo/cpu-qom.h" can not use any target specific definitions.
Currently "target/sparc/cpu-qom.h" defines TYPE_SPARC_CPU
depending on the sparc(32)/sparc64 build type. This doesn't
scale in a heterogeneous context where we need to access both
types concurrently.
In order to do that, introduce the new SPARC32_CPU / SPARC64_CPU
types, both inheriting a common TYPE_SPARC_CPU base type.
Keep the current CPU types registered in sparc_register_cpudef_type()
as 32 or 64-bit, depending on the binary built.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
target/sparc/cpu-qom.h | 9 +++++----
target/sparc/cpu.c | 12 +++++++++++-
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/target/sparc/cpu-qom.h b/target/sparc/cpu-qom.h
index a86331bd58..6ad283506e 100644
--- a/target/sparc/cpu-qom.h
+++ b/target/sparc/cpu-qom.h
@@ -22,14 +22,15 @@
#include "hw/core/cpu.h"
-#ifdef TARGET_SPARC64
-#define TYPE_SPARC_CPU "sparc64-cpu"
-#else
#define TYPE_SPARC_CPU "sparc-cpu"
-#endif
+#define TYPE_SPARC32_CPU "sparc32-cpu"
+#define TYPE_SPARC64_CPU "sparc64-cpu"
OBJECT_DECLARE_CPU_TYPE(SPARCCPU, SPARCCPUClass, SPARC_CPU)
+OBJECT_DECLARE_CPU_TYPE(SPARC32CPU, SPARCCPUClass, SPARC32_CPU)
+OBJECT_DECLARE_CPU_TYPE(SPARC64CPU, SPARCCPUClass, SPARC64_CPU)
+
#define SPARC_CPU_TYPE_SUFFIX "-" TYPE_SPARC_CPU
#define SPARC_CPU_TYPE_NAME(model) model SPARC_CPU_TYPE_SUFFIX
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index 42b13ab63f..9e27e16b75 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -959,6 +959,12 @@ static const TypeInfo sparc_cpu_types[] = {
.abstract = true,
.class_size = sizeof(SPARCCPUClass),
.class_init = sparc_cpu_class_init,
+ }, {
+ .name = TYPE_SPARC32_CPU,
+ .parent = TYPE_SPARC_CPU,
+ }, {
+ .name = TYPE_SPARC64_CPU,
+ .parent = TYPE_SPARC_CPU,
}
};
@@ -975,7 +981,11 @@ static void sparc_register_cpudef_type(const struct
sparc_def_t *def)
char *typename = sparc_cpu_type_name(def->name);
TypeInfo ti = {
.name = typename,
- .parent = TYPE_SPARC_CPU,
+#ifdef TARGET_SPARC64
+ .parent = TYPE_SPARC64_CPU,
+#else
+ .parent = TYPE_SPARC32_CPU,
+#endif
.class_init = sparc_cpu_cpudef_class_init,
.class_data = (void *)def,
};
--
2.41.0
- Re: [PATCH-for-9.1 06/21] target/i386: Make X86_CPU common to new I386_CPU / X86_64_CPU types, (continued)
- [PATCH-for-9.1 09/21] qapi: Merge machine-common.json with qapi/machine.json, Philippe Mathieu-Daudé, 2024/03/15
- [PATCH-for-9.1 05/21] cpus: Open code OBJECT_DECLARE_TYPE() in OBJECT_DECLARE_CPU_TYPE(), Philippe Mathieu-Daudé, 2024/03/15
- [PATCH-for-9.1 07/21] target/mips: Make MIPS_CPU common to new MIPS32_CPU / MIPS64_CPU types, Philippe Mathieu-Daudé, 2024/03/15
- [RFC PATCH-for-9.1 15/21] target/arm: Use QMP generic_query_cpu_definitions(), Philippe Mathieu-Daudé, 2024/03/15
- [PATCH-for-9.1 08/21] target/sparc: Make SPARC_CPU common to new SPARC32_CPU/SPARC64_CPU types,
Philippe Mathieu-Daudé <=
- [PATCH-for-9.1 10/21] qapi: Make CpuModel* definitions target agnostic, Philippe Mathieu-Daudé, 2024/03/15
- [PATCH-for-9.1 11/21] qapi: Make CpuDefinitionInfo target agnostic, Philippe Mathieu-Daudé, 2024/03/15
- [PATCH-for-9.1 12/21] system: Introduce QemuArchBit enum, Philippe Mathieu-Daudé, 2024/03/15
- [RFC PATCH-for-9.1 16/21] target/loongarch: Use QMP generic_query_cpu_definitions(), Philippe Mathieu-Daudé, 2024/03/15
- [RFC PATCH-for-9.1 17/21] target/riscv: Use QMP generic_query_cpu_definitions(), Philippe Mathieu-Daudé, 2024/03/15
- [PATCH-for-9.1 13/21] system: Introduce cpu_typename_by_arch_bit(), Philippe Mathieu-Daudé, 2024/03/15
- [RFC PATCH-for-9.1 14/21] system: Introduce QMP generic_query_cpu_definitions(), Philippe Mathieu-Daudé, 2024/03/15