Commit cba313da5c8ddbe6bba74c9f2b8f6d9e0bc0e723

Authored by Paul Mackerras
Committed by Benjamin Herrenschmidt
1 parent 3339264042

powerpc/powernv: Fix problems in onlining CPUs

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>

Showing 2 changed files with 2 additions and 2 deletions Side-by-side Diff

arch/powerpc/kernel/exceptions-64s.S
... ... @@ -65,7 +65,7 @@
65 65 lbz r0,PACAPROCSTART(r13)
66 66 cmpwi r0,0x80
67 67 bne 1f
68   - li r0,0
  68 + li r0,1
69 69 stb r0,PACAPROCSTART(r13)
70 70 b kvm_start_guest
71 71 1:
arch/powerpc/platforms/powernv/smp.c
... ... @@ -75,7 +75,7 @@
75 75 /* On OPAL v2 the CPU are still spinning inside OPAL itself,
76 76 * get them back now
77 77 */
78   - if (firmware_has_feature(FW_FEATURE_OPALv2)) {
  78 + if (!paca[nr].cpu_start && firmware_has_feature(FW_FEATURE_OPALv2)) {
79 79 pr_devel("OPAL: Starting CPU %d (HW 0x%x)...\n", nr, pcpu);
80 80 rc = opal_start_cpu(pcpu, start_here);
81 81 if (rc != OPAL_SUCCESS)