From patchwork Mon Jan 8 18:29:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jackie Li X-Patchwork-Id: 10150283 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 83BBA602CA for ; Mon, 8 Jan 2018 18:30:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 946802899D for ; Mon, 8 Jan 2018 18:30:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88AF4289A1; Mon, 8 Jan 2018 18:30: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 3F2BD2899D for ; Mon, 8 Jan 2018 18:30:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A69A86E63C; Mon, 8 Jan 2018 18:30:44 +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 7F6436E638 for ; Mon, 8 Jan 2018 18:30:42 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2018 10:30:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,330,1511856000"; d="scan'208";a="8449020" Received: from yli84-z170x-ud5.fm.intel.com ([10.19.83.14]) by fmsmga002.fm.intel.com with ESMTP; 08 Jan 2018 10:30:42 -0800 From: Jackie Li To: intel-gfx@lists.freedesktop.org Date: Mon, 8 Jan 2018 10:29:14 -0800 Message-Id: <1515436156-17954-4-git-send-email-yaodong.li@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515436156-17954-1-git-send-email-yaodong.li@intel.com> References: <1515436156-17954-1-git-send-email-yaodong.li@intel.com> Subject: [Intel-gfx] [PATCH v5 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. 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 | 21 +++++++++++++++++++++ drivers/gpu/drm/i915/intel_guc_wopcm.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_guc_wopcm.c b/drivers/gpu/drm/i915/intel_guc_wopcm.c index fd2ac12..2523fef 100644 --- a/drivers/gpu/drm/i915/intel_guc_wopcm.c +++ b/drivers/gpu/drm/i915/intel_guc_wopcm.c @@ -33,6 +33,9 @@ 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; } @@ -58,6 +61,21 @@ static inline int gen9_wocpm_size_check(struct drm_i915_private *i915) return 0; } +static inline int cnl_a0_wopcm_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); + + /* + * On CNL A0, hardware requires guc size to be larger than or equal to + * HuC kernel size. + */ + if (unlikely(wopcm->size - GEN10_GUC_WOPCM_OFFSET < huc_size)) + return -E2BIG; + + return 0; +} + static inline int guc_wopcm_size_check(struct intel_guc *guc) { struct drm_i915_private *i915 = guc_to_i915(guc); @@ -65,6 +83,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 cnl_a0_wopcm_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..0ce31ee 100644 --- a/drivers/gpu/drm/i915/intel_guc_wopcm.h +++ b/drivers/gpu/drm/i915/intel_guc_wopcm.h @@ -39,9 +39,12 @@ struct intel_guc; #define GUC_WOPCM_STACK_RESERVED (0x2000) /* 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) +#define GEN10_GUC_WOPCM_OFFSET (0x4000) struct intel_guc_wopcm { u32 offset;