Re: [PATCH v8 4/6] drm/i915/guc: Add dynamic GuC WOPCM offset and size support for CNL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 06 Feb 2018 07:31:06 +0100, Sagar Arun Kamble <sagar.a.kamble@xxxxxxxxx> wrote:



On 2/6/2018 5:32 AM, Jackie Li wrote:
CNL has its own specific reserved GuC WOPCM size and hardware restrictions on GuC WOPCM size. On CNL A0 and Gen9, there's a hardware restriction that
requires the available GuC WOPCM size to be larger than or equal to HuC
firmware size.

This patch updates GuC WOPCM init code to return the CNL specific reserved GuC WOPCM size and also adds new verfication code to ensure the available GuC WOPCM size to be larger than or equal to HuC firmware size on both Gen9
and CNL A0.

v6:
  - Extended HuC FW size check against GuC WOPCM size to all
    Gen9 and CNL A0 platforms

v7:
  - Fixed patch format issues

v8:
  - Renamed variables and functions to avoid ambiguity (Joonas)
  - Updated commit message and comments to be more comprehensive (Sagar)

Cc: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx>
Cc: Sagar Arun Kamble <sagar.a.kamble@xxxxxxxxx>
Cc: John Spotswood <john.a.spotswood@xxxxxxxxx>
Cc: Jeff McGee <jeff.mcgee@xxxxxxxxx>
Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
Signed-off-by: Jackie Li <yaodong.li@xxxxxxxxx>
Need to update subject as "Update WOPCM restrictions for CNL and add HuC size related restriction for Gen9 and CNL A0"
Or else breaking into two patches would have been good idea.

+1 for split

But change looks good to me.
Reviewed-by: Sagar Arun Kamble <sagar.a.kamble@xxxxxxxxx>
---
  drivers/gpu/drm/i915/intel_guc_wopcm.c | 24 +++++++++++++++++++++++-
  drivers/gpu/drm/i915/intel_guc_wopcm.h |  2 ++
  2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_guc_wopcm.c b/drivers/gpu/drm/i915/intel_guc_wopcm.c
index 1555e79..3cba9ac 100644
--- a/drivers/gpu/drm/i915/intel_guc_wopcm.c
+++ b/drivers/gpu/drm/i915/intel_guc_wopcm.c
@@ -32,6 +32,25 @@ static inline u32 guc_reserved_wopcm_size(struct intel_guc *guc)
  	if (IS_GEN9_LP(i915))
  		return BXT_GUC_WOPCM_RC6_RESERVED;
  +	if (IS_GEN10(i915))
+		return CNL_GUC_WOPCM_RESERVED;
+
+	return 0;
+}
+
+static inline int guc_wopcm_check_huc_fw_size(struct drm_i915_private *i915)
+{
+	struct intel_guc_wopcm *wopcm = &i915->guc.wopcm;
+	u32 huc_fw_size = intel_uc_fw_get_size(&i915->huc.fw);

HuC fw size was passed as param to intel_guc_wopcm_init() but here
you decided to read it directly ?

+
+	/*
+	 * On Gen9 & CNL A0, hardware requires the total available GuC WOPCM
+	 * size to be larger than or equal to HuC firmware size. Otherwise,
+	 * firmware uploading would fail.
+	 */
+	if (unlikely(wopcm->size - GUC_WOPCM_RESERVED < huc_fw_size))
+		return -E2BIG;
+
  	return 0;
  }
@@ -54,7 +73,7 @@ static inline int gen9_guc_wopcm_size_check(struct drm_i915_private *i915)
  	if (unlikely(delta < GEN9_GUC_WOPCM_DELTA))
  		return -E2BIG;
  -	return 0;
+	return guc_wopcm_check_huc_fw_size(i915);
  }
static inline int guc_wopcm_check_hw_restrictions(struct intel_guc *guc) @@ -64,6 +83,9 @@ static inline int guc_wopcm_check_hw_restrictions(struct intel_guc *guc)
  	if (IS_GEN9(i915))
  		return gen9_guc_wopcm_size_check(i915);
  +	if (IS_CNL_REVID(i915, CNL_REVID_A0, CNL_REVID_A0))
+		return guc_wopcm_check_huc_fw_size(i915);
+
  	return 0;
  }
diff --git a/drivers/gpu/drm/i915/intel_guc_wopcm.h b/drivers/gpu/drm/i915/intel_guc_wopcm.h
index 28e4103..8c71d20a 100644
--- a/drivers/gpu/drm/i915/intel_guc_wopcm.h
+++ b/drivers/gpu/drm/i915/intel_guc_wopcm.h
@@ -42,6 +42,8 @@ struct intel_guc;
  #define GUC_WOPCM_STACK_RESERVED	(0x2000)
  /* 24KB at the end of GuC WOPCM is reserved for RC6 CTX on BXT. */
  #define BXT_GUC_WOPCM_RC6_RESERVED	(0x6000)
+/* 36KB WOPCM reserved at the end of GuC WOPCM on CNL */
+#define CNL_GUC_WOPCM_RESERVED		(0x9000)
    #define GEN9_GUC_WOPCM_DELTA		4
  /**
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux