linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/fsl-booke: Work around erratum A-006958
Date: Mon, 15 Jul 2013 11:53:54 -0500	[thread overview]
Message-ID: <1373907234.8183.297@snotra> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B72E1@saturn3.aculab.com> (from David.Laight@ACULAB.COM on Mon Jul 15 03:45:36 2013)

On 07/15/2013 03:45:36 AM, David Laight wrote:
> > +#define MFTB(dest, scratch1, scratch2)	\
> > +90:	mftbu	scratch1;		\
> > +	mftbl	dest;			\
> > +	mftbu	scratch2;		\
> > +	cmpw	scratch1,scratch2;	\
> > +	bne	90b;			\
> > +	rldimi	dest,scratch1,32,0;
>=20
> Are the three mftbu/l instructions guaranteed to be executed
> in order?

This is the architecturally defined instruction sequence for 32-bit, =20
and is what the erratum writeup says to use.

> Also, if the high word changes, there is no need to loop.
> Just return the second value with a low word of zero
> (the returned count happened while the function was active).

That would be more complicated than looping.

> If the mftbx instructions are synchronizing ones (or need
> sequencing), then it might be possible to only have 2 of them
> by reading the 64bit value and the high 32bits.
> (The correct order depends on the exact definition of the errata!)

Again, I'm not sure how helpful that would be, and it would be =20
deviating from the instruction sequence called for by the erratum text, =20
which says to use the instruction sequence used on 32-bit.

> Another option is that the 64bit value returned by mftb is
> (presumably) only likely to be wrong when the low 32bits is
> very near zero (either side).
> A second mftb could be done in this case only with some logic
> to work out a valid result (I think):
>   High changed - 2nd high, low zero.
>   First low -ve - first value.
>   First low +ve - second value.

Likewise.

-Scott=

  reply	other threads:[~2013-07-15 16:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-13  1:03 [PATCH] powerpc/fsl-booke: Work around erratum A-006958 Scott Wood
2013-07-15  6:03 ` Aneesh Kumar K.V
2013-07-15 16:55   ` Scott Wood
2013-07-15  8:45 ` David Laight
2013-07-15 16:53   ` Scott Wood [this message]
2013-07-15 22:15     ` Scott Wood
2013-07-16  8:28       ` David Laight
2013-07-16 18:16         ` Scott Wood

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=1373907234.8183.297@snotra \
    --to=scottwood@freescale.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=linuxppc-dev@lists.ozlabs.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).