aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-07-29 12:37:08 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-07-29 12:37:08 +0100
commitdf2c35902e315c772ca97ca29cb6398ddc4a5861 (patch)
tree419e5f5968d815ff7275d83578e9626dcff19245 /hw
parentcbe81c6331d875750720c021492ca74e312f9cb2 (diff)
parent059ce0f00af0124740bcb9991d160f93c92ae174 (diff)
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.7-20160729' into staging
ppc patch queue 2016-07-29 Here are the current pending ppc and spapr related patches for qemu-2.7. Given the freeze status, these are all bugfixes, with two exceptions: * There's some final rework of the vcpu hotplug model. Specifically we add spapr specific code on the generic basis Igor established to make cpu_index stable for pseries-2.7 and later machine types. - This allows us to remove the limitation that cpu cores had to be inserted in linear order, and removed in LIFO order. - This is worth merging this late in 2.7 because it will avoid considerable future grief with management layers needing to discover whether out-of-order hotplug is possible, amongst other things. - For now we do add a constraint that the initial cpu cannot be unplugged. * We add two extra testcases to make check, for postcopy and drive_del on ppc64. - Not strictly bugfixes, but safe, because they don't affect the actual code, and increase test coverage. # gpg: Signature made Fri 29 Jul 2016 05:50:02 BST # gpg: using RSA key 0x6C38CACA20D9B392 # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" # gpg: aka "David Gibson (Red Hat) <dgibson@redhat.com>" # gpg: aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 75F4 6586 AE61 A66C C44E 87DC 6C38 CACA 20D9 B392 * remotes/dgibson/tags/ppc-for-2.7-20160729: tests: add drive_del-test to ppc/ppc64 spapr: Prevent boot CPU core removal ppc: Fix fault PC reporting for lve*/stve* VMX instructions test: port postcopy test to ppc64 Revert "spapr: Ensure CPU cores are added contiguously and removed in LIFO order" spapr: init CPUState->cpu_index with index relative to core-id Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/ppc/spapr_cpu_core.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index c04aaa47d7..ec81ee6088 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -125,7 +125,6 @@ static void spapr_core_release(DeviceState *dev, void *opaque)
void spapr_core_unplug(HotplugHandler *hotplug_dev, DeviceState *dev,
Error **errp)
{
- sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));
CPUCore *cc = CPU_CORE(dev);
int smt = kvmppc_smt_threads();
int index = cc->core_id / smp_threads;
@@ -133,16 +132,12 @@ void spapr_core_unplug(HotplugHandler *hotplug_dev, DeviceState *dev,
spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, index * smt);
sPAPRDRConnectorClass *drck;
Error *local_err = NULL;
- 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 * smp_threads);
- return;
- }
+ if (index == 0) {
+ error_setg(errp, "Boot CPU core may not be unplugged");
+ return;
}
+
g_assert(drc);
drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
@@ -224,7 +219,7 @@ void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *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, i;
+ int index;
Error *local_err = NULL;
CPUCore *cc = CPU_CORE(dev);
char *base_core_type = spapr_get_cpu_core_type(machine->cpu_model);
@@ -261,14 +256,6 @@ void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
goto out;
}
- for (i = 0; i < index; i++) {
- if (!spapr->cores[i]) {
- error_setg(&local_err, "core-id %d should be added first",
- i * smp_threads);
- goto out;
- }
- }
-
out:
g_free(base_core_type);
error_propagate(errp, local_err);
@@ -307,9 +294,13 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
sc->threads = g_malloc0(size * cc->nr_threads);
for (i = 0; i < cc->nr_threads; i++) {
char id[32];
+ CPUState *cs;
+
obj = sc->threads + i * size;
object_initialize(obj, size, typename);
+ cs = CPU(obj);
+ cs->cpu_index = cc->core_id + i;
snprintf(id, sizeof(id), "thread[%d]", i);
object_property_add_child(OBJECT(sc), id, obj, &local_err);
if (local_err) {