From patchwork Mon Oct 9 20:58:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: oscar.mateo@intel.com X-Patchwork-Id: 9994315 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 B244460223 for ; Mon, 9 Oct 2017 20:58:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5DA328836 for ; Mon, 9 Oct 2017 20:58:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AEE62883D; Mon, 9 Oct 2017 20:58:39 +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 1C05A28836 for ; Mon, 9 Oct 2017 20:58:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 838646E3E0; Mon, 9 Oct 2017 20:58:37 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id C966E6E3BC for ; Mon, 9 Oct 2017 20:58:26 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Oct 2017 13:58:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,501,1500966000"; d="scan'208";a="161178692" Received: from omateolo-linux.fm.intel.com ([10.1.27.26]) by fmsmga006.fm.intel.com with ESMTP; 09 Oct 2017 13:58:25 -0700 From: Oscar Mateo To: intel-gfx@lists.freedesktop.org Date: Mon, 9 Oct 2017 13:58:25 -0700 Message-Id: <1507582707-20079-11-git-send-email-oscar.mateo@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507582707-20079-1-git-send-email-oscar.mateo@intel.com> References: <1507582707-20079-1-git-send-email-oscar.mateo@intel.com> Subject: [Intel-gfx] [RFC PATCH 10/11] drm/i915: Document the i915_workarounds file 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Does what it says on the tin (plus a few fixes in some old comments). Signed-off-by: Oscar Mateo Cc: Chris Wilson Cc: Mika Kuoppala --- drivers/gpu/drm/i915/i915_workarounds.c | 45 ++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_workarounds.c b/drivers/gpu/drm/i915/i915_workarounds.c index ff30525..9a32601 100644 --- a/drivers/gpu/drm/i915/i915_workarounds.c +++ b/drivers/gpu/drm/i915/i915_workarounds.c @@ -25,6 +25,36 @@ #include "i915_drv.h" #include "i915_workarounds.h" +/** + * DOC: Hardware workarounds + * + * This file is a central place to implement most* of the required workarounds + * required for HW to work as originally intended. They fall in four categories + * depending on how/when they are applied: + * + * - Workarounds that touch registers that are saved/restored to/from the HW + * context image. The list is generated once and then emitted (via Load + * Register Immediate commands) everytime a new context is created. + * - Workarounds that touch global MMIO registers. The list of these WAs is + * generated once and then applied whenever these registers revert to default + * values (on GPU reset, suspend/resume**, etc..). + * - Workarounds that whitelist a privileged register, so that UMDs can manage + * them directly. This is just a special case of a MMMIO workaround (as we + * write the list of these to/be-whitelisted registers to some special HW + * registers). + * - Workaround batchbuffers, that get executed automatically by the hardware + * on every HW context restore. + * + * * Please notice that there are other WAs that, due to their nature, cannot be + * applied from a central place. Those are peppered around the rest of the + * code, as needed). + * + * ** Technically, some registers are powercontext saved & restored, so they + * survive a suspend/resume. In practice, writing them again is not too + * costly and simplifies things. We can revisit this in the future. + * + */ + static int ctx_wa_add(struct drm_i915_private *dev_priv, i915_reg_t addr, const u32 mask, const u32 val) @@ -190,9 +220,9 @@ static int gen9_ctx_workarounds_init(struct drm_i915_private *dev_priv) CTXWA_SET_BIT_MSK(GEN7_COMMON_SLICE_CHICKEN1, GEN9_RHWO_OPTIMIZATION_DISABLE); /* - * WA also requires GEN9_SLICE_COMMON_ECO_CHICKEN0[14:14] to be set - * but we do that in per ctx batchbuffer as there is an issue - * with this register not getting restored on ctx restore + * WA also requires GEN9_SLICE_COMMON_ECO_CHICKEN0[14:14] to be + * set but we do that in per ctx batchbuffer as there is an + * issue with this register not getting restored on ctx restore. */ } @@ -1029,10 +1059,11 @@ void i915_whitelist_workarounds_apply(struct intel_engine_cs *engine) * but there is a slight complication as this is applied in WA batch where the * values are only initialized once so we cannot take register value at the * beginning and reuse it further; hence we save its value to memory, upload a - * constant value with bit21 set and then we restore it back with the saved value. + * constant value with bit21 set and then we restore it back with the saved + * value. * To simplify the WA, a constant value is formed by using the default value * of this register. This shouldn't be a problem because we are only modifying - * it for a short period and this batch in non-premptible. We can ofcourse + * it for a short period and this batch in non-premptible. We can of course * use additional instructions that read the actual value of the register * at that time and set our bit of interest but it makes the WA complicated. * @@ -1068,8 +1099,8 @@ void i915_whitelist_workarounds_apply(struct intel_engine_cs *engine) * Typically we only have one indirect_ctx and per_ctx batch buffer which are * initialized at the beginning and shared across all contexts but this field * helps us to have multiple batches at different offsets and select them based - * on a criteria. At the moment this batch always start at the beginning of the page - * and at this point we don't have multiple wa_ctx batch buffers. + * on a criteria. At the moment this batch always start at the beginning of the + * page and at this point we don't have multiple wa_ctx batch buffers. * * The number of WA applied are not known at the beginning; we use this field * to return the no of DWORDS written.