[PATCH v4 4/4] powerpc/85xx: add sysfs for pw20 state and altivec idle

Scott Wood scottwood at freescale.com
Wed Oct 9 01:50:07 EST 2013


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 at 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





More information about the Linuxppc-dev mailing list