All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Widawsky <ben@bwidawsk.net>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 09/18] drm/i915: make PM interrupt writes non-destructive
Date: Wed, 7 Nov 2012 11:53:25 +0000	[thread overview]
Message-ID: <20121107115325.4d0308a8@bwidawsk.net> (raw)
In-Reply-To: <eeac1e$4tp0pn@AZSMGA002.ch.intel.com>

On Wed, 07 Nov 2012 10:17:09 +0000
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> On Tue,  6 Nov 2012 16:25:33 +0000, Ben Widawsky <ben@bwidawsk.net> wrote:
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > index 8f15616..5477454 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -2354,7 +2354,7 @@ static void gen6_disable_rps(struct drm_device *dev)
> >  	I915_WRITE(GEN6_RC_CONTROL, 0);
> >  	I915_WRITE(GEN6_RPNSWREQ, 1 << 31);
> >  	I915_WRITE(GEN6_PMINTRMSK, 0xffffffff);
> > -	I915_WRITE(GEN6_PMIER, 0);
> > +	I915_WRITE(GEN6_PMIER, I915_READ(GEN6_PMIER) & ~GEN6_PM_RPS_EVENTS);
> >  	/* Complete PM interrupt masking here doesn't race with the rps work
> >  	 * item again unmasking PM interrupts because that is using a different
> >  	 * register (PMIMR) to mask PM interrupts. The only risk is in leaving
> > @@ -2364,7 +2364,7 @@ static void gen6_disable_rps(struct drm_device *dev)
> >  	dev_priv->rps.pm_iir = 0;
> >  	spin_unlock_irq(&dev_priv->rps.lock);
> >  
> > -	I915_WRITE(GEN6_PMIIR, I915_READ(GEN6_PMIIR));
> > +	I915_WRITE(GEN6_PMIIR, I915_READ(GEN6_PMIIR) & ~GEN6_PM_RPS_EVENTS);
> >  }
> >  
> >  int intel_enable_rc6(const struct drm_device *dev)
> > @@ -2518,10 +2518,10 @@ static void gen6_enable_rps(struct drm_device *dev)
> >  	gen6_set_rps(dev_priv->dev, (gt_perf_status & 0xff00) >> 8);
> >  
> >  	/* requires MSI enabled */
> > -	I915_WRITE(GEN6_PMIER, GEN6_PM_DEFERRED_EVENTS);
> > +	I915_WRITE(GEN6_PMIER, I915_READ(GEN6_PMIER) | GEN6_PM_RPS_EVENTS);
> >  	spin_lock_irq(&dev_priv->rps.lock);
> >  	WARN_ON(dev_priv->rps.pm_iir != 0);
> > -	I915_WRITE(GEN6_PMIMR, 0);
> > +	I915_WRITE(GEN6_PMIIR, I915_READ(GEN6_PMIIR) & GEN6_PM_RPS_EVENTS);
> >  	spin_unlock_irq(&dev_priv->rps.lock);
> >  	/* enable all PM interrupts */
> >  	I915_WRITE(GEN6_PMINTRMSK, 0);
> 
> Totally confused.
> 
> IER = IER & ~RPS // only disable the RPS events
> IIR = IIR & RPS // clear the asserted RPS bits
> 
> IMR != IIR.
> -Chris
> 

So yes, there is a bug here I think. To make sure you aren't referring
to something else though I'll elaborate, and add this to the commit
message in v2.

At preinstall all interrupts are masked and disabled. That will only
happen at driver load time. Then the above code enable/disable rc6
happens also at resume, so a little more care is taken.

The IMR is only touched by the workqueue, so enable/disable touch IER
and IIR.

Disable (there is a bug here you found):
Disable RPS events, optionally clear IIR RPS interrupts.

+	I915_WRITE(GEN6_PMIIR, I915_READ(GEN6_PMIIR) & ~GEN6_PM_RPS_EVENTS);
should be either nothing at all (since we clear on enable anyway), or:
+	I915_WRITE(GEN6_PMIIR, GEN6_PM_RPS_EVENTS);


Enable (this is okay as it stands, I think):
Enable RPS events, clear IIR RPS interrupts.

+	I915_WRITE(GEN6_PMIER, I915_READ(GEN6_PMIER) | GEN6_PM_RPS_EVENTS);
+	I915_WRITE(GEN6_PMIIR, I915_READ(GEN6_PMIIR) & GEN6_PM_RPS_EVENTS);

-- 
Ben Widawsky, Intel Open Source Technology Center

  reply	other threads:[~2012-11-07 11:52 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 16:25 [PATCH 00/18] [RFC] Introduce the Haswell VECS Ben Widawsky
2012-11-06 16:25 ` [PATCH 01/18] drm/i915: Comments for semaphore clarification Ben Widawsky
2012-11-07 13:30   ` Jani Nikula
2012-11-06 16:25 ` [PATCH 02/18] drm/i915: Semaphore MBOX update generalization Ben Widawsky
2012-11-07 14:00   ` Jani Nikula
2012-11-06 16:25 ` [PATCH 03/18] drm/i915: Introduce VECS: the 4th ring Ben Widawsky
2012-11-06 16:25 ` [PATCH 04/18] drm/i915: Add VECS semaphore bits Ben Widawsky
2012-11-06 16:25 ` [PATCH 05/18] drm/i915: Rename ring flush functions Ben Widawsky
2012-11-07 14:47   ` Jani Nikula
2012-11-06 16:25 ` [PATCH 06/18] drm/i915: add HAS_VEBOX Ben Widawsky
2012-11-07 14:59   ` Jani Nikula
2012-11-06 16:25 ` [PATCH 07/18] drm/i915: Vebox ringbuffer init Ben Widawsky
2012-11-06 16:25 ` [PATCH 08/18] drm/i915: Create a more generic pm handler for hsw+ Ben Widawsky
2012-11-06 16:25 ` [PATCH 09/18] drm/i915: make PM interrupt writes non-destructive Ben Widawsky
2012-11-07 10:17   ` Chris Wilson
2012-11-07 11:53     ` Ben Widawsky [this message]
2012-11-12 19:11   ` [PATCH 09/18 v3] " Ben Widawsky
2012-11-12 19:39     ` [PATCH 09/18 v4] " Ben Widawsky
2012-11-06 16:25 ` [PATCH 10/18] drm/i915: Create an ivybridge_irq_preinstall Ben Widawsky
2012-11-06 16:25 ` [PATCH 11/18] drm/i915: Add PM regs to pre install Ben Widawsky
2012-11-06 16:25 ` [PATCH 12/18] drm/i915: Convert irq_refounct to struct Ben Widawsky
2012-11-06 16:25 ` [PATCH 13/18] drm/i915: consolidate interrupt naming scheme Ben Widawsky
2012-11-06 16:25 ` [PATCH 14/18] drm/i915: vebox interrupt get/put Ben Widawsky
2013-02-13 19:28   ` Daniel Vetter
2012-11-06 16:25 ` [PATCH 15/18] drm/i915: Enable vebox interrupts Ben Widawsky
2012-11-06 16:25 ` [PATCH 16/18] drm/i915: add VEBOX into debugfs Ben Widawsky
2012-11-06 16:25 ` [PATCH 17/18] drm/i915: add I915_EXEC_VEBOX to i915_gem_do_execbuffer() Ben Widawsky
2012-11-06 16:25 ` [PATCH 18/18] drm/i915: add I915_PARAM_HAS_VEBOX to i915_getparam Ben Widawsky
2012-11-07 12:03 ` [PATCH 00/18] [RFC] Introduce the Haswell VECS Ben Widawsky
2013-04-28  0:59 [PATCH 00/18] " Ben Widawsky
2013-04-28  0:59 ` [PATCH 09/18] drm/i915: make PM interrupt writes non-destructive Ben Widawsky
2013-05-28 13:30   ` Damien Lespiau
2013-05-28 18:02     ` 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=20121107115325.4d0308a8@bwidawsk.net \
    --to=ben@bwidawsk.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.