riscv: sifive_e: Support changing CPU type
Allows the CPU to be changed from the default via the -cpu command line option. Signed-off-by: Corey Wharton <coreyw7@fb.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20200313193429.8035-2-coreyw7@fb.com Message-Id: <20200313193429.8035-2-coreyw7@fb.com> [ Changes by AF: - Set "cpu-type" from the machine and not SoC ] Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
e883e9927a
commit
74dbba9b73
@ -123,8 +123,6 @@ static void riscv_sifive_e_soc_init(Object *obj)
|
||||
object_initialize_child(obj, "cpus", &s->cpus,
|
||||
sizeof(s->cpus), TYPE_RISCV_HART_ARRAY,
|
||||
&error_abort, NULL);
|
||||
object_property_set_str(OBJECT(&s->cpus), SIFIVE_E_CPU, "cpu-type",
|
||||
&error_abort);
|
||||
object_property_set_int(OBJECT(&s->cpus), ms->smp.cpus, "num-harts",
|
||||
&error_abort);
|
||||
sysbus_init_child_obj(obj, "riscv.sifive.e.gpio0",
|
||||
@ -141,6 +139,8 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp)
|
||||
SiFiveESoCState *s = RISCV_E_SOC(dev);
|
||||
MemoryRegion *sys_mem = get_system_memory();
|
||||
|
||||
object_property_set_str(OBJECT(&s->cpus), ms->cpu_type, "cpu-type",
|
||||
&error_abort);
|
||||
object_property_set_bool(OBJECT(&s->cpus), true, "realized",
|
||||
&error_abort);
|
||||
|
||||
@ -219,6 +219,7 @@ static void riscv_sifive_e_machine_init(MachineClass *mc)
|
||||
mc->desc = "RISC-V Board compatible with SiFive E SDK";
|
||||
mc->init = riscv_sifive_e_init;
|
||||
mc->max_cpus = 1;
|
||||
mc->default_cpu_type = SIFIVE_E_CPU;
|
||||
}
|
||||
|
||||
DEFINE_MACHINE("sifive_e", riscv_sifive_e_machine_init)
|
||||
|
Loading…
Reference in New Issue
Block a user