diff mbox

target-arm: cpu: set default cpu_model via QEMUMachine.cpu_model

Message ID 1367333317-31468-1-git-send-email-imammedo@redhat.com
State New
Headers show

Commit Message

Igor Mammedov April 30, 2013, 2:48 p.m. UTC
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 compile tested only ...

---
 hw/arm/realview.c    |   16 ++++------------
 hw/arm/versatilepb.c |    5 ++---
 2 files changed, 6 insertions(+), 15 deletions(-)

Comments

Peter Maydell April 30, 2013, 2:55 p.m. UTC | #1
On 30 April 2013 15:48, Igor Mammedov <imammedo@redhat.com> wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  compile tested only ...
>
> ---
>  hw/arm/realview.c    |   16 ++++------------
>  hw/arm/versatilepb.c |    5 ++---

Anything that's only touching these two boards is clearly
not considering the whole situation -- more boards than
just these two have a board specific default CPU.

thanks
-- PMM
Igor Mammedov April 30, 2013, 3:01 p.m. UTC | #2
On Tue, 30 Apr 2013 15:55:24 +0100
Peter Maydell <peter.maydell@linaro.org> wrote:

> On 30 April 2013 15:48, Igor Mammedov <imammedo@redhat.com> wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  compile tested only ...
> >
> > ---
> >  hw/arm/realview.c    |   16 ++++------------
> >  hw/arm/versatilepb.c |    5 ++---
> 
> Anything that's only touching these two boards is clearly
> not considering the whole situation -- more boards than
> just these two have a board specific default CPU.
that was only ones that used QEMUMachineArgs.cpu_model as storage for
dynamically setting default value. 
Other machines should be checked and cleaned up as well.

perhaps commit subj should be:
target-arm: cpu: set default cpu_model via QEMUMachine.cpu_model for realview and versatilepb boards.
> 
> thanks
> -- PMM
Eduardo Habkost April 30, 2013, 3:06 p.m. UTC | #3
On Tue, Apr 30, 2013 at 03:55:24PM +0100, Peter Maydell wrote:
> On 30 April 2013 15:48, Igor Mammedov <imammedo@redhat.com> wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  compile tested only ...
> >
> > ---
> >  hw/arm/realview.c    |   16 ++++------------
> >  hw/arm/versatilepb.c |    5 ++---
> 
> Anything that's only touching these two boards is clearly
> not considering the whole situation -- more boards than
> just these two have a board specific default CPU.

You're right. In other words: QEMUMachineInitArgs.cpu_model may be an
easy-to-find redundant variable that should be eventually replaced by
QEMUMachine.cpu_model, but we probably have dozens of local variables
used for the same thing in other code.
diff mbox

Patch

diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index d6f47bf..5327b66 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -334,33 +334,21 @@  static void realview_init(QEMUMachineInitArgs *args,
 
 static void realview_eb_init(QEMUMachineInitArgs *args)
 {
-    if (!args->cpu_model) {
-        args->cpu_model = "arm926";
-    }
     realview_init(args, BOARD_EB);
 }
 
 static void realview_eb_mpcore_init(QEMUMachineInitArgs *args)
 {
-    if (!args->cpu_model) {
-        args->cpu_model = "arm11mpcore";
-    }
     realview_init(args, BOARD_EB_MPCORE);
 }
 
 static void realview_pb_a8_init(QEMUMachineInitArgs *args)
 {
-    if (!args->cpu_model) {
-        args->cpu_model = "cortex-a8";
-    }
     realview_init(args, BOARD_PB_A8);
 }
 
 static void realview_pbx_a9_init(QEMUMachineInitArgs *args)
 {
-    if (!args->cpu_model) {
-        args->cpu_model = "cortex-a9";
-    }
     realview_init(args, BOARD_PBX_A9);
 }
 
@@ -369,6 +357,7 @@  static QEMUMachine realview_eb_machine = {
     .desc = "ARM RealView Emulation Baseboard (ARM926EJ-S)",
     .init = realview_eb_init,
     .block_default_type = IF_SCSI,
+    .cpu_model = "arm926",
     DEFAULT_MACHINE_OPTIONS,
 };
 
@@ -378,6 +367,7 @@  static QEMUMachine realview_eb_mpcore_machine = {
     .init = realview_eb_mpcore_init,
     .block_default_type = IF_SCSI,
     .max_cpus = 4,
+    .cpu_model = "arm11mpcore",
     DEFAULT_MACHINE_OPTIONS,
 };
 
@@ -385,6 +375,7 @@  static QEMUMachine realview_pb_a8_machine = {
     .name = "realview-pb-a8",
     .desc = "ARM RealView Platform Baseboard for Cortex-A8",
     .init = realview_pb_a8_init,
+    .cpu_model = "cortex-a8",
     DEFAULT_MACHINE_OPTIONS,
 };
 
@@ -394,6 +385,7 @@  static QEMUMachine realview_pbx_a9_machine = {
     .init = realview_pbx_a9_init,
     .block_default_type = IF_SCSI,
     .max_cpus = 4,
+    .cpu_model = "cortex-a9",
     DEFAULT_MACHINE_OPTIONS,
 };
 
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index 753757e..b7d0d24 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -185,9 +185,6 @@  static void versatile_init(QEMUMachineInitArgs *args, int board_id)
     int done_smc = 0;
     DriveInfo *dinfo;
 
-    if (!args->cpu_model) {
-        args->cpu_model = "arm926";
-    }
     cpu = cpu_arm_init(args->cpu_model);
     if (!cpu) {
         fprintf(stderr, "Unable to find CPU definition\n");
@@ -362,6 +359,7 @@  static QEMUMachine versatilepb_machine = {
     .desc = "ARM Versatile/PB (ARM926EJ-S)",
     .init = vpb_init,
     .block_default_type = IF_SCSI,
+    .cpu_model = "arm926",
     DEFAULT_MACHINE_OPTIONS,
 };
 
@@ -370,6 +368,7 @@  static QEMUMachine versatileab_machine = {
     .desc = "ARM Versatile/AB (ARM926EJ-S)",
     .init = vab_init,
     .block_default_type = IF_SCSI,
+    .cpu_model = "arm926",
     DEFAULT_MACHINE_OPTIONS,
 };