lkml.org 
[lkml]   [2019]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] riscv: Correct the initialized flow of FP register
> +static inline void fstate_off(struct task_struct *task,
> + struct pt_regs *regs)
> +{
> + regs->sstatus = (regs->sstatus & ~(SR_FS)) | SR_FS_OFF;

No need for the inner braces here.

> +}
> +
> static inline void fstate_save(struct task_struct *task,
> struct pt_regs *regs)
> {
> diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c
> index f23794b..e3077ee 100644
> --- a/arch/riscv/kernel/process.c
> +++ b/arch/riscv/kernel/process.c
> @@ -64,8 +64,16 @@ void start_thread(struct pt_regs *regs, unsigned long pc,
> unsigned long sp)
> {
> regs->sstatus = SR_SPIE;
> - if (has_fpu)
> + if (has_fpu) {
> regs->sstatus |= SR_FS_INITIAL;
> +#ifdef CONFIG_FPU
> + /*
> + * Restore the initial value to the FP register
> + * before starting the user program.
> + */
> + fstate_restore(current, regs);
> +#endif

fstate_restore has a no-op stub for the !CONFIG_FPU case, so the ifdef
here is not needed.

Otherwise this looks good to me:

Reviewed-by: Christoph Hellwig <hch@lst.de>

\
 
 \ /
  Last update: 2019-08-12 16:59    [W:2.115 / U:1.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site