From patchwork Thu Oct 23 15:29:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: arun.siluvery@linux.intel.com X-Patchwork-Id: 5141431 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 56F839F349 for ; Thu, 23 Oct 2014 15:29:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D21A32017E for ; Thu, 23 Oct 2014 15:29:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C712420173 for ; Thu, 23 Oct 2014 15:29:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 69F206E01B; Thu, 23 Oct 2014 08:29:36 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id E28296E01B for ; Thu, 23 Oct 2014 08:29:34 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 23 Oct 2014 08:29:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,775,1406617200"; d="scan'208";a="594630299" Received: from asiluver-linux.isw.intel.com ([10.102.226.168]) by orsmga001.jf.intel.com with ESMTP; 23 Oct 2014 08:29:33 -0700 From: Arun Siluvery To: intel-gfx@lists.freedesktop.org Date: Thu, 23 Oct 2014 16:29:30 +0100 Message-Id: <1414078170-29469-1-git-send-email-arun.siluvery@linux.intel.com> X-Mailer: git-send-email 2.1.2 Subject: [Intel-gfx] [PATCH] drm/i915: Add means to apply WA conditionally X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We would want to apply some of the workarounds based on a condition to a particular platform or Gen but we may not know all possible controlling parameters in advance hence allow to define open conditions; a WA makes it to the list only if the condition is true. With the appropriate conditions we can combine all of the workarounds and apply them from a single place irrespective of platform instead of having them in separate functions. For: VIZ-4090 Signed-off-by: Arun Siluvery --- drivers/gpu/drm/i915/intel_ringbuffer.c | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 497b836..0525a5d 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -736,6 +736,41 @@ static int wa_add(struct drm_i915_private *dev_priv, #define WA_WRITE(addr, val) WA_REG(addr, val, 0xffffffff) +#define WA_SET_BIT_MASKED_IF(cond, addr, mask) \ + do { \ + if (cond) { \ + WA_SET_BIT_MASKED(addr, mask); \ + } \ + } while(0) + +#define WA_CLR_BIT_MASKED_IF(cond, addr, mask) \ + do { \ + if (cond) { \ + WA_CLR_BIT_MASKED(addr, mask); \ + } \ + } while(0) + +#define WA_SET_BIT_IF(cond, addr, mask) \ + do { \ + if (cond) { \ + WA_SET_BIT(addr, mask); \ + } \ + } while(0) + +#define WA_CLR_BIT_IF(cond, addr, mask) \ + do { \ + if (cond) { \ + WA_CLR_BIT(addr, mask); \ + } \ + } while(0) + +#define WA_WRITE_IF(cond, addr, val) \ + do { \ + if (cond) { \ + WA_WRITE(addr, val); \ + } \ + } while(0) + static int bdw_init_workarounds(struct intel_engine_cs *ring) { struct drm_device *dev = ring->dev;