]> git.baikalelectronics.ru Git - kernel.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)
commitc7ddf2ff89b7d439d2882cf44a229c96d2a64b4b
treee0350aa1f8260dc0b25ab7adf3b83d7ab0b46060
parent49e956f0dc01070815414218a2e8daf74cc3f099
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