public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jackie Li <yaodong.li@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v6 4/6] drm/i915/guc: Add WOPCM partitioning support for CNL
Date: Mon,  8 Jan 2018 16:07:17 -0800	[thread overview]
Message-ID: <1515456439-529-4-git-send-email-yaodong.li@intel.com> (raw)
In-Reply-To: <1515456439-529-1-git-send-email-yaodong.li@intel.com>

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 <michal.wajdeczko@intel.com>
Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Cc: John Spotswood <john.a.spotswood@intel.com>
Cc: Jeff McGee <jeff.mcgee@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Jackie Li <yaodong.li@intel.com>
---
 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)
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-01-09  0:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-09  0:07 [PATCH v6 1/6] drm/i915/guc: Move GuC WOPCM related code into separate files Jackie Li
2018-01-09  0:07 ` [PATCH v6 2/6] drm/i915/guc: Rename guc_ggtt_offset to intel_guc_ggtt_offset Jackie Li
2018-01-09  0:07 ` [PATCH v6 3/6] drm/i915/guc: Implement dynamic GuC WOPCM offset and size Jackie Li
2018-01-09  0:07 ` Jackie Li [this message]
2018-01-09  0:07 ` [PATCH v6 5/6] drm/i915/guc: Check the locking status of GuC WOPCM registers Jackie Li
2018-01-09  0:07 ` [PATCH v6 6/6] HAX Enable GuC Submission for CI Jackie Li
2018-01-09  0:37 ` ✓ Fi.CI.BAT: success for series starting with [v6,1/6] drm/i915/guc: Move GuC WOPCM related code into separate files Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1515456439-529-4-git-send-email-yaodong.li@intel.com \
    --to=yaodong.li@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox