From: David Gibson <david@gibson.dropbear.id.au>
To: alarson@ddci.com
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, agraf@suse.de
Subject: Re: [Qemu-devel] target-ppc: SPR_BOOKE_ESR not set on FP exceptions
Date: Fri, 29 Jul 2016 15:40:15 +1000 [thread overview]
Message-ID: <20160729054015.GR2588@voom.fritz.box> (raw)
In-Reply-To: <OFB29C6DAC.900B0FF8-ON86257FFE.0080BEBC-86257FFE.008150A9@ddci.com>
[-- Attachment #1: Type: text/plain, Size: 2488 bytes --]
On Thu, Jul 28, 2016 at 06:32:27PM -0500, alarson@ddci.com wrote:
> The target-ppc/excp_helper.c:powerpc_excp() case POWERPC_EXCP_FP fails
> to set "env->spr[SPR_BOOKE_ESR] = ESR_FP;". I can submit a patch for
> that,
Ok, please do.
> or anyone can add it, but I notice that in the other cases where
> SPR_BOOKE_ESR is set, the "msr" is ALSO set. Since the "msr" is used
> to initialize SRR1, there is a possibility of inadvertently enabling
> BookE MSR bits indirectly.
> Given that this code is not performance
> sensitive, I think it would be safer to set EITHER msr or the ESR, but
> not BOTH. For example:
>
> if (excp_model == POWERPC_EXCP_BOOKE)
> env->spr[SPR_BOOKE_ESR] = ESR_FP;
> else
> msr |= 0x00100000;
That does seem sensible, assuming those srr1 bits are no correct for
BookE, which they're not IIRC (ESR takes their place).
> I did a quick check of the bits set in the POWERPC_EXCP_PROGRAM case.
> The classic PPC sets SRR1 bits 11--15 depending on the exception. In
> Book E these correspond to bits 43--47,
Um.. what? I'm not understanding where this bit shift is coming
from. The exception code is setting MSR directly, so it should be the
same bit numbers, although they might have a different meaning on
BookE to BookS.
> of which (according to my
> EREF) only 45 and 46 are currently defined. BookE MSR bits 45 (Wait
> state enable) and 46 (Critical Enable) correspond to classic SRR1 bits
> 13 (exception is TRAP) and 14 ("SRR0 is not faulting instruction").
> If I understand the current code, given this aliasing then when a TRAP
> exception occurs on a book E processor it will effectively enable wait
> state, and an FP exception (which sets bit 14/46) will set "Critical
> Enable". I'm not sure that either of these features is currently
> implemented so this may not have a downstream effect, but never the
> less it seems incorrect.
I'm not sure about your analysis of which bits are affect, but yes
this definitely does seem wrong.
> I can submit a patch for the ESR_FP, and/or a change to have the
> "either or but not both" settings of MSR and ESR. Please let me know
> which you'd prefer.
Both fixes please, as separate patches.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-07-29 5:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-28 23:32 [Qemu-devel] target-ppc: SPR_BOOKE_ESR not set on FP exceptions alarson
2016-07-29 5:40 ` David Gibson [this message]
2016-07-29 13:04 ` alarson
2016-08-01 4:35 ` David Gibson
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=20160729054015.GR2588@voom.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=alarson@ddci.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.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;
as well as URLs for NNTP newsgroup(s).