Message ID | 1469638018-17590-4-git-send-email-clg@kaod.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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 <clg@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); > } >
On 07/28/2016 04:37 AM, Andrew Jeffery wrote: > 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. ok. so if we consider that the platform did the setting, we can reduce the patch to : - s->cpu = cpu_arm_init("arm926"); + s->cpu = cpu_arm_init(current_machine->cpu_model); Cheers, C.
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); 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); }
It will be easier to specify a different cpu for other soc derived from the ast2400 soc. Signed-off-by: Cédric Le Goater <clg@kaod.org> --- hw/arm/ast2400.c | 8 +++++++- hw/arm/palmetto-bmc.c | 1 + 2 files changed, 8 insertions(+), 1 deletion(-)