aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-11-05 00:33:22 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-11-05 22:13:53 -0500
commit0c4888ef1d8a8b82c29075ce7e257ff795af15c7 (patch)
tree22f37dca43e49a79236b1279511778a1e8d12c61 /arch/powerpc/kernel
parent36954dc78d8a1dcd4780cf4bd0fc6292791821b9 (diff)
powerpc: Fix fatal SLB miss when restoring PPR
When restoring the PPR value, we incorrectly access the thread structure at a time where MSR:RI is clear, which means we cannot recover from nested faults. However the thread structure isn't covered by the "bolted" SLB entries and thus accessing can fault. This fixes it by splitting the code so that the PPR value is loaded into a GPR before MSR:RI is cleared. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/entry_64.S10
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 12679cd43e0c..bbfb0294b354 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -818,6 +818,12 @@ fast_exception_return:
818 andi. r0,r3,MSR_RI 818 andi. r0,r3,MSR_RI
819 beq- unrecov_restore 819 beq- unrecov_restore
820 820
821 /* Load PPR from thread struct before we clear MSR:RI */
822BEGIN_FTR_SECTION
823 ld r2,PACACURRENT(r13)
824 ld r2,TASKTHREADPPR(r2)
825END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
826
821 /* 827 /*
822 * Clear RI before restoring r13. If we are returning to 828 * Clear RI before restoring r13. If we are returning to
823 * userspace and we take an exception after restoring r13, 829 * userspace and we take an exception after restoring r13,
@@ -838,8 +844,10 @@ fast_exception_return:
838 */ 844 */
839 andi. r0,r3,MSR_PR 845 andi. r0,r3,MSR_PR
840 beq 1f 846 beq 1f
847BEGIN_FTR_SECTION
848 mtspr SPRN_PPR,r2 /* Restore PPR */
849END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
841 ACCOUNT_CPU_USER_EXIT(r2, r4) 850 ACCOUNT_CPU_USER_EXIT(r2, r4)
842 RESTORE_PPR(r2, r4)
843 REST_GPR(13, r1) 851 REST_GPR(13, r1)
8441: 8521:
845 mtspr SPRN_SRR1,r3 853 mtspr SPRN_SRR1,r3