@@ -41,12 +41,10 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)
DeviceState *scudev, *gtimerdev, *mptimerdev, *wdtdev;
SysBusDevice *scubusdev, *gtimerbusdev, *mptimerbusdev, *wdtbusdev;
Error *local_err = NULL;
- CPUState *cpu0;
- Object *cpuobj;
- cpu0 = qemu_get_cpu(0);
- cpuobj = OBJECT(cpu0);
- if (strcmp(object_get_typename(cpuobj), ARM_CPU_TYPE_NAME("cortex-a9"))) {
+ if (!c->cpu_type) {
+ qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-a9"));
+ } else if (strcmp(c->cpu_type, ARM_CPU_TYPE_NAME("cortex-a9"))) {
/* We might allow Cortex-A5 once we model it */
error_setg(errp,
"Cortex-A9MPCore peripheral can only use Cortex-A9 CPU");
@@ -57,6 +57,11 @@ static void cortex_mpcore_priv_realize(DeviceState *dev, Error **errp)
return;
}
+ if (!s->cpu_type) {
+ error_setg(errp, "'cpu-type' property is not set");
+ return;
+ }
+
qdev_prop_set_uint32(gicdev, "num-cpu", s->num_cores);
qdev_prop_set_uint32(gicdev, "num-irq", s->gic_spi_num);
if (k->gic_priority_bits) {
@@ -85,9 +90,6 @@ static void cortex_mpcore_priv_realize(DeviceState *dev, Error **errp)
/* CPU */
- if (!s->cpu_type) {
- return;
- }
for (int i = 0; i < s->num_cores; i++) {
Object *cpuobj;
Now that all boards set the "cpu-type" property, the legacy code can be removed. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/cpu/a9mpcore.c | 8 +++----- hw/cpu/cortex_mpcore.c | 8 +++++--- 2 files changed, 8 insertions(+), 8 deletions(-)