aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/entry_64.S
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2013-08-09 03:29:29 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-08-09 04:07:05 -0400
commit2517617e0de65f8f7cfe75cae745d06b1fa98586 (patch)
treee0350aa1f8260dc0b25ab7adf3b83d7ab0b46060 /arch/powerpc/kernel/entry_64.S
parent74e400cee6c0266ba2d940ed78d981f1e24a8167 (diff)
powerpc: Fix context switch DSCR on POWER8
POWER8 allows the DSCR to be accessed directly from userspace via a new SPR number 0x3 (Rather than 0x11. DSCR SPR number 0x11 is still used on POWER8 but like POWER7, is only accessible in HV and OS modes). Currently, we allow this by setting H/FSCR DSCR bit on boot. Unfortunately this doesn't work, as the kernel needs to see the DSCR change so that it knows to no longer restore the system wide version of DSCR on context switch (ie. to set thread.dscr_inherit). This clears the H/FSCR DSCR bit initially. If a process then accesses the DSCR (via SPR 0x3), it'll trap into the kernel where we set thread.dscr_inherit in facility_unavailable_exception(). We also change _switch() so that we set or clear the H/FSCR DSCR bit based on the thread.dscr_inherit. Signed-off-by: Michael Neuling <mikey@neuling.org> Cc: <stable@vger.kernel.org> [v3.10] Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/entry_64.S')
-rw-r--r--arch/powerpc/kernel/entry_64.S27
1 files changed, 26 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index ab15b8d057ad..4674fe647ad7 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -584,9 +584,34 @@ BEGIN_FTR_SECTION
584 ld r7,DSCR_DEFAULT@toc(2) 584 ld r7,DSCR_DEFAULT@toc(2)
585 ld r0,THREAD_DSCR(r4) 585 ld r0,THREAD_DSCR(r4)
586 cmpwi r6,0 586 cmpwi r6,0
587 li r8, FSCR_DSCR
587 bne 1f 588 bne 1f
588 ld r0,0(r7) 589 ld r0,0(r7)
5891: cmpd r0,r25 590 b 3f
5911:
592 BEGIN_FTR_SECTION_NESTED(70)
593 mfspr r6, SPRN_FSCR
594 or r6, r6, r8
595 mtspr SPRN_FSCR, r6
596 BEGIN_FTR_SECTION_NESTED(69)
597 mfspr r6, SPRN_HFSCR
598 or r6, r6, r8
599 mtspr SPRN_HFSCR, r6
600 END_FTR_SECTION_NESTED(CPU_FTR_HVMODE, CPU_FTR_HVMODE, 69)
601 b 4f
602 END_FTR_SECTION_NESTED(CPU_FTR_ARCH_207S, CPU_FTR_ARCH_207S, 70)
6033:
604 BEGIN_FTR_SECTION_NESTED(70)
605 mfspr r6, SPRN_FSCR
606 andc r6, r6, r8
607 mtspr SPRN_FSCR, r6
608 BEGIN_FTR_SECTION_NESTED(69)
609 mfspr r6, SPRN_HFSCR
610 andc r6, r6, r8
611 mtspr SPRN_HFSCR, r6
612 END_FTR_SECTION_NESTED(CPU_FTR_HVMODE, CPU_FTR_HVMODE, 69)
613 END_FTR_SECTION_NESTED(CPU_FTR_ARCH_207S, CPU_FTR_ARCH_207S, 70)
6144: cmpd r0,r25
590 beq 2f 615 beq 2f
591 mtspr SPRN_DSCR,r0 616 mtspr SPRN_DSCR,r0
5922: 6172: