void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,

                         Error **errp)

{

    MachineState *machine = MACHINE(OBJECT(hotplug_dev));

    sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(OBJECT(hotplug_dev));

    sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));

    int spapr_max_cores = max_cpus / smp_threads;

    int index;

    Error *local_err = NULL;

    CPUCore *cc = CPU_CORE(dev);

    char *base_core_type = spapr_get_cpu_core_type(machine->cpu_model);

    const char *type = object_get_typename(OBJECT(dev));



    if (strcmp(base_core_type, type)) {

        error_setg(&local_err, "CPU core type should be %s", base_core_type);

        goto out;

    }



    if (!smc->dr_cpu_enabled && dev->hotplugged) {

        error_setg(&local_err, "CPU hotplug not supported for this machine");

        goto out;

    }



    if (cc->nr_threads != smp_threads) {

        error_setg(&local_err, "threads must be %d", smp_threads);

        goto out;

    }



    if (cc->core_id % smp_threads) {

        error_setg(&local_err, "invalid core id %d\n", cc->core_id);

        goto out;

    }



    index = cc->core_id / smp_threads;

    if (index < 0 || index >= spapr_max_cores) {

        error_setg(&local_err, "core id %d out of range", cc->core_id);

        goto out;

    }



    if (spapr->cores[index]) {

        error_setg(&local_err, "core %d already populated", cc->core_id);

        goto out;

    }



out:

    g_free(base_core_type);

    error_propagate(errp, local_err);

}

void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,

                         Error **errp)

{

    MachineState *machine = MACHINE(OBJECT(hotplug_dev));

    sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(OBJECT(hotplug_dev));

    sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));

    int spapr_max_cores = max_cpus / smp_threads;

    int index;

    Error *local_err = NULL;

    CPUCore *cc = CPU_CORE(dev);

    char *base_core_type = spapr_get_cpu_core_type(machine->cpu_model);

    const char *type = object_get_typename(OBJECT(dev));



    if (strcmp(base_core_type, type)) {

        error_setg(&local_err, "CPU core type should be %s", base_core_type);

        goto out;

    }



    if (!smc->dr_cpu_enabled && dev->hotplugged) {

        error_setg(&local_err, "CPU hotplug not supported for this machine");

        goto out;

    }



    if (cc->nr_threads != smp_threads) {

        error_setg(&local_err, "threads must be %d", smp_threads);

        goto out;

    }



    if (cc->core_id % smp_threads) {

        error_setg(&local_err, "invalid core id %d\n", cc->core_id);

        goto out;

    }



    index = cc->core_id / smp_threads;

    if (index < 0 || index >= spapr_max_cores) {

        error_setg(&local_err, "core id %d out of range", cc->core_id);

        goto out;

    }



    if (spapr->cores[index]) {

        error_setg(&local_err, "core %d already populated", cc->core_id);

        goto out;

    }



out:

    g_free(base_core_type);

    error_propagate(errp, local_err);

}

    if (strcmp(base_core_type, type)) {         error_setg(&local_err, "CPU core type should be %s", base_core_type);     if (!smc->dr_cpu_enabled && dev->hotplugged) {         error_setg(&local_err, "CPU hotplug not supported for this machine");
void FUNC_0(HotplugHandler *VAR_0, DeviceState *VAR_1,

                         Error **VAR_2)

{

    MachineState *machine = MACHINE(OBJECT(VAR_0));

    sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(OBJECT(VAR_0));

    sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(VAR_0));

    int VAR_3 = max_cpus / smp_threads;

    int VAR_4;

    Error *local_err = NULL;

    CPUCore *cc = CPU_CORE(VAR_1);

    char *VAR_5 = spapr_get_cpu_core_type(machine->cpu_model);

    const char *VAR_6 = object_get_typename(OBJECT(VAR_1));



    if (strcmp(VAR_5, VAR_6)) {

        error_setg(&local_err, "CPU core VAR_6 should be %s", VAR_5);

        goto out;

    }



    if (!smc->dr_cpu_enabled && VAR_1->hotplugged) {

        error_setg(&local_err, "CPU hotplug not supported for this machine");

        goto out;

    }



    if (cc->nr_threads != smp_threads) {

        error_setg(&local_err, "threads must be %d", smp_threads);

        goto out;

    }



    if (cc->core_id % smp_threads) {

        error_setg(&local_err, "invalid core id %d\n", cc->core_id);

        goto out;

    }



    VAR_4 = cc->core_id / smp_threads;

    if (VAR_4 < 0 || VAR_4 >= VAR_3) {

        error_setg(&local_err, "core id %d out of range", cc->core_id);

        goto out;

    }



    if (spapr->cores[VAR_4]) {

        error_setg(&local_err, "core %d already populated", cc->core_id);

        goto out;

    }



out:

    g_free(VAR_5);

    error_propagate(VAR_2, local_err);

}

void FUNC_0(HotplugHandler *VAR_0, DeviceState *VAR_1,
Error **VAR_2)
{ MachineState *machine = MACHINE(OBJECT(VAR_0)); sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(OBJECT(VAR_0)); sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(VAR_0)); int VAR_3 = max_cpus / smp_threads; int VAR_4; Error *local_err = NULL; CPUCore *cc = CPU_CORE(VAR_1); char *VAR_5 = spapr_get_cpu_core_type(machine->cpu_model); const char *VAR_6 = object_get_typename(OBJECT(VAR_1)); if (strcmp(VAR_5, VAR_6)) { error_setg(&local_err, "CPU core VAR_6 should be %s", VAR_5); goto out; } if (!smc->dr_cpu_enabled && VAR_1->hotplugged) { error_setg(&local_err, "CPU hotplug not supported for this machine"); goto out; } if (cc->nr_threads != smp_threads) { error_setg(&local_err, "threads must be %d", smp_threads); goto out; } if (cc->core_id % smp_threads) { error_setg(&local_err, "invalid core id %d\n", cc->core_id); goto out; } VAR_4 = cc->core_id / smp_threads; if (VAR_4 < 0 || VAR_4 >= VAR_3) { error_setg(&local_err, "core id %d out of range", cc->core_id); goto out; } if (spapr->cores[VAR_4]) { error_setg(&local_err, "core %d already populated", cc->core_id); goto out; } out:
g_free(VAR_5); error_propagate(VAR_2, local_err); }