]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
powerpc/tm: Fix HFSCR bit for no suspend case
authorMichael Neuling <mikey@neuling.org>
Tue, 11 Sep 2018 03:07:56 +0000 (13:07 +1000)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:58:24 +0000 (19:58 -0600)
BugLink: https://bugs.launchpad.net/bugs/1836802
commit dd9a8c5a87395b6f05552c3b44e42fdc95760552 upstream.

Currently on P9N DD2.1 we end up taking infinite TM facility
unavailable exceptions on the first TM usage by userspace.

In the special case of TM no suspend (P9N DD2.1), Linux is told TM is
off via CPU dt-ftrs but told to (partially) use it via
OPAL_REINIT_CPUS_TM_SUSPEND_DISABLED. So HFSCR[TM] will be off from
dt-ftrs but we need to turn it on for the no suspend case.

This patch fixes this by enabling HFSCR TM in this case.

Cc: stable@vger.kernel.org # 4.15+
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
arch/powerpc/kernel/setup_64.c

index fe30b2d8e280fb60c24507c2208875b6e75068f4..6ce25778cf04b543366822d3b07cda1fe3b41dfa 100644 (file)
@@ -241,13 +241,19 @@ static void cpu_ready_for_interrupts(void)
        }
 
        /*
-        * Fixup HFSCR:TM based on CPU features. The bit is set by our
-        * early asm init because at that point we haven't updated our
-        * CPU features from firmware and device-tree. Here we have,
-        * so let's do it.
+        * Set HFSCR:TM based on CPU features:
+        * In the special case of TM no suspend (P9N DD2.1), Linux is
+        * told TM is off via the dt-ftrs but told to (partially) use
+        * it via OPAL_REINIT_CPUS_TM_SUSPEND_DISABLED. So HFSCR[TM]
+        * will be off from dt-ftrs but we need to turn it on for the
+        * no suspend case.
         */
-       if (cpu_has_feature(CPU_FTR_HVMODE) && !cpu_has_feature(CPU_FTR_TM_COMP))
-               mtspr(SPRN_HFSCR, mfspr(SPRN_HFSCR) & ~HFSCR_TM);
+       if (cpu_has_feature(CPU_FTR_HVMODE)) {
+               if (cpu_has_feature(CPU_FTR_TM_COMP))
+                       mtspr(SPRN_HFSCR, mfspr(SPRN_HFSCR) | HFSCR_TM);
+               else
+                       mtspr(SPRN_HFSCR, mfspr(SPRN_HFSCR) & ~HFSCR_TM);
+       }
 
        /* Set IR and DR in PACA MSR */
        get_paca()->kernel_msr = MSR_KERNEL;