diff mbox

[RFC,qom-cpu,13/41] cpu: Drop cpu_model_str from CPU_COMMON

Message ID 1378285521-3230-14-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber Sept. 4, 2013, 9:04 a.m. UTC
Since this is only read in cpu_copy() and linux-user has a global
cpu_model, drop the field from generic code.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 include/exec/cpu-defs.h     | 2 --
 linux-user/main.c           | 4 ++--
 target-alpha/cpu.c          | 4 ----
 target-arm/helper.c         | 3 ---
 target-i386/cpu.c           | 3 ---
 target-m68k/helper.c        | 1 -
 target-mips/translate.c     | 1 -
 target-moxie/cpu.c          | 1 -
 target-openrisc/cpu.c       | 1 -
 target-ppc/translate_init.c | 3 ---
 target-s390x/helper.c       | 3 ---
 target-sh4/cpu.c            | 3 ---
 target-sparc/cpu.c          | 1 -
 target-unicore32/helper.c   | 1 -
 14 files changed, 2 insertions(+), 29 deletions(-)

Comments

Jia Liu Sept. 4, 2013, 12:47 p.m. UTC | #1
On Wed, Sep 4, 2013 at 5:04 PM, Andreas Färber <afaerber@suse.de> wrote:
> Since this is only read in cpu_copy() and linux-user has a global
> cpu_model, drop the field from generic code.
>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  include/exec/cpu-defs.h     | 2 --
>  linux-user/main.c           | 4 ++--
>  target-alpha/cpu.c          | 4 ----
>  target-arm/helper.c         | 3 ---
>  target-i386/cpu.c           | 3 ---
>  target-m68k/helper.c        | 1 -
>  target-mips/translate.c     | 1 -
>  target-moxie/cpu.c          | 1 -
>  target-openrisc/cpu.c       | 1 -
>  target-ppc/translate_init.c | 3 ---
>  target-s390x/helper.c       | 3 ---
>  target-sh4/cpu.c            | 3 ---
>  target-sparc/cpu.c          | 1 -
>  target-unicore32/helper.c   | 1 -
>  14 files changed, 2 insertions(+), 29 deletions(-)
>
> diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
> index 6801968..512f2ed 100644
> --- a/include/exec/cpu-defs.h
> +++ b/include/exec/cpu-defs.h
> @@ -140,7 +140,5 @@ typedef struct CPUWatchpoint {
>                                                                          \
>      /* user data */                                                     \
>      void *opaque;                                                       \
> -                                                                        \
> -    const char *cpu_model_str;
>
>  #endif
> diff --git a/linux-user/main.c b/linux-user/main.c
> index afc3ce4..d556881 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -42,7 +42,7 @@ const char *filename;
>  const char *argv0;
>  int gdbstub_port;
>  envlist_t *envlist;
> -const char *cpu_model;
> +static const char *cpu_model;
>  unsigned long mmap_min_addr;
>  #if defined(CONFIG_USE_GUEST_BASE)
>  unsigned long guest_base;
> @@ -3191,7 +3191,7 @@ void init_task_state(TaskState *ts)
>
>  CPUArchState *cpu_copy(CPUArchState *env)
>  {
> -    CPUArchState *new_env = cpu_init(env->cpu_model_str);
> +    CPUArchState *new_env = cpu_init(cpu_model);
>  #if defined(TARGET_HAS_ICE)
>      CPUBreakpoint *bp;
>      CPUWatchpoint *wp;
> diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c
> index e880983..9931f9f 100644
> --- a/target-alpha/cpu.c
> +++ b/target-alpha/cpu.c
> @@ -182,7 +182,6 @@ static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model)
>  AlphaCPU *cpu_alpha_init(const char *cpu_model)
>  {
>      AlphaCPU *cpu;
> -    CPUAlphaState *env;
>      ObjectClass *cpu_class;
>
>      cpu_class = alpha_cpu_class_by_name(cpu_model);
> @@ -191,9 +190,6 @@ AlphaCPU *cpu_alpha_init(const char *cpu_model)
>          cpu_class = object_class_by_name(TYPE("ev67"));
>      }
>      cpu = ALPHA_CPU(object_new(object_class_get_name(cpu_class)));
> -    env = &cpu->env;
> -
> -    env->cpu_model_str = cpu_model;
>
>      object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
>
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index 508a7fc..bc00858 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -1748,7 +1748,6 @@ void register_cp_regs_for_features(ARMCPU *cpu)
>  ARMCPU *cpu_arm_init(const char *cpu_model)
>  {
>      ARMCPU *cpu;
> -    CPUARMState *env;
>      ObjectClass *oc;
>
>      oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model);
> @@ -1756,8 +1755,6 @@ ARMCPU *cpu_arm_init(const char *cpu_model)
>          return NULL;
>      }
>      cpu = ARM_CPU(object_new(object_class_get_name(oc)));
> -    env = &cpu->env;
> -    env->cpu_model_str = cpu_model;
>
>      /* TODO this should be set centrally, once possible */
>      object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 3ed5a11..89e3217 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1896,7 +1896,6 @@ X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,
>                         Error **errp)
>  {
>      X86CPU *cpu = NULL;
> -    CPUX86State *env;
>      gchar **model_pieces;
>      char *name, *features;
>      char *typename;
> @@ -1919,8 +1918,6 @@ X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,
>      qdev_set_parent_bus(DEVICE(cpu), qdev_get_child_bus(icc_bridge, "icc"));
>      object_unref(OBJECT(cpu));
>  #endif
> -    env = &cpu->env;
> -    env->cpu_model_str = cpu_model;
>
>      cpu_x86_register(cpu, name, &error);
>      if (error) {
> diff --git a/target-m68k/helper.c b/target-m68k/helper.c
> index 003a298..e38065c 100644
> --- a/target-m68k/helper.c
> +++ b/target-m68k/helper.c
> @@ -110,7 +110,6 @@ M68kCPU *cpu_m68k_init(const char *cpu_model)
>      }
>      cpu = M68K_CPU(object_new(object_class_get_name(oc)));
>      env = &cpu->env;
> -    env->cpu_model_str = cpu_model;
>
>      register_m68k_insns(env);
>
> diff --git a/target-mips/translate.c b/target-mips/translate.c
> index 716d50c..453918d 100644
> --- a/target-mips/translate.c
> +++ b/target-mips/translate.c
> @@ -15907,7 +15907,6 @@ MIPSCPU *cpu_mips_init(const char *cpu_model)
>      cpu = MIPS_CPU(object_new(TYPE_MIPS_CPU));
>      env = &cpu->env;
>      env->cpu_model = def;
> -    env->cpu_model_str = cpu_model;
>
>  #ifndef CONFIG_USER_ONLY
>      mmu_init(env, def);
> diff --git a/target-moxie/cpu.c b/target-moxie/cpu.c
> index e07a4df..ab9d2cc 100644
> --- a/target-moxie/cpu.c
> +++ b/target-moxie/cpu.c
> @@ -157,7 +157,6 @@ MoxieCPU *cpu_moxie_init(const char *cpu_model)
>          return NULL;
>      }
>      cpu = MOXIE_CPU(object_new(object_class_get_name(oc)));
> -    cpu->env.cpu_model_str = cpu_model;
>
>      object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
>
> diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
> index b233969..b7104e3 100644
> --- a/target-openrisc/cpu.c
> +++ b/target-openrisc/cpu.c
> @@ -241,7 +241,6 @@ OpenRISCCPU *cpu_openrisc_init(const char *cpu_model)
>          return NULL;
>      }
>      cpu = OPENRISC_CPU(object_new(object_class_get_name(oc)));
> -    cpu->env.cpu_model_str = cpu_model;
>
>      object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
>
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index 0934a45..db5e526 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -8267,7 +8267,6 @@ static ObjectClass *ppc_cpu_class_by_name(const char *name)
>  PowerPCCPU *cpu_ppc_init(const char *cpu_model)
>  {
>      PowerPCCPU *cpu;
> -    CPUPPCState *env;
>      ObjectClass *oc;
>      Error *err = NULL;
>
> @@ -8277,8 +8276,6 @@ PowerPCCPU *cpu_ppc_init(const char *cpu_model)
>      }
>
>      cpu = POWERPC_CPU(object_new(object_class_get_name(oc)));
> -    env = &cpu->env;
> -    env->cpu_model_str = cpu_model;
>
>      object_property_set_bool(OBJECT(cpu), true, "realized", &err);
>      if (err != NULL) {
> diff --git a/target-s390x/helper.c b/target-s390x/helper.c
> index c9d3d55..e1ed6c0 100644
> --- a/target-s390x/helper.c
> +++ b/target-s390x/helper.c
> @@ -73,11 +73,8 @@ void s390x_cpu_timer(void *opaque)
>  S390CPU *cpu_s390x_init(const char *cpu_model)
>  {
>      S390CPU *cpu;
> -    CPUS390XState *env;
>
>      cpu = S390_CPU(object_new(TYPE_S390_CPU));
> -    env = &cpu->env;
> -    env->cpu_model_str = cpu_model;
>
>      object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
>
> diff --git a/target-sh4/cpu.c b/target-sh4/cpu.c
> index 7f98f80..1f1b8fd 100644
> --- a/target-sh4/cpu.c
> +++ b/target-sh4/cpu.c
> @@ -172,7 +172,6 @@ static ObjectClass *superh_cpu_class_by_name(const char *cpu_model)
>  SuperHCPU *cpu_sh4_init(const char *cpu_model)
>  {
>      SuperHCPU *cpu;
> -    CPUSH4State *env;
>      ObjectClass *oc;
>
>      oc = superh_cpu_class_by_name(cpu_model);
> @@ -180,8 +179,6 @@ SuperHCPU *cpu_sh4_init(const char *cpu_model)
>          return NULL;
>      }
>      cpu = SUPERH_CPU(object_new(object_class_get_name(oc)));
> -    env = &cpu->env;
> -    env->cpu_model_str = cpu_model;
>
>      object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
>
> diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c
> index c8d8c55..9443713 100644
> --- a/target-sparc/cpu.c
> +++ b/target-sparc/cpu.c
> @@ -84,7 +84,6 @@ static int cpu_sparc_register(CPUSPARCState *env, const char *cpu_model)
>          env->def->features |= CPU_FEATURE_FLOAT128;
>      }
>  #endif
> -    env->cpu_model_str = cpu_model;
>      env->version = def->iu_version;
>      env->fsr = def->fpu_version;
>      env->nwindows = def->nwindows;
> diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c
> index 4e90cf3..eece271 100644
> --- a/target-unicore32/helper.c
> +++ b/target-unicore32/helper.c
> @@ -37,7 +37,6 @@ CPUUniCore32State *uc32_cpu_init(const char *cpu_model)
>      }
>      cpu = UNICORE32_CPU(object_new(object_class_get_name(oc)));
>      env = &cpu->env;
> -    env->cpu_model_str = cpu_model;
>
>      object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
>

target-openrisc: Tested-by: Jia Liu <proljc@gmail.com>

> --
> 1.8.1.4
>
diff mbox

Patch

diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
index 6801968..512f2ed 100644
--- a/include/exec/cpu-defs.h
+++ b/include/exec/cpu-defs.h
@@ -140,7 +140,5 @@  typedef struct CPUWatchpoint {
                                                                         \
     /* user data */                                                     \
     void *opaque;                                                       \
-                                                                        \
-    const char *cpu_model_str;
 
 #endif
diff --git a/linux-user/main.c b/linux-user/main.c
index afc3ce4..d556881 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -42,7 +42,7 @@  const char *filename;
 const char *argv0;
 int gdbstub_port;
 envlist_t *envlist;
-const char *cpu_model;
+static const char *cpu_model;
 unsigned long mmap_min_addr;
 #if defined(CONFIG_USE_GUEST_BASE)
 unsigned long guest_base;
@@ -3191,7 +3191,7 @@  void init_task_state(TaskState *ts)
 
 CPUArchState *cpu_copy(CPUArchState *env)
 {
-    CPUArchState *new_env = cpu_init(env->cpu_model_str);
+    CPUArchState *new_env = cpu_init(cpu_model);
 #if defined(TARGET_HAS_ICE)
     CPUBreakpoint *bp;
     CPUWatchpoint *wp;
diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c
index e880983..9931f9f 100644
--- a/target-alpha/cpu.c
+++ b/target-alpha/cpu.c
@@ -182,7 +182,6 @@  static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model)
 AlphaCPU *cpu_alpha_init(const char *cpu_model)
 {
     AlphaCPU *cpu;
-    CPUAlphaState *env;
     ObjectClass *cpu_class;
 
     cpu_class = alpha_cpu_class_by_name(cpu_model);
@@ -191,9 +190,6 @@  AlphaCPU *cpu_alpha_init(const char *cpu_model)
         cpu_class = object_class_by_name(TYPE("ev67"));
     }
     cpu = ALPHA_CPU(object_new(object_class_get_name(cpu_class)));
-    env = &cpu->env;
-
-    env->cpu_model_str = cpu_model;
 
     object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
 
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 508a7fc..bc00858 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -1748,7 +1748,6 @@  void register_cp_regs_for_features(ARMCPU *cpu)
 ARMCPU *cpu_arm_init(const char *cpu_model)
 {
     ARMCPU *cpu;
-    CPUARMState *env;
     ObjectClass *oc;
 
     oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model);
@@ -1756,8 +1755,6 @@  ARMCPU *cpu_arm_init(const char *cpu_model)
         return NULL;
     }
     cpu = ARM_CPU(object_new(object_class_get_name(oc)));
-    env = &cpu->env;
-    env->cpu_model_str = cpu_model;
 
     /* TODO this should be set centrally, once possible */
     object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 3ed5a11..89e3217 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1896,7 +1896,6 @@  X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,
                        Error **errp)
 {
     X86CPU *cpu = NULL;
-    CPUX86State *env;
     gchar **model_pieces;
     char *name, *features;
     char *typename;
@@ -1919,8 +1918,6 @@  X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,
     qdev_set_parent_bus(DEVICE(cpu), qdev_get_child_bus(icc_bridge, "icc"));
     object_unref(OBJECT(cpu));
 #endif
-    env = &cpu->env;
-    env->cpu_model_str = cpu_model;
 
     cpu_x86_register(cpu, name, &error);
     if (error) {
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index 003a298..e38065c 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -110,7 +110,6 @@  M68kCPU *cpu_m68k_init(const char *cpu_model)
     }
     cpu = M68K_CPU(object_new(object_class_get_name(oc)));
     env = &cpu->env;
-    env->cpu_model_str = cpu_model;
 
     register_m68k_insns(env);
 
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 716d50c..453918d 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -15907,7 +15907,6 @@  MIPSCPU *cpu_mips_init(const char *cpu_model)
     cpu = MIPS_CPU(object_new(TYPE_MIPS_CPU));
     env = &cpu->env;
     env->cpu_model = def;
-    env->cpu_model_str = cpu_model;
 
 #ifndef CONFIG_USER_ONLY
     mmu_init(env, def);
diff --git a/target-moxie/cpu.c b/target-moxie/cpu.c
index e07a4df..ab9d2cc 100644
--- a/target-moxie/cpu.c
+++ b/target-moxie/cpu.c
@@ -157,7 +157,6 @@  MoxieCPU *cpu_moxie_init(const char *cpu_model)
         return NULL;
     }
     cpu = MOXIE_CPU(object_new(object_class_get_name(oc)));
-    cpu->env.cpu_model_str = cpu_model;
 
     object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
 
diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
index b233969..b7104e3 100644
--- a/target-openrisc/cpu.c
+++ b/target-openrisc/cpu.c
@@ -241,7 +241,6 @@  OpenRISCCPU *cpu_openrisc_init(const char *cpu_model)
         return NULL;
     }
     cpu = OPENRISC_CPU(object_new(object_class_get_name(oc)));
-    cpu->env.cpu_model_str = cpu_model;
 
     object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
 
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 0934a45..db5e526 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -8267,7 +8267,6 @@  static ObjectClass *ppc_cpu_class_by_name(const char *name)
 PowerPCCPU *cpu_ppc_init(const char *cpu_model)
 {
     PowerPCCPU *cpu;
-    CPUPPCState *env;
     ObjectClass *oc;
     Error *err = NULL;
 
@@ -8277,8 +8276,6 @@  PowerPCCPU *cpu_ppc_init(const char *cpu_model)
     }
 
     cpu = POWERPC_CPU(object_new(object_class_get_name(oc)));
-    env = &cpu->env;
-    env->cpu_model_str = cpu_model;
 
     object_property_set_bool(OBJECT(cpu), true, "realized", &err);
     if (err != NULL) {
diff --git a/target-s390x/helper.c b/target-s390x/helper.c
index c9d3d55..e1ed6c0 100644
--- a/target-s390x/helper.c
+++ b/target-s390x/helper.c
@@ -73,11 +73,8 @@  void s390x_cpu_timer(void *opaque)
 S390CPU *cpu_s390x_init(const char *cpu_model)
 {
     S390CPU *cpu;
-    CPUS390XState *env;
 
     cpu = S390_CPU(object_new(TYPE_S390_CPU));
-    env = &cpu->env;
-    env->cpu_model_str = cpu_model;
 
     object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
 
diff --git a/target-sh4/cpu.c b/target-sh4/cpu.c
index 7f98f80..1f1b8fd 100644
--- a/target-sh4/cpu.c
+++ b/target-sh4/cpu.c
@@ -172,7 +172,6 @@  static ObjectClass *superh_cpu_class_by_name(const char *cpu_model)
 SuperHCPU *cpu_sh4_init(const char *cpu_model)
 {
     SuperHCPU *cpu;
-    CPUSH4State *env;
     ObjectClass *oc;
 
     oc = superh_cpu_class_by_name(cpu_model);
@@ -180,8 +179,6 @@  SuperHCPU *cpu_sh4_init(const char *cpu_model)
         return NULL;
     }
     cpu = SUPERH_CPU(object_new(object_class_get_name(oc)));
-    env = &cpu->env;
-    env->cpu_model_str = cpu_model;
 
     object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
 
diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c
index c8d8c55..9443713 100644
--- a/target-sparc/cpu.c
+++ b/target-sparc/cpu.c
@@ -84,7 +84,6 @@  static int cpu_sparc_register(CPUSPARCState *env, const char *cpu_model)
         env->def->features |= CPU_FEATURE_FLOAT128;
     }
 #endif
-    env->cpu_model_str = cpu_model;
     env->version = def->iu_version;
     env->fsr = def->fpu_version;
     env->nwindows = def->nwindows;
diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c
index 4e90cf3..eece271 100644
--- a/target-unicore32/helper.c
+++ b/target-unicore32/helper.c
@@ -37,7 +37,6 @@  CPUUniCore32State *uc32_cpu_init(const char *cpu_model)
     }
     cpu = UNICORE32_CPU(object_new(object_class_get_name(oc)));
     env = &cpu->env;
-    env->cpu_model_str = cpu_model;
 
     object_property_set_bool(OBJECT(cpu), true, "realized", NULL);