intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: Re: [PATCH 2/9] drm/i915: wrap GTIMR changes
Date: Thu, 15 Aug 2013 10:21:02 -0300	[thread overview]
Message-ID: <CA+gsUGSoiq4J5u72ijwpWe0Z-dcq8ZL+2p6ET953bdeEiegreA@mail.gmail.com> (raw)
In-Reply-To: <20130815001946.GA16571@bratislava>

2013/8/14 Rodrigo Vivi <rodrigo.vivi@gmail.com>
>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
>
> .On Tue, Aug 06, 2013 at 06:57:12PM -0300, Paulo Zanoni wrote:
> > From: Paulo Zanoni <paulo.r.zanoni@intel.com>
> >
> > Just like the functions that touch DEIMR and SDEIMR, but for GTIMR.
> > The new functions contain a POSTING_READ(GTIMR) which was not present
> > at the 2 callers inside i915_irq.c.
> >
> > The implementation is based on ibx_display_interrupt_update.
> >
> > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_irq.c         | 34 +++++++++++++++++++++++++++++----
> >  drivers/gpu/drm/i915/intel_drv.h        |  3 +++
> >  drivers/gpu/drm/i915/intel_ringbuffer.c | 22 ++++++---------------
> >  3 files changed, 39 insertions(+), 20 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> > index 6a1c207..a6e98ea 100644
> > --- a/drivers/gpu/drm/i915/i915_irq.c
> > +++ b/drivers/gpu/drm/i915/i915_irq.c
> > @@ -104,6 +104,34 @@ ironlake_disable_display_irq(drm_i915_private_t *dev_priv, u32 mask)
> >       }
> >  }
> >
> > +/**
> > + * ilk_update_gt_irq - update GTIMR
> > + * @dev_priv: driver private
> > + * @interrupt_mask: mask of interrupt bits to update
> > + * @enabled_irq_mask: mask of interrupt bits to enable
> > + */
> > +static void ilk_update_gt_irq(struct drm_i915_private *dev_priv,
> > +                           uint32_t interrupt_mask,
> > +                           uint32_t enabled_irq_mask)
> > +{
> > +     assert_spin_locked(&dev_priv->irq_lock);
> > +
> > +     dev_priv->gt_irq_mask &= ~interrupt_mask;
> > +     dev_priv->gt_irq_mask |= (~enabled_irq_mask & interrupt_mask);
>
> my little mind got confused with logic above, but after some minutes I convinced myself this works ;)

And if this contains a bug, then ibx_display_interrupt_update also
contains a bug :)


>
>
> > +     I915_WRITE(GTIMR, dev_priv->gt_irq_mask);
> > +     POSTING_READ(GTIMR);
> > +}
> > +
> > +void ilk_enable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask)
> > +{
> > +     ilk_update_gt_irq(dev_priv, mask, mask);
> > +}
> > +
> > +void ilk_disable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask)
> > +{
> > +     ilk_update_gt_irq(dev_priv, mask, 0);
> > +}
> > +
> >  static bool ivb_can_enable_err_int(struct drm_device *dev)
> >  {
> >       struct drm_i915_private *dev_priv = dev->dev_private;
> > @@ -806,8 +834,7 @@ static void ivybridge_parity_work(struct work_struct *work)
> >       I915_WRITE(GEN7_MISCCPCTL, misccpctl);
> >
> >       spin_lock_irqsave(&dev_priv->irq_lock, flags);
> > -     dev_priv->gt_irq_mask &= ~GT_RENDER_L3_PARITY_ERROR_INTERRUPT;
> > -     I915_WRITE(GTIMR, dev_priv->gt_irq_mask);
> > +     ilk_enable_gt_irq(dev_priv, GT_RENDER_L3_PARITY_ERROR_INTERRUPT);
> >       spin_unlock_irqrestore(&dev_priv->irq_lock, flags);
> >
> >       mutex_unlock(&dev_priv->dev->struct_mutex);
> > @@ -837,8 +864,7 @@ static void ivybridge_parity_error_irq_handler(struct drm_device *dev)
> >               return;
> >
> >       spin_lock(&dev_priv->irq_lock);
> > -     dev_priv->gt_irq_mask |= GT_RENDER_L3_PARITY_ERROR_INTERRUPT;
> > -     I915_WRITE(GTIMR, dev_priv->gt_irq_mask);
> > +     ilk_disable_gt_irq(dev_priv, GT_RENDER_L3_PARITY_ERROR_INTERRUPT);
> >       spin_unlock(&dev_priv->irq_lock);
> >
> >       queue_work(dev_priv->wq, &dev_priv->l3_parity.error_work);
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index 54e389d..82bc78e 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -838,5 +838,8 @@ extern void intel_edp_psr_update(struct drm_device *dev);
> >  extern void hsw_disable_lcpll(struct drm_i915_private *dev_priv,
> >                             bool switch_to_fclk, bool allow_power_down);
> >  extern void hsw_restore_lcpll(struct drm_i915_private *dev_priv);
> > +extern void ilk_enable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask);
> > +extern void ilk_disable_gt_irq(struct drm_i915_private *dev_priv,
> > +                            uint32_t mask);
> >
> >  #endif /* __INTEL_DRV_H__ */
> > diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> > index 74d02a7..6eeca1e 100644
> > --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> > +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> > @@ -836,11 +836,8 @@ gen5_ring_get_irq(struct intel_ring_buffer *ring)
> >               return false;
> >
> >       spin_lock_irqsave(&dev_priv->irq_lock, flags);
> > -     if (ring->irq_refcount++ == 0) {
> > -             dev_priv->gt_irq_mask &= ~ring->irq_enable_mask;
> > -             I915_WRITE(GTIMR, dev_priv->gt_irq_mask);
> > -             POSTING_READ(GTIMR);
> > -     }
> > +     if (ring->irq_refcount++ == 0)
> > +             ilk_enable_gt_irq(dev_priv, ring->irq_enable_mask);
> >       spin_unlock_irqrestore(&dev_priv->irq_lock, flags);
> >
> >       return true;
> > @@ -854,11 +851,8 @@ gen5_ring_put_irq(struct intel_ring_buffer *ring)
> >       unsigned long flags;
> >
> >       spin_lock_irqsave(&dev_priv->irq_lock, flags);
> > -     if (--ring->irq_refcount == 0) {
> > -             dev_priv->gt_irq_mask |= ring->irq_enable_mask;
> > -             I915_WRITE(GTIMR, dev_priv->gt_irq_mask);
> > -             POSTING_READ(GTIMR);
> > -     }
> > +     if (--ring->irq_refcount == 0)
> > +             ilk_disable_gt_irq(dev_priv, ring->irq_enable_mask);
> >       spin_unlock_irqrestore(&dev_priv->irq_lock, flags);
> >  }
> >
> > @@ -1028,9 +1022,7 @@ gen6_ring_get_irq(struct intel_ring_buffer *ring)
> >                                        GT_RENDER_L3_PARITY_ERROR_INTERRUPT));
> >               else
> >                       I915_WRITE_IMR(ring, ~ring->irq_enable_mask);
> > -             dev_priv->gt_irq_mask &= ~ring->irq_enable_mask;
> > -             I915_WRITE(GTIMR, dev_priv->gt_irq_mask);
> > -             POSTING_READ(GTIMR);
> > +             ilk_enable_gt_irq(dev_priv, ring->irq_enable_mask);
> >       }
> >       spin_unlock_irqrestore(&dev_priv->irq_lock, flags);
> >
> > @@ -1051,9 +1043,7 @@ gen6_ring_put_irq(struct intel_ring_buffer *ring)
> >                                      ~GT_RENDER_L3_PARITY_ERROR_INTERRUPT);
> >               else
> >                       I915_WRITE_IMR(ring, ~0);
> > -             dev_priv->gt_irq_mask |= ring->irq_enable_mask;
> > -             I915_WRITE(GTIMR, dev_priv->gt_irq_mask);
> > -             POSTING_READ(GTIMR);
> > +             ilk_disable_gt_irq(dev_priv, ring->irq_enable_mask);
> >       }
> >       spin_unlock_irqrestore(&dev_priv->irq_lock, flags);
> >
> > --
> > 1.8.1.2
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx




-- 
Paulo Zanoni

  reply	other threads:[~2013-08-15 13:21 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-06 21:57 [PATCH 0/9] Haswell Package C8+ Paulo Zanoni
2013-08-06 21:57 ` [PATCH 1/9] drm/i915: add the FCLK case to intel_ddi_get_cdclk_freq Paulo Zanoni
2013-08-14 18:42   ` Rodrigo Vivi
2013-08-06 21:57 ` [PATCH 2/9] drm/i915: wrap GTIMR changes Paulo Zanoni
2013-08-15  0:19   ` Rodrigo Vivi
2013-08-15 13:21     ` Paulo Zanoni [this message]
2013-08-06 21:57 ` [PATCH 3/9] drm/i915: wrap GEN6_PMIMR changes Paulo Zanoni
2013-08-15  0:22   ` Rodrigo Vivi
2013-08-15 13:23     ` Paulo Zanoni
2013-08-06 21:57 ` [PATCH 4/9] drm/i915: don't update GEN6_PMIMR when it's not needed Paulo Zanoni
2013-08-07  0:35   ` Chris Wilson
2013-08-07 13:34     ` Paulo Zanoni
2013-08-07 14:14       ` Chris Wilson
2013-08-20 14:18         ` Daniel Vetter
2013-08-15  0:28   ` Rodrigo Vivi
2013-08-06 21:57 ` [PATCH 5/9] drm/i915: add dev_priv->pm_irq_mask Paulo Zanoni
2013-08-15  0:36   ` Rodrigo Vivi
2013-08-15 13:31     ` Paulo Zanoni
2013-08-06 21:57 ` [PATCH 6/9] drm/i915: don't disable/reenable IVB error interrupts when not needed Paulo Zanoni
2013-08-15  0:41   ` Rodrigo Vivi
2013-08-20 14:21   ` Daniel Vetter
2013-08-20 14:43     ` Paulo Zanoni
2013-08-20 15:11       ` Daniel Vetter
2013-08-20 18:07         ` Paulo Zanoni
2013-08-06 21:57 ` [PATCH 7/9] drm/i915: allow package C8+ states on Haswell (disabled) Paulo Zanoni
2013-08-07  0:54   ` Chris Wilson
2013-08-07 13:38     ` Paulo Zanoni
2013-08-07 14:20       ` Chris Wilson
2013-08-07 16:02         ` Daniel Vetter
2013-08-09 20:10           ` Paulo Zanoni
2013-08-09 20:32             ` Chris Wilson
2013-08-09 21:34               ` Paulo Zanoni
2013-08-10  7:55                 ` Daniel Vetter
2013-08-10  8:04                   ` Chris Wilson
2013-08-12 22:02                     ` Paulo Zanoni
2013-08-09 20:42             ` Chris Wilson
2013-08-09 21:25               ` Paulo Zanoni
2013-08-06 21:57 ` [PATCH 8/9] drm/i915: add i915_pc8_status debugfs file Paulo Zanoni
2013-08-06 21:57 ` [PATCH 9/9] drm/i915: enable Package C8+ by default Paulo Zanoni
2013-08-06 22:31 ` [PATCH 0/9] Haswell Package C8+ Daniel Vetter
2013-08-07 13:30   ` Paulo Zanoni
2013-08-09 20:04 ` [PATCH 6.1/9] drm/i915: don't queue PM events we won't process Paulo Zanoni
2013-08-09 20:04   ` [PATCH 6.2/9] drm/i915: fix how we mask PMIMR when adding work to the queue Paulo Zanoni
2013-08-20 14:26     ` Daniel Vetter
2013-08-09 20:04   ` [PATCH 6.3/9] drm/i915: merge HSW and SNB PM irq handlers Paulo Zanoni
2013-08-14 19:21     ` Ben Widawsky
2013-08-15 14:51       ` Paulo Zanoni
2013-08-20 14:27         ` Daniel Vetter
2013-08-14 18:36   ` [PATCH 6.1/9] drm/i915: don't queue PM events we won't process Ben Widawsky
2013-08-15 14:50     ` Paulo Zanoni

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=CA+gsUGSoiq4J5u72ijwpWe0Z-dcq8ZL+2p6ET953bdeEiegreA@mail.gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=rodrigo.vivi@gmail.com \
    /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).