diff mbox series

[v2,34/40] sparc: leon3: use generic cpu_model parsing

Message ID 1507211474-188400-35-git-send-email-imammedo@redhat.com
State New
Headers show
Series generalize parsing of cpu_model (part 2) | expand

Commit Message

Igor Mammedov Oct. 5, 2017, 1:51 p.m. UTC
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
CC: mark.cave-ayland@ilande.co.uk
CC: atar4qemu@gmail.com
CC: chouteau@adacore.com
---
 hw/sparc/leon3.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Artyom Tarasenko Oct. 5, 2017, 2:28 p.m. UTC | #1
On Thu, Oct 5, 2017 at 3:51 PM, Igor Mammedov <imammedo@redhat.com> wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>

> ---
> CC: mark.cave-ayland@ilande.co.uk
> CC: atar4qemu@gmail.com
> CC: chouteau@adacore.com
> ---
>  hw/sparc/leon3.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
> index ec2816b..8c66d5a 100644
> --- a/hw/sparc/leon3.c
> +++ b/hw/sparc/leon3.c
> @@ -107,7 +107,6 @@ static void leon3_set_pil_in(void *opaque, uint32_t pil_in)
>  static void leon3_generic_hw_init(MachineState *machine)
>  {
>      ram_addr_t ram_size = machine->ram_size;
> -    const char *cpu_model = machine->cpu_model;
>      const char *kernel_filename = machine->kernel_filename;
>      SPARCCPU *cpu;
>      CPUSPARCState   *env;
> @@ -122,11 +121,7 @@ static void leon3_generic_hw_init(MachineState *machine)
>      ResetData  *reset_info;
>
>      /* Init CPU */
> -    if (!cpu_model) {
> -        cpu_model = "LEON3";
> -    }
> -
> -    cpu = SPARC_CPU(cpu_generic_init(TYPE_SPARC_CPU, cpu_model));
> +    cpu = SPARC_CPU(cpu_create(machine->cpu_type));
>      env = &cpu->env;
>
>      cpu_sparc_set_id(env, 0);
> @@ -222,6 +217,7 @@ static void leon3_generic_machine_init(MachineClass *mc)
>  {
>      mc->desc = "Leon-3 generic";
>      mc->init = leon3_generic_hw_init;
> +    mc->default_cpu_type = SPARC_CPU_TYPE_NAME("LEON3");
>  }
>
>  DEFINE_MACHINE("leon3_generic", leon3_generic_machine_init)
> --
> 2.7.4
>
diff mbox series

Patch

diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index ec2816b..8c66d5a 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -107,7 +107,6 @@  static void leon3_set_pil_in(void *opaque, uint32_t pil_in)
 static void leon3_generic_hw_init(MachineState *machine)
 {
     ram_addr_t ram_size = machine->ram_size;
-    const char *cpu_model = machine->cpu_model;
     const char *kernel_filename = machine->kernel_filename;
     SPARCCPU *cpu;
     CPUSPARCState   *env;
@@ -122,11 +121,7 @@  static void leon3_generic_hw_init(MachineState *machine)
     ResetData  *reset_info;
 
     /* Init CPU */
-    if (!cpu_model) {
-        cpu_model = "LEON3";
-    }
-
-    cpu = SPARC_CPU(cpu_generic_init(TYPE_SPARC_CPU, cpu_model));
+    cpu = SPARC_CPU(cpu_create(machine->cpu_type));
     env = &cpu->env;
 
     cpu_sparc_set_id(env, 0);
@@ -222,6 +217,7 @@  static void leon3_generic_machine_init(MachineClass *mc)
 {
     mc->desc = "Leon-3 generic";
     mc->init = leon3_generic_hw_init;
+    mc->default_cpu_type = SPARC_CPU_TYPE_NAME("LEON3");
 }
 
 DEFINE_MACHINE("leon3_generic", leon3_generic_machine_init)