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);
 
     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);
 }
 
-- 
2.1.4


Reply via email to