From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 01/10] drm/i915: drm/i915: create macros for the "unclaimed register" checks Date: Mon, 18 Feb 2013 19:11:38 +0100 Message-ID: <20130218181138.GS5813@phenom.ffwll.local> References: <1360352121-3989-1-git-send-email-przanoni@gmail.com> <1360352121-3989-2-git-send-email-przanoni@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by gabe.freedesktop.org (Postfix) with ESMTP id BC524E641F for ; Mon, 18 Feb 2013 10:09:26 -0800 (PST) Received: by mail-wi0-f175.google.com with SMTP id l13so3871861wie.8 for ; Mon, 18 Feb 2013 10:09:25 -0800 (PST) Content-Disposition: inline In-Reply-To: <1360352121-3989-2-git-send-email-przanoni@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Paulo Zanoni Cc: intel-gfx@lists.freedesktop.org, Paulo Zanoni List-Id: intel-gfx@lists.freedesktop.org On Fri, Feb 08, 2013 at 05:35:12PM -0200, Paulo Zanoni wrote: > From: Paulo Zanoni > > This avoids polluting i915_write##x and also allows us to reuse code > on i915_read##x. > > v2: Rebase > > Reviewed-by: Ben Widawsky (v1) > Signed-off-by: Paulo Zanoni Checkpatch complained about the macro parameters not being enclosed in (reg) params. I tend to agree, so maybe just extract the entire thing into a static inline function while at it? -Daniel > --- > 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 c5b8c81..e24c337 100644 > --- a/drivers/gpu/drm/i915/i915_drv.c > +++ b/drivers/gpu/drm/i915/i915_drv.c > @@ -1131,6 +1131,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); \ > + } > + > +#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; \ > @@ -1167,18 +1181,12 @@ 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); \ > write##y(val, dev_priv->regs + reg); \ > 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) > -- > 1.7.10.4 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch