On Wed, 2016-07-27 at 18:46 +0200, Cédric Le Goater wrote:
> It will be easier to specify a different cpu for other soc derived
> from the ast2400 soc.
> 
> Signed-off-by: Cédric Le Goater <c...@kaod.org>
> ---
>  hw/arm/ast2400.c      | 8 +++++++-
>  hw/arm/palmetto-bmc.c | 1 +
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/arm/ast2400.c b/hw/arm/ast2400.c
> index fa535065f765..7f3517a2c6c6 100644
> --- a/hw/arm/ast2400.c
> +++ b/hw/arm/ast2400.c
> @@ -15,6 +15,7 @@
>  #include "qemu-common.h"
>  #include "cpu.h"
>  #include "exec/address-spaces.h"
> +#include "hw/boards.h"
>  #include "hw/arm/ast2400.h"
>  #include "hw/char/serial.h"
>  #include "qemu/log.h"
> @@ -65,9 +66,14 @@ static const MemoryRegionOps ast2400_io_ops = {
>  
>  static void ast2400_init(Object *obj)
>  {
> +    const char *cpu_model = current_machine->cpu_model;
>      AST2400State *s = AST2400(obj);
>  
> -    s->cpu = cpu_arm_init("arm926");
> +    if (!cpu_model) {
> +        cpu_model = "arm926";
> +    }
> +
> +    s->cpu = cpu_arm_init(cpu_model);

I did a similar thing in the series introducing the AST2400 SoC, and
Peter had a comment on the approach[1]:

    What we do now is not let the user override the cpu model at all;
    presumably this SoC only ever has an ARM926 and it doesn't make
    any sense to have some frankenstein "this SoC but with a different
    CPU in it" config.

Given this is the ast2400_init() it looks to me like we should be
hardwiring the CPU rather than leaving it to the machine to define.

[1] https://patchwork.kernel.org/patch/8325651/ 

>  
>      object_initialize(&s->vic, sizeof(s->vic), TYPE_ASPEED_VIC);
>      object_property_add_child(obj, "vic", OBJECT(&s->vic), NULL);
> diff --git a/hw/arm/palmetto-bmc.c b/hw/arm/palmetto-bmc.c
> index f80a15733864..8a3ff5568575 100644
> --- a/hw/arm/palmetto-bmc.c
> +++ b/hw/arm/palmetto-bmc.c
> @@ -91,6 +91,7 @@ static void aspeed_init(MachineState *machine)
>  
>  static void palmetto_bmc_init(MachineState *machine)
>  {
> +    machine->cpu_model = "arm926";
>      aspeed_init(machine);
>  }
>  

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to