[PATCH 1/2] powerpc: dt_cpu_ftrs: Set current thread fscr bits

Alistair Popple alistair at popple.id.au
Thu Apr 23 14:40:56 AEST 2020


Setting the FSCR bit directly in the SPR only sets it for the initial
boot and early init of the kernel. When the init process is started it
gets copied from the current thread_struct which does not reflect any
changes made during CPU feature detection. This patch ensures the
current thread_struct state is updated to match FSCR after feature
detection is complete.

Signed-off-by: Alistair Popple <alistair at popple.id.au>
---
 arch/powerpc/kernel/dt_cpu_ftrs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
index 36bc0d5c4f3a..dede8f0b678f 100644
--- a/arch/powerpc/kernel/dt_cpu_ftrs.c
+++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
@@ -169,6 +169,7 @@ static int __init feat_try_enable_unknown(struct dt_cpu_feature *f)
 		u64 fscr = mfspr(SPRN_FSCR);
 		fscr |= 1UL << f->fscr_bit_nr;
 		mtspr(SPRN_FSCR, fscr);
+		current->thread.fscr |= 1UL << f->fscr_bit_nr;
 	} else {
 		/* Does not have a known recipe */
 		return 0;
@@ -204,6 +205,7 @@ static int __init feat_enable(struct dt_cpu_feature *f)
 			u64 fscr = mfspr(SPRN_FSCR);
 			fscr |= 1UL << f->fscr_bit_nr;
 			mtspr(SPRN_FSCR, fscr);
+			current->thread.fscr |= 1UL << f->fscr_bit_nr;
 		}
 	}
 
-- 
2.20.1



More information about the Linuxppc-dev mailing list