From patchwork Tue Jan 9 00:07:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jackie Li X-Patchwork-Id: 10150783 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 B7A86601A1 for ; Tue, 9 Jan 2018 00:08:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD67A284B5 for ; Tue, 9 Jan 2018 00:08:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A27E028999; Tue, 9 Jan 2018 00:08:45 +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 53BEF284B5 for ; Tue, 9 Jan 2018 00:08:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 07AAE6E688; Tue, 9 Jan 2018 00:08:45 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id E004A6E08C for ; Tue, 9 Jan 2018 00:08:39 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2018 16:08:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,333,1511856000"; d="scan'208";a="20010517" Received: from yli84-z170x-ud5.fm.intel.com ([10.19.83.14]) by fmsmga001.fm.intel.com with ESMTP; 08 Jan 2018 16:08:39 -0800 From: Jackie Li To: intel-gfx@lists.freedesktop.org Date: Mon, 8 Jan 2018 16:07:17 -0800 Message-Id: <1515456439-529-4-git-send-email-yaodong.li@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515456439-529-1-git-send-email-yaodong.li@intel.com> References: <1515456439-529-1-git-send-email-yaodong.li@intel.com> Subject: [Intel-gfx] [PATCH v6 4/6] drm/i915/guc: Add WOPCM partitioning support for CNL 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 CNL has different WOPCM size and hardware restriction on GuC WOPCM size. This patch returns the correct WOPCM reserved size on CNL and adds the GuC WOPCM size check for CNL. v6: - extended HuC FW size check against GuC WOPCM size to all Gen9 and CNL A0 platforms Cc: Michal Wajdeczko Cc: Sagar Arun Kamble Cc: John Spotswood Cc: Jeff McGee Cc: Chris Wilson Cc: Joonas Lahtinen Signed-off-by: Jackie Li --- drivers/gpu/drm/i915/intel_guc_wopcm.c | 24 +++++++++++++++++++++++- drivers/gpu/drm/i915/intel_guc_wopcm.h | 4 ++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_guc_wopcm.c b/drivers/gpu/drm/i915/intel_guc_wopcm.c index 0532714..1c92775 100644 --- a/drivers/gpu/drm/i915/intel_guc_wopcm.c +++ b/drivers/gpu/drm/i915/intel_guc_wopcm.c @@ -33,6 +33,25 @@ static inline u32 guc_reserved_wopcm_size(struct intel_guc *guc) if (IS_GEN9_LP(i915)) return BXT_WOPCM_RC6_RESERVED; + if (IS_GEN10(i915)) + return CNL_WOPCM_RESERVED; + + return 0; +} + +/* + * On Gen9 & CNL A0, hardware requires GuC size to be larger than or equal to + * HuC kernel size. + */ +static inline int wopcm_huc_size_check(struct drm_i915_private *i915) +{ + struct intel_guc_wopcm *wopcm = &i915->guc.wopcm; + u32 huc_size = intel_uc_fw_get_size(&i915->huc.fw); + + + if (unlikely(wopcm->size - GUC_WOPCM_RESERVED < huc_size)) + return -E2BIG; + return 0; } @@ -55,7 +74,7 @@ static inline int gen9_wocpm_size_check(struct drm_i915_private *i915) if (unlikely(delta < GEN9_GUC_WOPCM_DELTA)) return -E2BIG; - return 0; + return wopcm_huc_size_check(i915); } static inline int guc_wopcm_size_check(struct intel_guc *guc) @@ -65,6 +84,9 @@ static inline int guc_wopcm_size_check(struct intel_guc *guc) if (IS_GEN9(i915)) return gen9_wocpm_size_check(i915); + if (IS_CNL_REVID(i915, CNL_REVID_A0, CNL_REVID_A0)) + return wopcm_huc_size_check(i915); + return 0; } diff --git a/drivers/gpu/drm/i915/intel_guc_wopcm.h b/drivers/gpu/drm/i915/intel_guc_wopcm.h index 352cf3d..5306175 100644 --- a/drivers/gpu/drm/i915/intel_guc_wopcm.h +++ b/drivers/gpu/drm/i915/intel_guc_wopcm.h @@ -37,8 +37,12 @@ struct intel_guc; #define WOPCM_OFFSET_ALIGNMENT (0x4000) /* 8KB stack reserved for GuC FW*/ #define GUC_WOPCM_STACK_RESERVED (0x2000) +/* 16KB reserved at the beginning of GuC WOPCM */ +#define GUC_WOPCM_RESERVED (0x4000) /* 24KB WOPCM reserved for RC6 CTX on BXT */ #define BXT_WOPCM_RC6_RESERVED (0x6000) +/* 36KB WOPCM reserved on CNL */ +#define CNL_WOPCM_RESERVED (0x9000) #define GEN9_GUC_WOPCM_DELTA 4 #define GEN9_GUC_WOPCM_OFFSET (0x24000)