diff mbox series

[RFC,05/40] target/arm: Create arm_cpu_register_parent

Message ID 20230103181646.55711-6-richard.henderson@linaro.org
State New
Headers show
Series Toward class init of cpu features | expand

Commit Message

Richard Henderson Jan. 3, 2023, 6:16 p.m. UTC
Create an arm cpu class with a specific abstract parent class.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/cpu-qom.h | 7 ++++++-
 target/arm/cpu.c     | 4 ++--
 2 files changed, 8 insertions(+), 3 deletions(-)

Comments

Philippe Mathieu-Daudé Jan. 5, 2023, 9:57 p.m. UTC | #1
On 3/1/23 19:16, Richard Henderson wrote:
> Create an arm cpu class with a specific abstract parent class.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/cpu-qom.h | 7 ++++++-
>   target/arm/cpu.c     | 4 ++--
>   2 files changed, 8 insertions(+), 3 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h
index 514c22ced9..95f7805076 100644
--- a/target/arm/cpu-qom.h
+++ b/target/arm/cpu-qom.h
@@ -37,9 +37,14 @@  typedef struct ARMCPUInfo {
     void (*class_init)(ObjectClass *oc, void *data);
 } ARMCPUInfo;
 
-void arm_cpu_register(const ARMCPUInfo *info);
+void arm_cpu_register_parent(const ARMCPUInfo *info, const char *parent);
 void aarch64_cpu_register(const ARMCPUInfo *info);
 
+static inline void arm_cpu_register(const ARMCPUInfo *info)
+{
+    arm_cpu_register_parent(info, TYPE_ARM_CPU);
+}
+
 /**
  * ARMCPUClass:
  * @parent_realize: The parent class' realize handler.
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 2fa022f62b..c97461e164 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -2260,10 +2260,10 @@  static void cpu_register_class_init(ObjectClass *oc, void *data)
     acc->info = data;
 }
 
-void arm_cpu_register(const ARMCPUInfo *info)
+void arm_cpu_register_parent(const ARMCPUInfo *info, const char *parent)
 {
     TypeInfo type_info = {
-        .parent = TYPE_ARM_CPU,
+        .parent = parent,
         .instance_size = sizeof(ARMCPU),
         .instance_align = __alignof__(ARMCPU),
         .instance_init = arm_cpu_instance_init,