powerpc/64s: Invalidate ERAT on powersave wakeup for POWER9
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Sat, 24 Jun 2017 17:29:01 +0000 (12:29 -0500)
committerYves-Alexis Perez <corsac@debian.org>
Wed, 21 Feb 2018 15:29:03 +0000 (15:29 +0000)
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>
Gbp-Pq: Topic bugfix/powerpc
Gbp-Pq: Name powerpc-invalidate-erat-on-powersave-wakeup-for-power9.patch

arch/powerpc/kernel/idle_book3s.S

index b350ac5e311144d8839c58f6c0903c0c859eeb65..9adf3ba9ab1d6e769604a2eaba4c7d11513c1cbc 100644 (file)
@@ -375,6 +375,13 @@ _GLOBAL(power9_idle_stop)
  */
 _GLOBAL(pnv_restore_hyp_resource)
 BEGIN_FTR_SECTION
+       /*
+        * Workaround for POWER9, if we lost resources, the ERAT
+        * might have been mixed up and needs flushing.
+        */
+       blt     cr3,1f
+       PPC_INVALIDATE_ERAT
+1:
        ld      r2,PACATOC(r13);
        /*
         * POWER ISA 3. Use PSSCR to determine if we