int i;
HotpluggableCPUList *head = NULL;
sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
+ sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
int spapr_max_cores = max_cpus / smp_threads;
+ g_assert(smc->dr_cpu_enabled);
+
for (i = 0; i < spapr_max_cores; i++) {
HotpluggableCPUList *list_item = g_new0(typeof(*list_item), 1);
HotpluggableCPU *cpu_item = g_new0(typeof(*cpu_item), 1);
hc->plug = spapr_machine_device_plug;
hc->unplug = spapr_machine_device_unplug;
mc->cpu_index_to_socket_id = spapr_cpu_index_to_socket_id;
- mc->query_hotpluggable_cpus = spapr_query_hotpluggable_cpus;
+ if (smc->dr_cpu_enabled) {
+ mc->query_hotpluggable_cpus = spapr_query_hotpluggable_cpus;
+ }
smc->dr_lmb_enabled = true;
smc->dr_cpu_enabled = true;
int index = cc->core_id / smp_threads;
int smt = kvmppc_smt_threads();
+ g_assert(smc->dr_cpu_enabled);
+
drc = spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, index * smt);
spapr->cores[index] = OBJECT(dev);
- if (!smc->dr_cpu_enabled) {
- /*
- * This is a cold plugged CPU core but the machine doesn't support
- * DR. So skip the hotplug path ensuring that the core is brought
- * up online with out an associated DR connector.
- */
- return;
- }
-
g_assert(drc);
/*
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);
+ if (!smc->dr_cpu_enabled) {
+ error_setg(&local_err, "CPU hotplug not supported for this machine");
goto out;
}
- if (!smc->dr_cpu_enabled && dev->hotplugged) {
- error_setg(&local_err, "CPU hotplug not supported for this machine");
+ if (strcmp(base_core_type, type)) {
+ error_setg(&local_err, "CPU core type should be %s", base_core_type);
goto out;
}