From patchwork Tue Feb 6 00:02:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jackie Li X-Patchwork-Id: 10202051 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 DAB23602CA for ; Tue, 6 Feb 2018 00:04:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA04828731 for ; Tue, 6 Feb 2018 00:04:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BECF32874E; Tue, 6 Feb 2018 00:04:25 +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 684C628731 for ; Tue, 6 Feb 2018 00:04:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D2946E38C; Tue, 6 Feb 2018 00:04:24 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 34BF66E389 for ; Tue, 6 Feb 2018 00:04:22 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Feb 2018 16:04:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,466,1511856000"; d="scan'208";a="24936974" Received: from yli84-z170x-ud5.fm.intel.com ([10.19.83.14]) by orsmga003.jf.intel.com with ESMTP; 05 Feb 2018 16:04:21 -0800 From: Jackie Li To: intel-gfx@lists.freedesktop.org Date: Mon, 5 Feb 2018 16:02:40 -0800 Message-Id: <1517875362-12755-4-git-send-email-yaodong.li@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517875362-12755-1-git-send-email-yaodong.li@intel.com> References: <1517875362-12755-1-git-send-email-yaodong.li@intel.com> Subject: [Intel-gfx] [PATCH v8 4/6] drm/i915/guc: Add dynamic GuC WOPCM offset and size support for CNL X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 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 CNL has its own specific reserved GuC WOPCM size and hardware restrictions on GuC WOPCM size. On CNL A0 and Gen9, there's a hardware restriction that requires the available GuC WOPCM size to be larger than or equal to HuC firmware size. This patch updates GuC WOPCM init code to return the CNL specific reserved GuC WOPCM size and also adds new verfication code to ensure the available GuC WOPCM size to be larger than or equal to HuC firmware size on both Gen9 and CNL A0. v6: - Extended HuC FW size check against GuC WOPCM size to all Gen9 and CNL A0 platforms v7: - Fixed patch format issues v8: - Renamed variables and functions to avoid ambiguity (Joonas) - Updated commit message and comments to be more comprehensive (Sagar) Cc: Michal Wajdeczko Cc: Sagar Arun Kamble Cc: John Spotswood Cc: Jeff McGee Cc: Chris Wilson Cc: Joonas Lahtinen Signed-off-by: Jackie Li Reviewed-by: Sagar Arun Kamble --- drivers/gpu/drm/i915/intel_guc_wopcm.c | 24 +++++++++++++++++++++++- drivers/gpu/drm/i915/intel_guc_wopcm.h | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_guc_wopcm.c b/drivers/gpu/drm/i915/intel_guc_wopcm.c index 1555e79..3cba9ac 100644 --- a/drivers/gpu/drm/i915/intel_guc_wopcm.c +++ b/drivers/gpu/drm/i915/intel_guc_wopcm.c @@ -32,6 +32,25 @@ static inline u32 guc_reserved_wopcm_size(struct intel_guc *guc) if (IS_GEN9_LP(i915)) return BXT_GUC_WOPCM_RC6_RESERVED; + if (IS_GEN10(i915)) + return CNL_GUC_WOPCM_RESERVED; + + return 0; +} + +static inline int guc_wopcm_check_huc_fw_size(struct drm_i915_private *i915) +{ + struct intel_guc_wopcm *wopcm = &i915->guc.wopcm; + u32 huc_fw_size = intel_uc_fw_get_size(&i915->huc.fw); + + /* + * On Gen9 & CNL A0, hardware requires the total available GuC WOPCM + * size to be larger than or equal to HuC firmware size. Otherwise, + * firmware uploading would fail. + */ + if (unlikely(wopcm->size - GUC_WOPCM_RESERVED < huc_fw_size)) + return -E2BIG; + return 0; } @@ -54,7 +73,7 @@ static inline int gen9_guc_wopcm_size_check(struct drm_i915_private *i915) if (unlikely(delta < GEN9_GUC_WOPCM_DELTA)) return -E2BIG; - return 0; + return guc_wopcm_check_huc_fw_size(i915); } static inline int guc_wopcm_check_hw_restrictions(struct intel_guc *guc) @@ -64,6 +83,9 @@ static inline int guc_wopcm_check_hw_restrictions(struct intel_guc *guc) if (IS_GEN9(i915)) return gen9_guc_wopcm_size_check(i915); + if (IS_CNL_REVID(i915, CNL_REVID_A0, CNL_REVID_A0)) + return guc_wopcm_check_huc_fw_size(i915); + return 0; } diff --git a/drivers/gpu/drm/i915/intel_guc_wopcm.h b/drivers/gpu/drm/i915/intel_guc_wopcm.h index 28e4103..8c71d20a 100644 --- a/drivers/gpu/drm/i915/intel_guc_wopcm.h +++ b/drivers/gpu/drm/i915/intel_guc_wopcm.h @@ -42,6 +42,8 @@ struct intel_guc; #define GUC_WOPCM_STACK_RESERVED (0x2000) /* 24KB at the end of GuC WOPCM is reserved for RC6 CTX on BXT. */ #define BXT_GUC_WOPCM_RC6_RESERVED (0x6000) +/* 36KB WOPCM reserved at the end of GuC WOPCM on CNL */ +#define CNL_GUC_WOPCM_RESERVED (0x9000) #define GEN9_GUC_WOPCM_DELTA 4 /**