Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Joshua Kinard <kumba@gentoo.org>
To: "Maciej W. Rozycki" <macro@linux-mips.org>,
	Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH] MIPS: Avoid an FPE exception in FCSR mask probing
Date: Tue, 02 Jun 2015 16:36:11 -0400	[thread overview]
Message-ID: <556E13BB.3070708@gentoo.org> (raw)
In-Reply-To: <alpine.LFD.2.11.1506021739230.6751@eddie.linux-mips.org>

On 06/02/2015 12:50, Maciej W. Rozycki wrote:
> Use the default FCSR value in mask probing, avoiding an FPE exception 
> where reset has left any exception enable and their corresponding cause 
> bits set and the register is then rewritten with these bits active.
> 
> Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
> ---
> linux-mips-fcsr-mask-fix.diff
> Index: linux-org-test/arch/mips/kernel/cpu-probe.c
> ===================================================================
> --- linux-org-test.orig/arch/mips/kernel/cpu-probe.c	2015-06-01 00:43:32.000000000 +0100
> +++ linux-org-test/arch/mips/kernel/cpu-probe.c	2015-06-02 12:14:10.088786000 +0100
> @@ -74,13 +74,12 @@ static inline void cpu_set_fpu_fcsr_mask
>  {
>  	unsigned long sr, mask, fcsr, fcsr0, fcsr1;
>  
> +	fcsr = c->fpu_csr31;
>  	mask = FPU_CSR_ALL_X | FPU_CSR_ALL_E | FPU_CSR_ALL_S | FPU_CSR_RM;
>  
>  	sr = read_c0_status();
>  	__enable_fpu(FPU_AS_IS);
>  
> -	fcsr = read_32bit_cp1_register(CP1_STATUS);
> -
>  	fcsr0 = fcsr & mask;
>  	write_32bit_cp1_register(CP1_STATUS, fcsr0);
>  	fcsr0 = read_32bit_cp1_register(CP1_STATUS);
> 

Tested-by: Joshua Kinard <kumba@gentoo.org>

  reply	other threads:[~2015-06-02 20:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02 16:50 [PATCH] MIPS: Avoid an FPE exception in FCSR mask probing Maciej W. Rozycki
2015-06-02 20:36 ` Joshua Kinard [this message]
2015-06-03  7:50 ` Ralf Baechle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=556E13BB.3070708@gentoo.org \
    --to=kumba@gentoo.org \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox