From: Ben Widawsky <ben@bwidawsk.net>
To: Paulo Zanoni <przanoni@gmail.com>
Cc: intel-gfx@lists.freedesktop.org, Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: Re: [PATCH 1/7] drm/i915: create macros for the "unclaimed register" checks
Date: Mon, 28 Jan 2013 12:17:35 -0800 [thread overview]
Message-ID: <20130128201734.GA1923@lundgren.jf.intel.com> (raw)
In-Reply-To: <20130125170201.2ccb6af9@bwidawsk.net>
On Fri, Jan 25, 2013 at 05:02:01PM -0800, Ben Widawsky wrote:
> On Fri, 25 Jan 2013 18:57:36 -0200
> Paulo Zanoni <przanoni@gmail.com> wrote:
>
> > From: Paulo Zanoni <paulo.r.zanoni@intel.com>
> >
> > This avoids polluting i915_write##x and also allows us to reuse code
> > on i915_read##x.
> >
> > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
> > ---
> > drivers/gpu/drm/i915/i915_drv.c | 24 ++++++++++++++++--------
> > 1 file changed, 16 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > index 9cc8f87..ae0a55a 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -1224,6 +1224,20 @@ ilk_dummy_write(struct drm_i915_private *dev_priv)
> > I915_WRITE_NOTRACE(MI_MODE, 0);
> > }
> >
> > +#define UNCLAIMED_REG_CLEAR(dev_priv, reg) \
> > + if (IS_HASWELL(dev_priv->dev) && \
> > + (I915_READ_NOTRACE(GEN7_ERR_INT) & ERR_INT_MMIO_UNCLAIMED)) { \
> > + DRM_ERROR("Unknown unclaimed register before writing to %x\n", reg); \
> > + I915_WRITE_NOTRACE(GEN7_ERR_INT, ERR_INT_MMIO_UNCLAIMED); \
> > + }
> > +
>
> You don't really need the if here, do you? I think the way it worked
> originally was fine.
I misread this the first time around. Please ignore this comment.
Apologies.
>
> > +#define UNCLAIMED_REG_CHECK(dev_priv, reg) \
> > + if (IS_HASWELL(dev_priv->dev) && \
> > + (I915_READ_NOTRACE(GEN7_ERR_INT) & ERR_INT_MMIO_UNCLAIMED)) { \
> > + DRM_ERROR("Unclaimed write to %x\n", reg); \
> > + writel(ERR_INT_MMIO_UNCLAIMED, dev_priv->regs + GEN7_ERR_INT); \
> > + }
> > +
> > #define __i915_read(x, y) \
> > u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \
> > u##x val = 0; \
>
> I suppose you could add some 'unlikely' predictions in another patch if
> you wanted. I really don't know what the consensus is on using those
> these day.
>
> > @@ -1262,10 +1276,7 @@ void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val) { \
> > } \
> > if (IS_GEN5(dev_priv->dev)) \
> > ilk_dummy_write(dev_priv); \
> > - if (IS_HASWELL(dev_priv->dev) && (I915_READ_NOTRACE(GEN7_ERR_INT) & ERR_INT_MMIO_UNCLAIMED)) { \
> > - DRM_ERROR("Unknown unclaimed register before writing to %x\n", reg); \
> > - I915_WRITE_NOTRACE(GEN7_ERR_INT, ERR_INT_MMIO_UNCLAIMED); \
> > - } \
> > + UNCLAIMED_REG_CLEAR(dev_priv, reg); \
> > if (IS_VALLEYVIEW(dev_priv->dev) && IS_DISPLAYREG(reg)) { \
> > write##y(val, dev_priv->regs + reg + 0x180000); \
> > } else { \
>
> Here's what I meant above, you replace 2 lines of code with 4 from the
> macro. (Including an extra MMIO read).
>
I misread this the first time around. Please ignore this comment.
Apologies.
> > @@ -1274,10 +1285,7 @@ void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val) { \
> > if (unlikely(__fifo_ret)) { \
> > gen6_gt_check_fifodbg(dev_priv); \
> > } \
> > - if (IS_HASWELL(dev_priv->dev) && (I915_READ_NOTRACE(GEN7_ERR_INT) & ERR_INT_MMIO_UNCLAIMED)) { \
> > - DRM_ERROR("Unclaimed write to %x\n", reg); \
> > - writel(ERR_INT_MMIO_UNCLAIMED, dev_priv->regs + GEN7_ERR_INT); \
> > - } \
> > + UNCLAIMED_REG_CHECK(dev_priv, reg); \
> > }
> > __i915_write(8, b)
> > __i915_write(16, w)
>
>
>
> --
> Ben Widawsky, Intel Open Source Technology Center
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ben Widawsky, Intel Open Source Technology Center
next prev parent reply other threads:[~2013-01-28 20:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 20:57 [PATCH 0/7] Unclaimed register reporting V2 Paulo Zanoni
2013-01-25 20:57 ` [PATCH 1/7] drm/i915: create macros for the "unclaimed register" checks Paulo Zanoni
2013-01-26 1:02 ` Ben Widawsky
2013-01-28 20:17 ` Ben Widawsky [this message]
2013-01-25 20:57 ` [PATCH 2/7] drm/i915: use FPGA_DBG " Paulo Zanoni
2013-01-26 1:03 ` Ben Widawsky
2013-01-25 20:57 ` [PATCH 3/7] drm/i915: clear the FPGA_DBG_RM_NOCLAIM bit at driver init Paulo Zanoni
2013-01-26 1:05 ` Ben Widawsky
2013-01-29 19:02 ` [PATCH 3/3] " Paulo Zanoni
2013-01-25 20:57 ` [PATCH 4/7] drm/i915: check for unclaimed registers on I915_READ too Paulo Zanoni
2013-01-25 20:57 ` [PATCH 5/7] drm/i915: WARN on unclaimed registers Paulo Zanoni
2013-01-26 1:11 ` Ben Widawsky
2013-01-25 20:57 ` [PATCH 6/7] drm/i915: only check for unclaimed registers if drm_debug Paulo Zanoni
2013-01-25 20:57 ` [PATCH 7/7] drm/i915: print Gen 7 error interrupts Paulo Zanoni
2013-01-26 1:24 ` Ben Widawsky
2013-02-08 18:22 ` 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=20130128201734.GA1923@lundgren.jf.intel.com \
--to=ben@bwidawsk.net \
--cc=intel-gfx@lists.freedesktop.org \
--cc=paulo.r.zanoni@intel.com \
--cc=przanoni@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).