Skip to content

Commit 993e3d9

Browse files
committed
powerpc/64s: Don't let DT CPU features set FSCR_DSCR
The device tree CPU features binding includes FSCR bit numbers which Linux is instructed to set by firmware. Whether that's a good idea or not, in the case of the DSCR the Linux implementation has a hard requirement that the FSCR_DSCR bit not be set by default. We use it to track when a process reads/writes to DSCR, so it must be clear to begin with. So if firmware tells us to set FSCR_DSCR we must ignore it. Currently this does not cause a bug in our DSCR handling because the value of FSCR that the device tree CPU features code establishes is only used by swapper. All other tasks use the value hard coded in init_task.thread.fscr. However we'd like to fix that in a future commit, at which point this will become necessary. Fixes: 5a61ef7 ("powerpc/64s: Support new device tree binding for discovering CPU features") Cc: [email protected] # v4.12+ Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0828137 commit 993e3d9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

arch/powerpc/kernel/dt_cpu_ftrs.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,14 @@ static int __init feat_enable_dscr(struct dt_cpu_feature *f)
346346
{
347347
u64 lpcr;
348348

349+
/*
350+
* Linux relies on FSCR[DSCR] being clear, so that we can take the
351+
* facility unavailable interrupt and track the task's usage of DSCR.
352+
* See facility_unavailable_exception().
353+
* Clear the bit here so that feat_enable() doesn't set it.
354+
*/
355+
f->fscr_bit_nr = -1;
356+
349357
feat_enable(f);
350358

351359
lpcr = mfspr(SPRN_LPCR);

0 commit comments

Comments
 (0)