]> rtime.felk.cvut.cz Git - linux-imx.git/commit
powerpc: Fix context switch DSCR on POWER8
authorMichael Neuling <mikey@neuling.org>
Fri, 9 Aug 2013 07:29:29 +0000 (17:29 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 9 Aug 2013 08:07:05 +0000 (18:07 +1000)
commit2517617e0de65f8f7cfe75cae745d06b1fa98586
treee0350aa1f8260dc0b25ab7adf3b83d7ab0b46060
parent74e400cee6c0266ba2d940ed78d981f1e24a8167
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>
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/traps.c