All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, linux-mips@linux-mips.org,
	Ralf Baechle <ralf@linux-mips.org>,
	Paul Burton <paul.burton@imgtec.com>,
	Gleb Natapov <gleb@kernel.org>
Subject: Re: [PATCH 02/20] MIPS: Clear [MSA]FPE CSR.Cause after notify_die()
Date: Wed, 8 Apr 2015 01:43:12 +0100 (BST)	[thread overview]
Message-ID: <alpine.LFD.2.11.1504080113360.21028@eddie.linux-mips.org> (raw)
In-Reply-To: <1426085096-12932-3-git-send-email-james.hogan@imgtec.com>

On Wed, 11 Mar 2015, James Hogan wrote:

> When handling floating point exceptions (FPEs) and MSA FPEs the Cause
> bits of the appropriate control and status register (FCSR for FPEs and
> MSACSR for MSA FPEs) are read and cleared before enabling interrupts,
> presumably so that it doesn't have to go through the pain of restoring
> those bits if the process is pre-empted, since writing those bits would
> cause another immediate exception while still in the kernel.

 Another reason is MIPS I processors (and for the record I believe the 
R6000 MIPS II implementation as well) signal FPA exceptions using an 
ordinary interrupt, seen on one of the IP[7:2] bits in the CP0 Cause 
register.  Consequently reenabling interrupts without first clearing at 
least all the unmasked FCSR.Cause bits would retrigger the interrupt and 
cause an infinite loop.

 We don't ever mask the FPA interrupt with the relevant IM[7:2] bit in the 
CP0 Status register, because for simplicity we reuse the whole of the FPE 
exception handling path for FPA interrupts as well.  Except that we enter 
it via the `handle_fpe_int' alternative entry point rather than the usual 
`handle_fpe' one, bypassing the register save sequence as it was already 
done by the interrupt handler.

  Maciej

  parent reply	other threads:[~2015-04-08  0:43 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-11 14:44 [PATCH 00/20] MIPS: KVM: Guest FPU & SIMD (MSA) support James Hogan
2015-03-11 14:44 ` James Hogan
2015-03-11 14:44 ` James Hogan
2015-03-11 14:44 ` James Hogan
2015-03-11 14:44 ` [PATCH 01/20] MIPS: KVM: Handle MSA Disabled exceptions from guest James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-11 14:44 ` [PATCH 02/20] MIPS: Clear [MSA]FPE CSR.Cause after notify_die() James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-23 13:56   ` Ralf Baechle
2015-04-08  0:43   ` Maciej W. Rozycki [this message]
2015-03-11 14:44 ` [PATCH 03/20] MIPS: KVM: Handle TRAP exceptions from guest kernel James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-11 14:44 ` [PATCH 04/20] MIPS: KVM: Implement PRid CP0 register access James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-11 14:44 ` [PATCH 05/20] MIPS: KVM: Sort kvm_mips_get_reg() registers James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-11 14:44 ` [PATCH 06/20] MIPS: KVM: Drop pr_info messages on init/exit James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-11 14:44 ` [PATCH 07/20] MIPS: KVM: Clean up register definitions a little James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-11 14:44 ` [PATCH 08/20] MIPS: KVM: Simplify default guest Config registers James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-11 14:44 ` [PATCH 09/20] MIPS: KVM: Add Config4/5 and writing of " James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-11 14:44 ` [PATCH 10/20] MIPS: KVM: Add vcpu_get_regs/vcpu_set_regs callback James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-11 14:44 ` [PATCH 11/20] MIPS: KVM: Add base guest FPU support James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-11 14:44 ` [PATCH 12/20] MIPS: KVM: Emulate FPU bits in COP0 interface James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-11 14:44 ` [PATCH 13/20] MIPS: KVM: Add FP exception handling James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-11 14:44 ` [PATCH 14/20] MIPS: KVM: Expose FPU registers James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-26 13:55   ` Paolo Bonzini
2015-03-11 14:44 ` [PATCH 16/20] MIPS: KVM: Add base guest MSA support James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-11 14:44 ` [PATCH 17/20] MIPS: KVM: Emulate MSA bits in COP0 interface James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-11 14:44 ` [PATCH 18/20] MIPS: KVM: Add MSA exception handling James Hogan
2015-03-11 14:44   ` James Hogan
     [not found] ` <1426085096-12932-1-git-send-email-james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-03-11 14:44   ` [PATCH 15/20] MIPS: KVM: Wire up FPU capability James Hogan
2015-03-11 14:44     ` James Hogan
2015-03-11 14:44     ` James Hogan
2015-03-11 14:44     ` James Hogan
2015-03-11 14:44   ` [PATCH 19/20] MIPS: KVM: Expose MSA registers James Hogan
2015-03-11 14:44     ` James Hogan
2015-03-11 14:44     ` James Hogan
2015-03-11 14:44     ` James Hogan
2015-03-11 14:44 ` [PATCH 20/20] MIPS: KVM: Wire up MSA capability James Hogan
2015-03-11 14:44   ` James Hogan
2015-03-26 13:58   ` Paolo Bonzini
2015-03-26 14:52     ` James Hogan
2015-03-26 14:52       ` James Hogan

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=alpine.LFD.2.11.1504080113360.21028@eddie.linux-mips.org \
    --to=macro@linux-mips.org \
    --cc=gleb@kernel.org \
    --cc=james.hogan@imgtec.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=paul.burton@imgtec.com \
    --cc=pbonzini@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.