mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
spapr: Error out when CPU hotplug is attempted on older pseries machines
CPU hotplug and coldplug aren't supported prior to pseries-2.7. Further, earlier machine types don't use CPU core objects at all. These mean that query-hotpluggable-cpus and coldplug on older pseries machines will crash QEMU. It also means that hotpluggable_cpus flag in query-machines will be incorrectly set to true for pseries < 2.7, since it is based on the presence of the query_hotpluggable_cpus hook. - Don't assign the query_hotpluggable_cpus hook for pseries < 2.7 - query_hotpluggable_cpus should therefore never be called on pseries < 2.7, so add an assert - spapr_core_pre_plug() should fail hot/cold plug attempts for pseries < 2.7, since core objects are never used there - spapr_core_plug() should therefore never be called for pseries < 2.7, so add an assert. Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> [dwg: Change from query_hotpluggable_cpus returning NULL for pseries < 2.7 to not being called at all, reword commit message for accuracy] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
8b54a6a6c6
commit
c8721d3599
2 changed files with 12 additions and 14 deletions
|
@ -166,18 +166,11 @@ void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
|
|||
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);
|
||||
|
||||
/*
|
||||
|
@ -225,13 +218,13 @@ void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue