From patchwork Tue Dec 12 22:56:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jackie Li X-Patchwork-Id: 10108427 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 AB1FE6034B for ; Tue, 12 Dec 2017 22:57:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D8BF1FF41 for ; Tue, 12 Dec 2017 22:57:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9238120246; Tue, 12 Dec 2017 22:57:55 +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 4260228526 for ; Tue, 12 Dec 2017 22:57:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C8E2489C2C; Tue, 12 Dec 2017 22:57:53 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 95BEA89A5C for ; Tue, 12 Dec 2017 22:57:51 +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 fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Dec 2017 14:57:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,395,1508828400"; d="scan'208";a="17718338" Received: from yli84-z170x-ud5.fm.intel.com ([10.19.83.14]) by orsmga002.jf.intel.com with ESMTP; 12 Dec 2017 14:57:49 -0800 From: Jackie Li To: intel-gfx@lists.freedesktop.org Date: Tue, 12 Dec 2017 14:56:33 -0800 Message-Id: <1513119394-28951-4-git-send-email-yaodong.li@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513119394-28951-1-git-send-email-yaodong.li@intel.com> References: <1513119394-28951-1-git-send-email-yaodong.li@intel.com> Subject: [Intel-gfx] [PATCH v4 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 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 60a6afe..e23d7a4 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 2f9d03a..5bb5092 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;