On 1/19/2018 6:59 AM, Jackie Li wrote:
CNL has different WOPCM size and hardware restriction on GuC
WOPCM size.
You are also updating gen9 path so update subject and commit message.
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
v7:
- Fixed patch format issues
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>
---
drivers/gpu/drm/i915/intel_guc_wopcm.c | 23 ++++++++++++++++++++++-
drivers/gpu/drm/i915/intel_guc_wopcm.h | 4 ++++
2 files changed, 26 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..ed3096c 100644
--- a/drivers/gpu/drm/i915/intel_guc_wopcm.c
+++ b/drivers/gpu/drm/i915/intel_guc_wopcm.c
@@ -33,6 +33,24 @@ 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
Is there workaround name for this?
+ * 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 +73,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 +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 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)
But then this is not considered in guc_wopcm_init like STACK_RESERVED
/* 24KB WOPCM reserved for RC6 CTX on BXT */
#define BXT_WOPCM_RC6_RESERVED (0x6000)
+/* 36KB WOPCM reserved on CNL */
+#define CNL_WOPCM_RESERVED (0x9000)
CNL_GUC_WOPCM_END_RC6_RESERVED?
#define GEN9_GUC_WOPCM_DELTA 4
#define GEN9_GUC_WOPCM_OFFSET (0x24000)
--
Thanks,
Sagar
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx