From patchwork Fri Nov 3 18:09:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: oscar.mateo@intel.com X-Patchwork-Id: 10041011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1DADB602D8 for ; Fri, 3 Nov 2017 18:10:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1547B29730 for ; Fri, 3 Nov 2017 18:10:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A3B9297F2; Fri, 3 Nov 2017 18:10:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C92629730 for ; Fri, 3 Nov 2017 18:10:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 17E7F6EB16; Fri, 3 Nov 2017 18:09:48 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9FE646EAEC for ; Fri, 3 Nov 2017 18:09:41 +0000 (UTC) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP; 03 Nov 2017 11:09:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,339,1505804400"; d="scan'208";a="169033931" Received: from omateolo-linux.fm.intel.com ([10.1.27.13]) by orsmga005.jf.intel.com with ESMTP; 03 Nov 2017 11:09:35 -0700 From: Oscar Mateo To: intel-gfx@lists.freedesktop.org Date: Fri, 3 Nov 2017 11:09:35 -0700 Message-Id: <1509732588-10599-8-git-send-email-oscar.mateo@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509732588-10599-1-git-send-email-oscar.mateo@intel.com> References: <1509732588-10599-1-git-send-email-oscar.mateo@intel.com> MIME-Version: 1.0 Cc: Rodrigo Vivi Subject: [Intel-gfx] [RFC PATCH 07/20] drm/i915: Create a new category of display WAs X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Display workarounds do not need to be re-applied on a GPU reset (this is, in Ville's words: "at the very least wasted effort [...] and could even be actively harmful in case we end up clobbering something the current display configuration depends on"). Therefore, they have to be applied in a different place that GT ones so they deserve their own category. Actually populating this is left for future patches: we have to start moving WAs from init_clock_gating into either GT or Display functions, and this requires a good deal of careful code reviewing. v2: Rebased to carry the init_early nomenclature over (Chris) v3: Static tables version (Joonas) Suggested-by: Ville Syrjälä Signed-off-by: Oscar Mateo Reviewed-by: Chris Wilson (v2) Cc: Mika Kuoppala Cc: Rodrigo Vivi --- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 2 + drivers/gpu/drm/i915/intel_workarounds.c | 124 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_workarounds.h | 5 ++ 4 files changed, 132 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 6a62a7b..f781d1c 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2010,6 +2010,7 @@ struct i915_wa_reg_table { struct i915_workarounds { u32 ctx_count; u32 gt_count; + u32 disp_count; u32 hw_whitelist_count[I915_NUM_ENGINES]; }; diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index acd0cbb..0d0e84b 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -29,6 +29,7 @@ #include #include "i915_drv.h" #include "intel_drv.h" +#include "intel_workarounds.h" #include "../../../platform/x86/intel_ips.h" #include #include @@ -9013,6 +9014,7 @@ static void i830_init_clock_gating(struct drm_i915_private *dev_priv) void intel_init_clock_gating(struct drm_i915_private *dev_priv) { dev_priv->display.init_clock_gating(dev_priv); + intel_display_workarounds_apply(dev_priv); } void intel_suspend_hw(struct drm_i915_private *dev_priv) diff --git a/drivers/gpu/drm/i915/intel_workarounds.c b/drivers/gpu/drm/i915/intel_workarounds.c index 849e70a..5a532a0 100644 --- a/drivers/gpu/drm/i915/intel_workarounds.c +++ b/drivers/gpu/drm/i915/intel_workarounds.c @@ -33,6 +33,10 @@ .name = (wa), \ .type = I915_WA_TYPE_GT +#define WA_DISP(wa) \ + .name = (wa), \ + .type = I915_WA_TYPE_DISPLAY + #define WA_WHITELIST(wa) \ .name = (wa), \ .type = I915_WA_TYPE_WHITELIST @@ -868,6 +872,126 @@ void intel_gt_workarounds_apply(struct drm_i915_private *dev_priv) DRM_DEBUG_DRIVER("Number of GT specific w/a: %u\n", total_count); } +static struct i915_wa_reg gen8_disp_was[] = { +}; + +static struct i915_wa_reg bdw_disp_was[] = { +}; + +static struct i915_wa_reg chv_disp_was[] = { +}; + +static struct i915_wa_reg gen9_disp_was[] = { +}; + +static struct i915_wa_reg skl_disp_was[] = { +}; + +static struct i915_wa_reg bxt_disp_was[] = { +}; + +static struct i915_wa_reg kbl_disp_was[] = { +}; + +static struct i915_wa_reg glk_disp_was[] = { +}; + +static struct i915_wa_reg cfl_disp_was[] = { +}; + +static struct i915_wa_reg cnl_disp_was[] = { +}; + +static const struct i915_wa_reg_table bdw_disp_wa_tbl[] = { + { gen8_disp_was, ARRAY_SIZE(gen8_disp_was) }, + { bdw_disp_was, ARRAY_SIZE(bdw_disp_was) }, +}; + +static const struct i915_wa_reg_table chv_disp_wa_tbl[] = { + { gen8_disp_was, ARRAY_SIZE(gen8_disp_was) }, + { chv_disp_was, ARRAY_SIZE(chv_disp_was) }, +}; + +static const struct i915_wa_reg_table skl_disp_wa_tbl[] = { + { gen9_disp_was, ARRAY_SIZE(gen9_disp_was) }, + { skl_disp_was, ARRAY_SIZE(skl_disp_was) }, +}; + +static const struct i915_wa_reg_table bxt_disp_wa_tbl[] = { + { gen9_disp_was, ARRAY_SIZE(gen9_disp_was) }, + { bxt_disp_was, ARRAY_SIZE(bxt_disp_was) }, +}; + +static const struct i915_wa_reg_table kbl_disp_wa_tbl[] = { + { gen9_disp_was, ARRAY_SIZE(gen9_disp_was) }, + { kbl_disp_was, ARRAY_SIZE(kbl_disp_was) }, +}; + +static const struct i915_wa_reg_table glk_disp_wa_tbl[] = { + { gen9_disp_was, ARRAY_SIZE(gen9_disp_was) }, + { glk_disp_was, ARRAY_SIZE(glk_disp_was) }, +}; + +static const struct i915_wa_reg_table cfl_disp_wa_tbl[] = { + { gen9_disp_was, ARRAY_SIZE(gen9_disp_was) }, + { cfl_disp_was, ARRAY_SIZE(cfl_disp_was) }, +}; + +static const struct i915_wa_reg_table cnl_disp_wa_tbl[] = { + { cnl_disp_was, ARRAY_SIZE(cnl_disp_was) }, +}; + +void intel_display_workarounds_get(struct drm_i915_private *dev_priv, + const struct i915_wa_reg_table **wa_table, + uint *table_count) +{ + *wa_table = NULL; + *table_count = 0; + + if (INTEL_GEN(dev_priv) < 8) + return; + else if (IS_BROADWELL(dev_priv)) { + *wa_table = bdw_disp_wa_tbl; + *table_count = ARRAY_SIZE(bdw_disp_wa_tbl); + } else if (IS_CHERRYVIEW(dev_priv)) { + *wa_table = chv_disp_wa_tbl; + *table_count = ARRAY_SIZE(chv_disp_wa_tbl); + } else if (IS_SKYLAKE(dev_priv)) { + *wa_table = skl_disp_wa_tbl; + *table_count = ARRAY_SIZE(skl_disp_wa_tbl); + } else if (IS_BROXTON(dev_priv)) { + *wa_table = bxt_disp_wa_tbl; + *table_count = ARRAY_SIZE(bxt_disp_wa_tbl); + } else if (IS_KABYLAKE(dev_priv)) { + *wa_table = kbl_disp_wa_tbl; + *table_count = ARRAY_SIZE(kbl_disp_wa_tbl); + } else if (IS_GEMINILAKE(dev_priv)) { + *wa_table = glk_disp_wa_tbl; + *table_count = ARRAY_SIZE(glk_disp_wa_tbl); + } else if (IS_COFFEELAKE(dev_priv)) { + *wa_table = cfl_disp_wa_tbl; + *table_count = ARRAY_SIZE(cfl_disp_wa_tbl); + } else if (IS_CANNONLAKE(dev_priv)) { + *wa_table = cnl_disp_wa_tbl; + *table_count = ARRAY_SIZE(cnl_disp_wa_tbl); + } else { + MISSING_CASE(INTEL_GEN(dev_priv)); + return; + } +} + +void intel_display_workarounds_apply(struct drm_i915_private *dev_priv) +{ + const struct i915_wa_reg_table *wa_table; + uint table_count, total_count; + + intel_display_workarounds_get(dev_priv, &wa_table, &table_count); + total_count = mmio_workarounds_apply(dev_priv, wa_table, table_count); + + dev_priv->workarounds.disp_count = total_count; + DRM_DEBUG_DRIVER("Number of Display specific w/a: %u\n", total_count); +} + static struct i915_wa_reg gen9_whitelist_was[] = { { WA_WHITELIST("WaVFEStateAfterPipeControlwithMediaStateClear"), ALL_REVS, WHITELIST(GEN9_CTX_PREEMPT_REG) }, diff --git a/drivers/gpu/drm/i915/intel_workarounds.h b/drivers/gpu/drm/i915/intel_workarounds.h index f60913f..c73dc66 100644 --- a/drivers/gpu/drm/i915/intel_workarounds.h +++ b/drivers/gpu/drm/i915/intel_workarounds.h @@ -35,6 +35,11 @@ void intel_gt_workarounds_get(struct drm_i915_private *dev_priv, uint *table_count); void intel_gt_workarounds_apply(struct drm_i915_private *dev_priv); +void intel_display_workarounds_get(struct drm_i915_private *dev_priv, + const struct i915_wa_reg_table **wa_table, + uint *table_count); +void intel_display_workarounds_apply(struct drm_i915_private *dev_priv); + void intel_whitelist_workarounds_get(struct drm_i915_private *dev_priv, const struct i915_wa_reg_table **wa_table, uint *table_count);