spapr->cores = g_new0(Object *, spapr_max_cores);
for (i = 0; i < spapr_max_cores; i++) {
- int core_dt_id = i * smt;
+ int core_id = i * smp_threads;
sPAPRDRConnector *drc =
spapr_dr_connector_new(OBJECT(spapr),
- SPAPR_DR_CONNECTOR_TYPE_CPU, core_dt_id);
+ SPAPR_DR_CONNECTOR_TYPE_CPU,
+ (core_id / smp_threads) * smt);
qemu_register_reset(spapr_drc_reset, drc);
core = object_new(type);
object_property_set_int(core, smp_threads, "nr-threads",
&error_fatal);
- object_property_set_int(core, core_dt_id, CPU_CORE_PROP_CORE_ID,
+ object_property_set_int(core, core_id, CPU_CORE_PROP_CORE_ID,
&error_fatal);
object_property_set_bool(core, true, "realized", &error_fatal);
}
HotpluggableCPUList *head = NULL;
sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
int spapr_max_cores = max_cpus / smp_threads;
- int smt = kvmppc_smt_threads();
for (i = 0; i < spapr_max_cores; i++) {
HotpluggableCPUList *list_item = g_new0(typeof(*list_item), 1);
cpu_item->type = spapr_get_cpu_core_type(machine->cpu_model);
cpu_item->vcpus_count = smp_threads;
cpu_props->has_core_id = true;
- cpu_props->core_id = i * smt;
+ cpu_props->core_id = i * smp_threads;
/* TODO: add 'has_node/node' here to describe
to which node core belongs */
size_t size = object_type_get_instance_size(typename);
sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
CPUCore *cc = CPU_CORE(dev);
- int smt = kvmppc_smt_threads();
int i;
for (i = 0; i < cc->nr_threads; i++) {
object_unparent(obj);
}
- spapr->cores[cc->core_id / smt] = NULL;
+ spapr->cores[cc->core_id / smp_threads] = NULL;
g_free(sc->threads);
object_unparent(OBJECT(dev));
{
sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));
CPUCore *cc = CPU_CORE(dev);
+ int smt = kvmppc_smt_threads();
+ int index = cc->core_id / smp_threads;
sPAPRDRConnector *drc =
- spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, cc->core_id);
+ spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, index * smt);
sPAPRDRConnectorClass *drck;
Error *local_err = NULL;
- int smt = kvmppc_smt_threads();
- int index = cc->core_id / smt;
int spapr_max_cores = max_cpus / smp_threads;
int i;
for (i = spapr_max_cores - 1; i > index; i--) {
if (spapr->cores[i]) {
- error_setg(errp, "core-id %d should be removed first", i * smt);
+ error_setg(errp, "core-id %d should be removed first",
+ i * smp_threads);
return;
}
}
Error *local_err = NULL;
void *fdt = NULL;
int fdt_offset = 0;
- int index;
+ int index = cc->core_id / smp_threads;
int smt = kvmppc_smt_threads();
- drc = spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, cc->core_id);
- index = cc->core_id / smt;
+ drc = spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, index * smt);
spapr->cores[index] = OBJECT(dev);
if (!smc->dr_cpu_enabled) {
sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));
int spapr_max_cores = max_cpus / smp_threads;
int index, i;
- int smt = kvmppc_smt_threads();
Error *local_err = NULL;
CPUCore *cc = CPU_CORE(dev);
char *base_core_type = spapr_get_cpu_core_type(machine->cpu_model);
goto out;
}
- if (cc->core_id % smt) {
+ if (cc->core_id % smp_threads) {
error_setg(&local_err, "invalid core id %d\n", cc->core_id);
goto out;
}
- index = cc->core_id / smt;
+ 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;
for (i = 0; i < index; i++) {
if (!spapr->cores[i]) {
error_setg(&local_err, "core-id %d should be added first",
- i * smt);
+ i * smp_threads);
goto out;
}
}