]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
powerpc/64s: Invalidate ERAT on powersave wakeup for POWER9
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 27 Jun 2017 16:45:27 +0000 (13:45 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Tue, 11 Jul 2017 16:46:34 +0000 (13:46 -0300)
BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1700521
On POWER9 the ERAT may be incorrect on wakeup from some stop states
that lose state. This causes random segvs and illegal instructions
when these stop states are enabled.

This patch invalidates the ERAT on wakeup on POWER9 to prevent this
from causing a problem.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Merge comment change with upstream changes]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(backported from: ba6d334ac230065243a92bb7cb3fd6a5f6a7f8ac)
Signed-off-by: Breno Leitao <leitao@debian.org>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
arch/powerpc/kernel/exceptions-64s.S
arch/powerpc/kernel/idle_book3s.S

index f2a18432253c4855c3a35b06e5c9a1b07d80482e..79318275e507d04cb11d7621379c0a1cc989f6b4 100644 (file)
@@ -99,7 +99,11 @@ EXC_VIRT_NONE(0x4000, 0x4100)
 #ifdef CONFIG_PPC_P7_NAP
        /*
         * If running native on arch 2.06 or later, check if we are waking up
-        * from nap/sleep/winkle, and branch to idle handler.
+        * from nap/sleep/winkle, and branch to idle handler. This tests SRR1
+        * bits 46:47. A non-0 value indicates that we are coming from a power
+        * saving state. The idle wakeup handler initially runs in real mode,
+        * but we branch to the 0xc000... address so we can turn on relocation
+        * with mtmsr.
         */
 #define IDLETEST(n)                                                    \
        BEGIN_FTR_SECTION ;                                             \
index 67ba6a66fed5c46cd85708d09438f687d65866e3..fb762ee5ac6f719249770461c81c93ed8a38c868 100644 (file)
@@ -432,6 +432,13 @@ BEGIN_FTR_SECTION_NESTED(70)
 FTR_SECTION_ELSE_NESTED(70)
        ld      r2, PACATOC(r13)
 ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_POWER9_DD1, 70)
+       /*
+        * Workaround for POWER9, if we lost resources, the ERAT
+        * might have been mixed up and needs flushing.
+        */
+       blt     cr3,1f
+       PPC_INVALIDATE_ERAT
+1:
        /*
         * POWER ISA 3. Use PSSCR to determine if we
         * are waking up from deep idle state