powerpc/powernv: Fix problems in onlining CPUs
authorPaul Mackerras <paulus@samba.org>
Mon, 5 Dec 2011 19:35:32 +0000 (19:35 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 8 Dec 2011 03:22:53 +0000 (14:22 +1100)
At present, on the powernv platform, if you off-line a CPU that was
online, and then try to on-line it again, the kernel generates a
warning message "OPAL Error -1 starting CPU n".  Furthermore, if the
CPU is a secondary thread that was used by KVM while it was off-line,
the CPU fails to come online.

The first problem is fixed by only calling OPAL to start the CPU the
first time it is on-lined, as indicated by the cpu_start field of its
PACA being zero.  The second problem is fixed by restoring the
cpu_start field to 1 instead of 0 when using the CPU within KVM.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/exceptions-64s.S
arch/powerpc/platforms/powernv/smp.c

index cf9c69b9189cb831261a8d8ca0c27d96aacfb89f..d4be7bb3dbdfdffd5d62d76aa96860392040a305 100644 (file)
@@ -65,7 +65,7 @@ BEGIN_FTR_SECTION
        lbz     r0,PACAPROCSTART(r13)
        cmpwi   r0,0x80
        bne     1f
-       li      r0,0
+       li      r0,1
        stb     r0,PACAPROCSTART(r13)
        b       kvm_start_guest
 1:
index e877366852439e915a63047c3f459e7bf2d0cfed..17210c526c523c823ba949e963a6c47158189bdd 100644 (file)
@@ -75,7 +75,7 @@ int __devinit pnv_smp_kick_cpu(int nr)
        /* On OPAL v2 the CPU are still spinning inside OPAL itself,
         * get them back now
         */
-       if (firmware_has_feature(FW_FEATURE_OPALv2)) {
+       if (!paca[nr].cpu_start && firmware_has_feature(FW_FEATURE_OPALv2)) {
                pr_devel("OPAL: Starting CPU %d (HW 0x%x)...\n", nr, pcpu);
                rc = opal_start_cpu(pcpu, start_here);
                if (rc != OPAL_SUCCESS)