• Michael Neuling's avatar
    powerpc: Fix context switch DSCR on POWER8 · 2517617e
    Michael Neuling authored
    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: default avatarMichael Neuling <mikey@neuling.org>
    Cc: <stable@vger.kernel.org> [v3.10]
    Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    2517617e
entry_64.S 30.2 KB