OSDN Git Service

powerpc/64s: Fix dt_cpu_ftrs to have restore_cpu clear unwanted LPCR bits
authorNicholas Piggin <npiggin@gmail.com>
Thu, 5 Apr 2018 05:50:49 +0000 (15:50 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 5 Apr 2018 06:10:36 +0000 (16:10 +1000)
commita57ac411832384eb93df4bfed2bf644c4089720e
treefbfa8e9eeb925305975b80dc68abd18fc16c8fea
parenta67cc594dffd29cfe33fbee40932c9d04197ab2f
powerpc/64s: Fix dt_cpu_ftrs to have restore_cpu clear unwanted LPCR bits

Presently the dt_cpu_ftrs restore_cpu will only add bits to the LPCR
for secondaries, but some bits must be removed (e.g., UPRT for HPT).
Not clearing these bits on secondaries causes checkstops when booting
with disable_radix.

restore_cpu can not just set LPCR, because it is also called by the
idle wakeup code which relies on opal_slw_set_reg to restore the value
of LPCR, at least on P8 which does not save LPCR to stack in the idle
code.

Fix this by including a mask of bits to clear from LPCR as well, which
is used by restore_cpu.

This is a little messy now, but it's a minimal fix that can be
backported.  Longer term, the idle SPR save/restore code can be
reworked to completely avoid calls to restore_cpu, then restore_cpu
would be able to unconditionally set LPCR to match boot processor
environment.

Fixes: 5a61ef74f269f ("powerpc/64s: Support new device tree binding for discovering CPU features")
Cc: stable@vger.kernel.org # v4.12+
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/dt_cpu_ftrs.c