Example #1
0
static void s390_cpu_realizefn(DeviceState *dev, Error **errp)
{
    CPUState *cs = CPU(dev);
    S390CPUClass *scc = S390_CPU_GET_CLASS(dev);

    s390_cpu_gdb_init(cs);
    qemu_init_vcpu(cs);
#if !defined(CONFIG_USER_ONLY)
    run_on_cpu(cs, s390_do_cpu_full_reset, cs);
#else
    cpu_reset(cs);
#endif

    scc->parent_realize(dev, errp);
}
Example #2
0
File: cpu.c Project: Icenowy/qemu
static void s390_cpu_realizefn(DeviceState *dev, Error **errp)
{
    CPUState *cs = CPU(dev);
    S390CPUClass *scc = S390_CPU_GET_CLASS(dev);
    S390CPU *cpu = S390_CPU(dev);
    CPUS390XState *env = &cpu->env;
    Error *err = NULL;

    /* the model has to be realized before qemu_init_vcpu() due to kvm */
    s390_realize_cpu_model(cs, &err);
    if (err) {
        goto out;
    }

#if !defined(CONFIG_USER_ONLY)
    if (cpu->id >= max_cpus) {
        error_setg(&err, "Unable to add CPU: %" PRIi64
                   ", max allowed: %d", cpu->id, max_cpus - 1);
        goto out;
    }
#endif
    if (cpu_exists(cpu->id)) {
        error_setg(&err, "Unable to add CPU: %" PRIi64
                   ", it already exists", cpu->id);
        goto out;
    }
    if (cpu->id != scc->next_cpu_id) {
        error_setg(&err, "Unable to add CPU: %" PRIi64
                   ", The next available id is %" PRIi64, cpu->id,
                   scc->next_cpu_id);
        goto out;
    }

    cpu_exec_realizefn(cs, &err);
    if (err != NULL) {
        goto out;
    }
    scc->next_cpu_id++;

#if !defined(CONFIG_USER_ONLY)
    qemu_register_reset(s390_cpu_machine_reset_cb, cpu);
#endif
    env->cpu_num = cpu->id;
    s390_cpu_gdb_init(cs);
    qemu_init_vcpu(cs);
#if !defined(CONFIG_USER_ONLY)
    run_on_cpu(cs, s390_do_cpu_full_reset, RUN_ON_CPU_NULL);
#else
    cpu_reset(cs);
#endif

    scc->parent_realize(dev, &err);

#if !defined(CONFIG_USER_ONLY)
    if (dev->hotplugged) {
        raise_irq_cpu_hotplug();
    }
#endif

out:
    error_propagate(errp, err);
}