LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Wang Dongsheng-B40534 <B40534@freescale.com>
Cc: Wood Scott-B07421 <B07421@freescale.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	Bhushan Bharat-R65777 <R65777@freescale.com>
Subject: Re: [PATCH v4 4/4] powerpc/85xx: add sysfs for pw20 state and altivec idle
Date: Tue, 8 Oct 2013 09:50:07 -0500	[thread overview]
Message-ID: <1381243807.7979.198.camel@snotra.buserror.net> (raw)
In-Reply-To: <ABB05CD9C9F68C46A5CEDC7F1543925901094898@039-SN2MPN1-021.039d.mgd.msft.net>

On Mon, 2013-10-07 at 22:58 -0500, Wang Dongsheng-B40534 wrote:
> 
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Tuesday, October 01, 2013 7:06 AM
> > To: Wang Dongsheng-B40534
> > Cc: Wood Scott-B07421; Bhushan Bharat-R65777; linuxppc-
> > dev@lists.ozlabs.org
> > Subject: Re: [PATCH v4 4/4] powerpc/85xx: add sysfs for pw20 state and
> > altivec idle
> > 
> > On Sun, 2013-09-29 at 01:57 -0500, Wang Dongsheng-B40534 wrote:
> > > I think we need to do this:
> > >
> > > #define U64_LOW_MASK            0xffffffffULL
> > > #define U64_MASK                0xffffffffffffffffULL
> > >
> > >         u32 tmp_rem;
> > >         u64 ns_u_rem, ns_u, ns_l, ns_l_carry;
> > >         u64 cycle;
> > >
> > >         ns_u = ns >> 32;
> > >         ns_l = ns & U64_LOW_MASK;
> > >
> > >         ns_l *= tb_ticks_per_usec;
> > >         ns_l_carry = ns_l >> 32;
> > >         ns_u *= tb_ticks_per_usec;
> > >         ns_u += ns_l_carry;
> > >
> > >         ns_u = div_u64_rem(ns_u, 1000, &tmp_rem);
> > >         ns_u_rem = tmp_rem;
> > >         ns_l = (ns_l & U64_LOW_MASK) | ((ns_u_rem) << 32);
> > >         ns_l = div_u64(ns_l, 1000);
> > >
> > >         if (ns_u >> 32)
> > >                 cycle = U64_MASK;
> > >         else
> > >                 cycle = (ns_u << 32) | (ns_l & U64_LOW_MASK);
> > >
> > > I has already tested this code, and works good. :)
> > 
> > Ugh.  I don't think we need to get this complicated (and I'd rather not
> > spend the time verifying the correctness of this).
> > 
> > If for some reason we did need something like this in some other context
> > (I don't want to see it just for pw20), I'd be more inclined to see
> > general 128-bit mult/divide support.
> > 
> I would like to use my version,:), because it can handle any situation and we do not need to restrict users.

It also would take more time to review than I have to spend on it, not
to mention the impact on anyone in the future that wants to understand
or maintain this code -- all for very unlikely situations (and the
"failure" in those very unlikely situations is just that we go into PW20
more often than intended).

-Scott

  reply	other threads:[~2013-10-08 14:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-24  9:28 [PATCH v4 2/4] powerpc/85xx: add hardware automatically enter altivec idle state Dongsheng Wang
2013-09-24  9:28 ` [PATCH v4 3/4] powerpc/85xx: add hardware automatically enter pw20 state Dongsheng Wang
2013-09-24  9:28 ` [PATCH v4 4/4] powerpc/85xx: add sysfs for pw20 state and altivec idle Dongsheng Wang
2013-09-25  6:22   ` Bhushan Bharat-R65777
2013-09-25  8:10     ` Wang Dongsheng-B40534
2013-09-25  8:33       ` Bhushan Bharat-R65777
2013-09-25 17:56       ` Scott Wood
2013-09-26  2:32         ` Wang Dongsheng-B40534
2013-09-26  4:23           ` Bhushan Bharat-R65777
2013-09-26  6:18             ` Wang Dongsheng-B40534
2013-09-26 21:37               ` Scott Wood
2013-09-27  3:34                 ` Wang Dongsheng-B40534
2013-09-27 21:33                   ` Scott Wood
2013-09-29  6:57                     ` Wang Dongsheng-B40534
2013-09-30 23:06                       ` Scott Wood
2013-10-08  3:58                         ` Wang Dongsheng-B40534
2013-10-08 14:50                           ` Scott Wood [this message]
2013-10-11  7:43                             ` Wang Dongsheng-B40534

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=1381243807.7979.198.camel@snotra.buserror.net \
    --to=scottwood@freescale.com \
    --cc=B07421@freescale.com \
    --cc=B40534@freescale.com \
    --cc=R65777@freescale.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