From patchwork Fri Dec 8 21:41:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jackie Li X-Patchwork-Id: 10103349 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 9AF7160329 for ; Fri, 8 Dec 2017 21:43:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F1C328F3A for ; Fri, 8 Dec 2017 21:43:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8440128F98; Fri, 8 Dec 2017 21:43:24 +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 420CB28F3A for ; Fri, 8 Dec 2017 21:43:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 61C096E994; Fri, 8 Dec 2017 21:43:23 +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 5AB336E990 for ; Fri, 8 Dec 2017 21:43:20 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Dec 2017 13:43:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,379,1508828400"; d="scan'208";a="16698202" Received: from yli84-z170x-ud5.fm.intel.com ([10.19.83.14]) by orsmga002.jf.intel.com with ESMTP; 08 Dec 2017 13:43:19 -0800 From: Jackie Li To: intel-gfx@lists.freedesktop.org Date: Fri, 8 Dec 2017 13:41:51 -0800 Message-Id: <1512769312-21993-4-git-send-email-yaodong.li@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512769312-21993-1-git-send-email-yaodong.li@intel.com> References: <1512769312-21993-1-git-send-email-yaodong.li@intel.com> Subject: [Intel-gfx] [PATCH v3 4/5] 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 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 61faf8f..b5d5501 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 ((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 cabf005..63fa237 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;