summaryrefslogtreecommitdiffstats
path: root/hw/ppc
diff options
context:
space:
mode:
authorPeter Maydell2016-07-18 12:24:15 +0200
committerPeter Maydell2016-07-18 12:24:15 +0200
commit3913d3707e3debfbf0d2d014a1a793394993b088 (patch)
tree1d58dfdc0c62d6c588f731163341f43cb90f1a3c /hw/ppc
parentMerge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-signed' int... (diff)
parentppc: Yet another fix for the huge page support detection mechanism (diff)
downloadqemu-3913d3707e3debfbf0d2d014a1a793394993b088.tar.gz
qemu-3913d3707e3debfbf0d2d014a1a793394993b088.tar.xz
qemu-3913d3707e3debfbf0d2d014a1a793394993b088.zip
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.7-20160718' into staging
ppc patch queue 2016-07-18 Here's what ought to be the final ppc pull request before the 2.7 hard freeze. This set contains a rework of the DBDMA device for Mac platforms, and some assorted cleanups and bugfixes. # gpg: Signature made Mon 18 Jul 2016 05:35:27 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-20160718: ppc: Yet another fix for the huge page support detection mechanism target-ppc: fix left shift overflow in hpte_page_shift ppc/mmu-hash64: Remove duplicated #include statement ppc: abort if compat property contains an unknown value spapr: Ensure CPU cores are added contiguously and removed in LIFO order vfio/spapr: Remove stale ioctl() call ppc: Fix support for odd MSR combinations dbdma: reset io->processing flag for unassigned DBDMA channel rw accesses dbdma: set FLUSH bit upon reception of flush command for unassigned DBDMA channels dbdma: fix load_word/store_word value endianness dbdma: fix endian of DBDMA_CMDPTR_LO during branch dbdma: add per-channel debugging enabled via DEBUG_DBDMA_CHANMASK dbdma: always define DBDMA_DPRINTF and enable debug with DEBUG_DBDMA spapr: fix core unplug crash Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/ppc')
-rw-r--r--hw/ppc/spapr_cpu_core.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 9347f0741e..4bfc96bd5a 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -126,14 +126,23 @@ static void spapr_core_release(DeviceState *dev, void *opaque)
void spapr_core_unplug(HotplugHandler *hotplug_dev, DeviceState *dev,
Error **errp)
{
- sPAPRCPUCore *core = SPAPR_CPU_CORE(OBJECT(dev));
- PowerPCCPU *cpu = POWERPC_CPU(core->threads);
- int id = ppc_get_vcpu_dt_id(cpu);
+ sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev));
+ CPUCore *cc = CPU_CORE(dev);
sPAPRDRConnector *drc =
- spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, id);
+ spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, cc->core_id);
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);
+ return;
+ }
+ }
g_assert(drc);
drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
@@ -216,7 +225,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;
+ int index, i;
int smt = kvmppc_smt_threads();
Error *local_err = NULL;
CPUCore *cc = CPU_CORE(dev);
@@ -254,6 +263,14 @@ 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 * smt);
+ goto out;
+ }
+ }
+
out:
g_free(base_core_type);
error_propagate(errp, local_err);