xtensa: replace cpu_xtensa_init() with cpu_generic_init()
call xtensa_irq_init() at realize time which makes cpu_xtensa_init() like generic cpu creation function. As result we can replace it with cpu_generic_init() which does the same job, reducing code duplication a bit. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <1503592308-93913-16-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
12f4572ec3
commit
8e36271b92
@ -84,7 +84,7 @@ static void xtensa_sim_init(MachineState *machine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (n = 0; n < smp_cpus; n++) {
|
for (n = 0; n < smp_cpus; n++) {
|
||||||
cpu = cpu_xtensa_init(cpu_model);
|
cpu = XTENSA_CPU(cpu_generic_init(TYPE_XTENSA_CPU, cpu_model));
|
||||||
if (cpu == NULL) {
|
if (cpu == NULL) {
|
||||||
error_report("unable to find CPU definition '%s'",
|
error_report("unable to find CPU definition '%s'",
|
||||||
cpu_model);
|
cpu_model);
|
||||||
|
@ -232,7 +232,7 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (n = 0; n < smp_cpus; n++) {
|
for (n = 0; n < smp_cpus; n++) {
|
||||||
cpu = cpu_xtensa_init(cpu_model);
|
cpu = XTENSA_CPU(cpu_generic_init(TYPE_XTENSA_CPU, cpu_model));
|
||||||
if (cpu == NULL) {
|
if (cpu == NULL) {
|
||||||
error_report("unable to find CPU definition '%s'",
|
error_report("unable to find CPU definition '%s'",
|
||||||
cpu_model);
|
cpu_model);
|
||||||
|
@ -100,9 +100,12 @@ static ObjectClass *xtensa_cpu_class_by_name(const char *cpu_model)
|
|||||||
static void xtensa_cpu_realizefn(DeviceState *dev, Error **errp)
|
static void xtensa_cpu_realizefn(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
CPUState *cs = CPU(dev);
|
CPUState *cs = CPU(dev);
|
||||||
|
XtensaCPU *cpu = XTENSA_CPU(dev);
|
||||||
XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(dev);
|
XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(dev);
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
|
xtensa_irq_init(&cpu->env);
|
||||||
|
|
||||||
cpu_exec_realizefn(cs, &local_err);
|
cpu_exec_realizefn(cs, &local_err);
|
||||||
if (local_err != NULL) {
|
if (local_err != NULL) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
|
@ -475,9 +475,7 @@ void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
|
|||||||
#define XTENSA_DEFAULT_CPU_MODEL "dc232b"
|
#define XTENSA_DEFAULT_CPU_MODEL "dc232b"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XtensaCPU *cpu_xtensa_init(const char *cpu_model);
|
#define cpu_init(cpu_model) cpu_generic_init(TYPE_XTENSA_CPU, cpu_model)
|
||||||
|
|
||||||
#define cpu_init(cpu_model) CPU(cpu_xtensa_init(cpu_model))
|
|
||||||
|
|
||||||
void xtensa_translate_init(void);
|
void xtensa_translate_init(void);
|
||||||
void xtensa_breakpoint_handler(CPUState *cs);
|
void xtensa_breakpoint_handler(CPUState *cs);
|
||||||
|
@ -113,28 +113,6 @@ void xtensa_breakpoint_handler(CPUState *cs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XtensaCPU *cpu_xtensa_init(const char *cpu_model)
|
|
||||||
{
|
|
||||||
ObjectClass *oc;
|
|
||||||
XtensaCPU *cpu;
|
|
||||||
CPUXtensaState *env;
|
|
||||||
|
|
||||||
oc = cpu_class_by_name(TYPE_XTENSA_CPU, cpu_model);
|
|
||||||
if (oc == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
cpu = XTENSA_CPU(object_new(object_class_get_name(oc)));
|
|
||||||
env = &cpu->env;
|
|
||||||
|
|
||||||
xtensa_irq_init(env);
|
|
||||||
|
|
||||||
object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
|
|
||||||
|
|
||||||
return cpu;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void xtensa_cpu_list(FILE *f, fprintf_function cpu_fprintf)
|
void xtensa_cpu_list(FILE *f, fprintf_function cpu_fprintf)
|
||||||
{
|
{
|
||||||
XtensaConfigList *core = xtensa_cores;
|
XtensaConfigList *core = xtensa_cores;
|
||||||
|
Loading…
Reference in New Issue
Block a user