diff mbox series

[v3,4/7] powerpc/dt_cpu_ftrs: Set current thread fscr bits

Message ID 20200521014341.29095-5-alistair@popple.id.au (mailing list archive)
State Superseded
Headers show
Series Base support for POWER10 | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (7b06fb8795ffea9d12be45a172197c3307955479)
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
snowpatch_ozlabs/needsstable success Patch has no Fixes tags

Commit Message

Alistair Popple May 21, 2020, 1:43 a.m. UTC
Setting the FSCR bit directly in the SPR only sets it during the initial
boot and early init of the kernel but not for the init process or any
subsequent kthreads. This is because the thread_struct for those is
copied from the current thread_struct setup at boot which doesn't
reflect any changes made to the FSCR during cpu feature detection. This
patch ensures the current thread state is updated to match once feature
detection is complete.

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

Comments

Christophe Leroy March 9, 2022, 8:25 a.m. UTC | #1
Hi,

Le 21/05/2020 à 03:43, Alistair Popple a écrit :
> Setting the FSCR bit directly in the SPR only sets it during the initial
> boot and early init of the kernel but not for the init process or any
> subsequent kthreads. This is because the thread_struct for those is
> copied from the current thread_struct setup at boot which doesn't
> reflect any changes made to the FSCR during cpu feature detection. This
> patch ensures the current thread state is updated to match once feature
> detection is complete.
> 
> Signed-off-by: Alistair Popple <alistair@popple.id.au>

I see that the series has been merged but this patch was left over.

Has it been forgotten or is it rejected ?

Thanks
Christophe


> ---
>   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 b5e21264d168..677190f70cac 100644
> --- a/arch/powerpc/kernel/dt_cpu_ftrs.c
> +++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
> @@ -170,6 +170,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;
> @@ -205,6 +206,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;
>   		}
>   	}
>
Michael Ellerman March 9, 2022, 10:28 a.m. UTC | #2
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 21/05/2020 à 03:43, Alistair Popple a écrit :
>> Setting the FSCR bit directly in the SPR only sets it during the initial
>> boot and early init of the kernel but not for the init process or any
>> subsequent kthreads. This is because the thread_struct for those is
>> copied from the current thread_struct setup at boot which doesn't
>> reflect any changes made to the FSCR during cpu feature detection. This
>> patch ensures the current thread state is updated to match once feature
>> detection is complete.
>> 
>> Signed-off-by: Alistair Popple <alistair@popple.id.au>
>
> I see that the series has been merged but this patch was left over.
>
> Has it been forgotten or is it rejected ?

I fixed the underlying issue, see:

  912c0a7f2b5d ("powerpc/64s: Save FSCR to init_task.thread.fscr after feature init")

So I guess it was superseeded (by a preceeding patch).

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
index b5e21264d168..677190f70cac 100644
--- a/arch/powerpc/kernel/dt_cpu_ftrs.c
+++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
@@ -170,6 +170,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;
@@ -205,6 +206,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;
 		}
 	}