Commit dd9a8c5a authored by Michael Neuling's avatar Michael Neuling Committed by Paul Mackerras

powerpc/tm: Fix HFSCR bit for no suspend case

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: default avatarMichael Neuling <mikey@neuling.org>
Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
parent 11da3a7f
...@@ -243,13 +243,19 @@ static void cpu_ready_for_interrupts(void) ...@@ -243,13 +243,19 @@ static void cpu_ready_for_interrupts(void)
} }
/* /*
* Fixup HFSCR:TM based on CPU features. The bit is set by our * Set HFSCR:TM based on CPU features:
* early asm init because at that point we haven't updated our * In the special case of TM no suspend (P9N DD2.1), Linux is
* CPU features from firmware and device-tree. Here we have, * told TM is off via the dt-ftrs but told to (partially) use
* so let's do it. * 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
if (cpu_has_feature(CPU_FTR_HVMODE) && !cpu_has_feature(CPU_FTR_TM_COMP)) * no suspend case.
*/
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); mtspr(SPRN_HFSCR, mfspr(SPRN_HFSCR) & ~HFSCR_TM);
}
/* Set IR and DR in PACA MSR */ /* Set IR and DR in PACA MSR */
get_paca()->kernel_msr = MSR_KERNEL; get_paca()->kernel_msr = MSR_KERNEL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment