Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/i915/vlv: use correct units for rc6 residency
Date: Thu, 26 Sep 2013 17:51:16 -0700	[thread overview]
Message-ID: <20130926175116.436024eb@jbarnes-desktop> (raw)
In-Reply-To: <20130927004937.GA8626@nuc-i3427.alporthouse.com>

On Fri, 27 Sep 2013 01:49:37 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> On Thu, Sep 26, 2013 at 03:34:33PM -0700, Jesse Barnes wrote:
> > On Thu, 26 Sep 2013 23:25:46 +0100
> > Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > > 
> > > >  
> > > >  	if (!intel_enable_rc6(dev))
> > > >  		return 0;
> > > >  
> > > > -	raw_time = I915_READ(reg) * 128ULL;
> > > > -	return DIV_ROUND_UP_ULL(raw_time, 100000);
> > > > +	/* On VLV, residency time is in CZ units rather than 1.28us */
> > > > +	if (IS_VALLEYVIEW(dev)) {
> > > > +		u32 clkctl2;
> > > > +
> > > > +		clkctl2 = I915_READ(VLV_CLK_CTL2) >>
> > > > +			CLK_CTL2_CZCOUNT_30NS_SHIFT;
> > > > +		if (!clkctl2) {
> > > > +			WARN(!clkctl2, "bogus CZ count value");
> > > > +			return 0;
> > > > +		}
> > > > +		units = DIV_ROUND_UP_ULL(3000ULL, (u64)clkctl2);
> > > 
> > > For your divisor, this should 30*1000 not 3*1000.
> > 
> > 30ns * 100 for fixed point precision, just as above.
> > 
> > > 
> > > > +		if (I915_READ(VLV_COUNTER_CONTROL) & VLV_COUNT_RANGE_HIGH)
> > > > +			units <<= 8;
> > > > +
> > > > +		div = 100 000 000;
> > 
> > Then here we divide out the ns to ms (1000000) and also the 100 for
> > fixed point.
> > 
> > Or do I still have it wrong?
> 
> Just counting fail on my part, even after splitting it up to make it
> easier for myself.
> 
> How about
> 
> #define BIAS 100
> units = 30*BIAS / cltctk2;
> if (hi) units <<= 8;
> div = NSEC_PER_MSEC * BIAS;
> 
> All because I have difficultly counting.

Sure, will re-post.

Thanks,
-- 
Jesse Barnes, Intel Open Source Technology Center

  reply	other threads:[~2013-09-27  0:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-26 19:33 [PATCH 1/2] drm/i915/vlv: use lower precision RC6 counter Jesse Barnes
2013-09-26 19:33 ` [PATCH 2/2] drm/i915/vlv: use correct units for rc6 residency Jesse Barnes
2013-09-26 22:25   ` Chris Wilson
2013-09-26 22:34     ` Jesse Barnes
2013-09-27  0:49       ` Chris Wilson
2013-09-27  0:51         ` Jesse Barnes [this message]
2013-09-26 21:00 ` [PATCH 1/2] drm/i915/vlv: use lower precision RC6 counter Ben Widawsky

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=20130926175116.436024eb@jbarnes-desktop \
    --to=jbarnes@virtuousgeek.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.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