diff mbox series

[05/23] ppc: mac_newworld: use generic cpu_model parsing

Message ID 1507220690-265042-6-git-send-email-imammedo@redhat.com
State New
Headers show
Series generalize parsing of cpu_model (part 3/PPC) | expand

Commit Message

Igor Mammedov Oct. 5, 2017, 4:24 p.m. UTC
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/ppc/mac_newworld.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

Comments

David Gibson Oct. 6, 2017, 3:08 a.m. UTC | #1
On Thu, Oct 05, 2017 at 06:24:32PM +0200, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/ppc/mac_newworld.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> index 6d0ace2..3fa7c42 100644
> --- a/hw/ppc/mac_newworld.c
> +++ b/hw/ppc/mac_newworld.c
> @@ -174,16 +174,8 @@ static void ppc_core99_init(MachineState *machine)
>      linux_boot = (kernel_filename != NULL);
>  
>      /* init CPUs */
> -    if (machine->cpu_model == NULL) {
> -#ifdef TARGET_PPC64
> -        machine->cpu_model = "970fx";
> -#else
> -        machine->cpu_model = "G4";
> -#endif
> -    }
>      for (i = 0; i < smp_cpus; i++) {
> -        cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU,
> -                                           machine->cpu_model));
> +        cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
>          env = &cpu->env;
>  
>          /* Set time-base frequency to 100 Mhz */
> @@ -520,6 +512,11 @@ static void core99_machine_class_init(ObjectClass *oc, void *data)
>      mc->max_cpus = MAX_CPUS;
>      mc->default_boot_order = "cd";
>      mc->kvm_type = core99_kvm_type;
> +#ifdef TARGET_PPC64
> +    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("970fx_v3.1");
> +#else
> +    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("7400_v2.9");
> +#endif
>  }
>  
>  static const TypeInfo core99_machine_info = {
diff mbox series

Patch

diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 6d0ace2..3fa7c42 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -174,16 +174,8 @@  static void ppc_core99_init(MachineState *machine)
     linux_boot = (kernel_filename != NULL);
 
     /* init CPUs */
-    if (machine->cpu_model == NULL) {
-#ifdef TARGET_PPC64
-        machine->cpu_model = "970fx";
-#else
-        machine->cpu_model = "G4";
-#endif
-    }
     for (i = 0; i < smp_cpus; i++) {
-        cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU,
-                                           machine->cpu_model));
+        cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
         env = &cpu->env;
 
         /* Set time-base frequency to 100 Mhz */
@@ -520,6 +512,11 @@  static void core99_machine_class_init(ObjectClass *oc, void *data)
     mc->max_cpus = MAX_CPUS;
     mc->default_boot_order = "cd";
     mc->kvm_type = core99_kvm_type;
+#ifdef TARGET_PPC64
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("970fx_v3.1");
+#else
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("7400_v2.9");
+#endif
 }
 
 static const TypeInfo core99_machine_info = {