Skip to contentSkip to conversation

Firmware code reorg

PATCH Superseded Michal Wajdeczko 4 participants 27 messages Oct 12, 2017 – Oct 13, 2017

Subsystems (2)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover Firmware code reorg

v1: was sent with wrong prefix "P v4"
v2: apply review comments from Chris/Daniele
v3: restore DRM_WARN, add firmware url

Michal Wajdeczko (14):
drm/i915: Move intel_guc_wopcm_size to intel_guc.c drm/i915/guc: Move GuC boot param initialization out of xfer drm/i915/guc: Small fixups post code move drm/i915/guc: Move doc near related definitions drm/i915/guc: Rename intel_guc_loader.c to intel_guc_fw.c drm/i915/guc: Reorder functions in intel_guc_fw.c drm/i915/guc: Move firmware size check out of generic code drm/i915/guc: Pick better place for Guc final status message drm/i915/uc: Improve debug messages in firmware fetch drm/i915/uc: Add message with firmware url drm/i915/uc: Unify firmware loading
drm/i915/guc: Update Guc messages on load failure drm/i915/huc: Move fw select function
HAX enable GuC submission for CI

 drivers/gpu/drm/i915/Makefile           |   2 +-
 drivers/gpu/drm/i915/i915_gem_gtt.c     |   8 +-
 drivers/gpu/drm/i915/i915_params.h      |   4 +-
 drivers/gpu/drm/i915/intel_guc.c        | 104 ++++++++
 drivers/gpu/drm/i915/intel_guc.h        |  16 +-
 drivers/gpu/drm/i915/intel_guc_fw.c     | 256 ++++++++++++++++++++
 drivers/gpu/drm/i915/intel_guc_fw.h     |  33 +++
 drivers/gpu/drm/i915/intel_guc_fwif.h   |   4 +-
 drivers/gpu/drm/i915/intel_guc_loader.c | 417 --------------------------------
 drivers/gpu/drm/i915/intel_huc.c        | 125 ++++------
 drivers/gpu/drm/i915/intel_uc.c         |  20 +-
 drivers/gpu/drm/i915/intel_uc_fw.c      | 164 ++++++++++---
 drivers/gpu/drm/i915/intel_uc_fw.h      |  11 +
 13 files changed, 606 insertions(+), 558 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_guc_fw.c
 create mode 100644 drivers/gpu/drm/i915/intel_guc_fw.h
 delete mode 100644 drivers/gpu/drm/i915/intel_guc_loader.c
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v3 1/14 drm/i915: Move intel_guc_wopcm_size to intel_guc.c

Function intel_guc_wopcm_size didn't fit well in the old place. With this move upcoming cleanup will be simpler.

---
 drivers/gpu/drm/i915/intel_guc.c        | 11 +++++++++++
 drivers/gpu/drm/i915/intel_guc_loader.c | 11 -----------
 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_guc.c +11 -0
index 9e18c4f..be1c9a7 100644
@@ -263,3 +263,14 @@ struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size)
 	i915_gem_object_put(obj);
 	return vma;
 }
+
+u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv)
+{
+	u32 wopcm_size = GUC_WOPCM_TOP;
+
+	/* On BXT, the top of WOPCM is reserved for RC6 context */
+	if (IS_GEN9_LP(dev_priv))
+		wopcm_size -= BXT_GUC_WOPCM_RC6_RESERVED;
+
+	return wopcm_size;
+}
drivers/gpu/drm/i915/intel_guc_loader.c +0 -11
index c7a800a..30b70f5 100644
@@ -250,17 +250,6 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
 	return ret;
 }
 
-u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv)
-{
-	u32 wopcm_size = GUC_WOPCM_TOP;
-
-	/* On BXT, the top of WOPCM is reserved for RC6 context */
-	if (IS_GEN9_LP(dev_priv))
-		wopcm_size -= BXT_GUC_WOPCM_RC6_RESERVED;
-
-	return wopcm_size;
-}
-
 /*
  * Load the GuC firmware blob into the MinuteIA.
  */
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH v3 2/14 drm/i915/guc: Move GuC boot param initialization out of xfer

In reply to Michal Wajdeczko

We want to keep ucode xfer functions separate from other initialization. Once separated, add explicit forcewake.

v2: use BLITTER domain only and add comment (Daniele)

---
 drivers/gpu/drm/i915/intel_guc.c        | 92 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_guc.h        |  1 +
 drivers/gpu/drm/i915/intel_guc_loader.c | 85 ------------------------------
 drivers/gpu/drm/i915/intel_uc.c         |  1 +
 4 files changed, 94 insertions(+), 85 deletions(-)
drivers/gpu/drm/i915/intel_guc.c +92 -0
index be1c9a7..719144a 100644
@@ -67,6 +67,98 @@ void intel_guc_init_early(struct intel_guc *guc)
 	guc->notify = gen8_guc_raise_irq;
 }
 
+static u32 get_gttype(struct drm_i915_private *dev_priv)
+{
+	/* XXX: GT type based on PCI device ID? field seems unused by fw */
+	return 0;
+}
+
+static u32 get_core_family(struct drm_i915_private *dev_priv)
+{
+	u32 gen = INTEL_GEN(dev_priv);
+
+	switch (gen) {
+	case 9:
+		return GUC_CORE_FAMILY_GEN9;
+
+	default:
+		MISSING_CASE(gen);
+		return GUC_CORE_FAMILY_UNKNOWN;
+	}
+}
+
+/*
+ * Initialise the GuC parameter block before starting the firmware
+ * transfer. These parameters are read by the firmware on startup
+ * and cannot be changed thereafter.
+ */
+void intel_guc_init_params(struct intel_guc *guc)
+{
+	struct drm_i915_private *dev_priv = guc_to_i915(guc);
+	u32 params[GUC_CTL_MAX_DWORDS];
+	int i;
+
+	memset(&params, 0, sizeof(params));
+
+	params[GUC_CTL_DEVICE_INFO] |=
+		(get_gttype(dev_priv) << GUC_CTL_GTTYPE_SHIFT) |
+		(get_core_family(dev_priv) << GUC_CTL_COREFAMILY_SHIFT);
+
+	/*
+	 * GuC ARAT increment is 10 ns. GuC default scheduler quantum is one
+	 * second. This ARAR is calculated by:
+	 * Scheduler-Quantum-in-ns / ARAT-increment-in-ns = 1000000000 / 10
+	 */
+	params[GUC_CTL_ARAT_HIGH] = 0;
+	params[GUC_CTL_ARAT_LOW] = 100000000;
+
+	params[GUC_CTL_WA] |= GUC_CTL_WA_UK_BY_DRIVER;
+
+	params[GUC_CTL_FEATURE] |= GUC_CTL_DISABLE_SCHEDULER |
+			GUC_CTL_VCS2_ENABLED;
+
+	params[GUC_CTL_LOG_PARAMS] = guc->log.flags;
+
+	if (i915_modparams.guc_log_level >= 0) {
+		params[GUC_CTL_DEBUG] =
+			i915_modparams.guc_log_level << GUC_LOG_VERBOSITY_SHIFT;
+	} else
+		params[GUC_CTL_DEBUG] = GUC_LOG_DISABLED;
+
+	/* If GuC submission is enabled, set up additional parameters here */
+	if (i915_modparams.enable_guc_submission) {
+		u32 ads = guc_ggtt_offset(guc->ads_vma) >> PAGE_SHIFT;
+		u32 pgs = guc_ggtt_offset(dev_priv->guc.stage_desc_pool);
+		u32 ctx_in_16 = GUC_MAX_STAGE_DESCRIPTORS / 16;
+
+		params[GUC_CTL_DEBUG] |= ads << GUC_ADS_ADDR_SHIFT;
+		params[GUC_CTL_DEBUG] |= GUC_ADS_ENABLED;
+
+		pgs >>= PAGE_SHIFT;
+		params[GUC_CTL_CTXINFO] = (pgs << GUC_CTL_BASE_ADDR_SHIFT) |
+			(ctx_in_16 << GUC_CTL_CTXNUM_IN16_SHIFT);
+
+		params[GUC_CTL_FEATURE] |= GUC_CTL_KERNEL_SUBMISSIONS;
+
+		/* Unmask this bit to enable the GuC's internal scheduler */
+		params[GUC_CTL_FEATURE] &= ~GUC_CTL_DISABLE_SCHEDULER;
+	}
+
+	/*
+	 * All SOFT_SCRATCH registers are in FORCEWAKE_BLITTER domain and
+	 * they are power context saved so it's ok to release forcewake
+	 * when we are done here and take it again at xfer time.
+	 */
+	intel_uncore_forcewake_get(dev_priv, FORCEWAKE_BLITTER);
+
+	I915_WRITE(SOFT_SCRATCH(0), 0);
+
+	for (i = 0; i < GUC_CTL_MAX_DWORDS; i++)
+		I915_WRITE(SOFT_SCRATCH(1 + i), params[i]);
+
+	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_BLITTER);
+}
+
 int intel_guc_send_nop(struct intel_guc *guc, const u32 *action, u32 len)
 {
 	WARN(1, "Unexpected send: action=%#x\n", *action);
drivers/gpu/drm/i915/intel_guc.h +1 -0
index aa9a7b5..8b44165 100644
@@ -95,6 +95,7 @@ static inline u32 guc_ggtt_offset(struct i915_vma *vma)
 
 void intel_guc_init_early(struct intel_guc *guc);
 void intel_guc_init_send_regs(struct intel_guc *guc);
+void intel_guc_init_params(struct intel_guc *guc);
 int intel_guc_send_nop(struct intel_guc *guc, const u32 *action, u32 len);
 int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len);
 int intel_guc_sample_forcewake(struct intel_guc *guc);
drivers/gpu/drm/i915/intel_guc_loader.c +0 -85

97 lines not on this page · raw message

drivers/gpu/drm/i915/intel_uc.c +1 -0
index 7b938e8..53fdd9a 100644
@@ -195,6 +195,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 			goto err_submission;
 
 		intel_huc_init_hw(&dev_priv->huc);
+		intel_guc_init_params(guc);
 		ret = intel_guc_init_hw(&dev_priv->guc);
 		if (ret == 0 || ret != -EAGAIN)
 			break;
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH v3 02/14] drm/i915/guc: Move GuC boot param initialization out of xfer

Quoted 24 lines · Michal Wajdeczko

We want to keep ucode xfer functions separate from other initialization. Once separated, add explicit forcewake.

v2: use BLITTER domain only and add comment (Daniele)

---
  drivers/gpu/drm/i915/intel_guc.c        | 92 +++++++++++++++++++++++++++++++++
  drivers/gpu/drm/i915/intel_guc.h        |  1 +
  drivers/gpu/drm/i915/intel_guc_loader.c | 85 ------------------------------
  drivers/gpu/drm/i915/intel_uc.c         |  1 +
  4 files changed, 94 insertions(+), 85 deletions(-)
drivers/gpu/drm/i915/intel_guc.c +0 -0
index be1c9a7..719144a 100644

drivers/gpu/drm/i915/intel_guc.c void intel_guc_init_early(struct intel_guc *guc) · line 70

Quoted 4 lines
drivers/gpu/drm/i915/intel_guc.c +1 -0
@@ -67,6 +67,98 @@ void intel_guc_init_early(struct intel_guc *guc)
  	guc->notify = gen8_guc_raise_irq;
  }
 
+static u32 get_gttype(struct drm_i915_private *dev_priv)

I think renaming this as get_gt_type as suggested would be good.

Quoted 46 lines
drivers/gpu/drm/i915/intel_guc.c +46 -0
+{
+	/* XXX: GT type based on PCI device ID? field seems unused by fw */
+	return 0;
+}
+
+static u32 get_core_family(struct drm_i915_private *dev_priv)
+{
+	u32 gen = INTEL_GEN(dev_priv);
+
+	switch (gen) {
+	case 9:
+		return GUC_CORE_FAMILY_GEN9;
+
+	default:
+		MISSING_CASE(gen);
+		return GUC_CORE_FAMILY_UNKNOWN;
+	}
+}
+
+/*
+ * Initialise the GuC parameter block before starting the firmware
+ * transfer. These parameters are read by the firmware on startup
+ * and cannot be changed thereafter.
+ */
+void intel_guc_init_params(struct intel_guc *guc)
+{
+	struct drm_i915_private *dev_priv = guc_to_i915(guc);
+	u32 params[GUC_CTL_MAX_DWORDS];
+	int i;
+
+	memset(&params, 0, sizeof(params));
+
+	params[GUC_CTL_DEVICE_INFO] |=
+		(get_gttype(dev_priv) << GUC_CTL_GTTYPE_SHIFT) |
+		(get_core_family(dev_priv) << GUC_CTL_COREFAMILY_SHIFT);
+
+	/*
+	 * GuC ARAT increment is 10 ns. GuC default scheduler quantum is one
+	 * second. This ARAR is calculated by:
+	 * Scheduler-Quantum-in-ns / ARAT-increment-in-ns = 1000000000 / 10
+	 */
+	params[GUC_CTL_ARAT_HIGH] = 0;
+	params[GUC_CTL_ARAT_LOW] = 100000000;
+
+	params[GUC_CTL_WA] |= GUC_CTL_WA_UK_BY_DRIVER;
+

drivers/gpu/drm/i915/intel_guc.c void intel_guc_init_early(struct intel_guc *guc) · line 126

Quoted 10 lines
drivers/gpu/drm/i915/intel_guc.c +10 -0
+	params[GUC_CTL_FEATURE] |= GUC_CTL_DISABLE_SCHEDULER |
+			GUC_CTL_VCS2_ENABLED;
+
+	params[GUC_CTL_LOG_PARAMS] = guc->log.flags;
+
+	if (i915_modparams.guc_log_level >= 0) {
+		params[GUC_CTL_DEBUG] =
+			i915_modparams.guc_log_level << GUC_LOG_VERBOSITY_SHIFT;
+	} else
+		params[GUC_CTL_DEBUG] = GUC_LOG_DISABLED;

Unbalanced {} here. Doing this checkpatch fix now would be good.

Quoted 21 lines
drivers/gpu/drm/i915/intel_guc.c +21 -0
+
+	/* If GuC submission is enabled, set up additional parameters here */
+	if (i915_modparams.enable_guc_submission) {
+		u32 ads = guc_ggtt_offset(guc->ads_vma) >> PAGE_SHIFT;
+		u32 pgs = guc_ggtt_offset(dev_priv->guc.stage_desc_pool);
+		u32 ctx_in_16 = GUC_MAX_STAGE_DESCRIPTORS / 16;
+
+		params[GUC_CTL_DEBUG] |= ads << GUC_ADS_ADDR_SHIFT;
+		params[GUC_CTL_DEBUG] |= GUC_ADS_ENABLED;
+
+		pgs >>= PAGE_SHIFT;
+		params[GUC_CTL_CTXINFO] = (pgs << GUC_CTL_BASE_ADDR_SHIFT) |
+			(ctx_in_16 << GUC_CTL_CTXNUM_IN16_SHIFT);
+
+		params[GUC_CTL_FEATURE] |= GUC_CTL_KERNEL_SUBMISSIONS;
+
+		/* Unmask this bit to enable the GuC's internal scheduler */
+		params[GUC_CTL_FEATURE] &= ~GUC_CTL_DISABLE_SCHEDULER;
+	}
+
+	/*

drivers/gpu/drm/i915/intel_guc.c void intel_guc_init_early(struct intel_guc *guc) · line 157

Quoted 10 lines
drivers/gpu/drm/i915/intel_guc.c +10 -0
+	 * All SOFT_SCRATCH registers are in FORCEWAKE_BLITTER domain and
+	 * they are power context saved so it's ok to release forcewake
+	 * when we are done here and take it again at xfer time.
+	 */
+	intel_uncore_forcewake_get(dev_priv, FORCEWAKE_BLITTER);
+
+	I915_WRITE(SOFT_SCRATCH(0), 0);
+
+	for (i = 0; i < GUC_CTL_MAX_DWORDS; i++)
+		I915_WRITE(SOFT_SCRATCH(1 + i), params[i]);

May be for later (since retry is only for Gen9) but will it be good idea to keep these params in intel_guc struct and just doing register writes during guc_init_hw. That way possibly we can move the params initialization to guc_submission_init (although that is more than submission currently)

Quoted 127 lines
drivers/gpu/drm/i915/intel_guc.c +4 -0
+
+	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_BLITTER);
+}
+
  int intel_guc_send_nop(struct intel_guc *guc, const u32 *action, u32 len)
  {
  	WARN(1, "Unexpected send: action=%#x\n", *action);
drivers/gpu/drm/i915/intel_guc.h +1 -0
index aa9a7b5..8b44165 100644
@@ -95,6 +95,7 @@ static inline u32 guc_ggtt_offset(struct i915_vma *vma)
 
  void intel_guc_init_early(struct intel_guc *guc);
  void intel_guc_init_send_regs(struct intel_guc *guc);
+void intel_guc_init_params(struct intel_guc *guc);
  int intel_guc_send_nop(struct intel_guc *guc, const u32 *action, u32 len);
  int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len);
  int intel_guc_sample_forcewake(struct intel_guc *guc);
drivers/gpu/drm/i915/intel_guc_loader.c +0 -85
index 30b70f5..d9089bc 100644
@@ -79,89 +79,6 @@ MODULE_FIRMWARE(I915_KBL_GUC_UCODE);
  #define I915_GLK_GUC_UCODE GUC_FW_PATH(glk, GLK_FW_MAJOR, GLK_FW_MINOR)
 
 
-static u32 get_gttype(struct drm_i915_private *dev_priv)
-{
-	/* XXX: GT type based on PCI device ID? field seems unused by fw */
-	return 0;
-}
-
-static u32 get_core_family(struct drm_i915_private *dev_priv)
-{
-	u32 gen = INTEL_GEN(dev_priv);
-
-	switch (gen) {
-	case 9:
-		return GUC_CORE_FAMILY_GEN9;
-
-	default:
-		MISSING_CASE(gen);
-		return GUC_CORE_FAMILY_UNKNOWN;
-	}
-}
-
-/*
- * Initialise the GuC parameter block before starting the firmware
- * transfer. These parameters are read by the firmware on startup
- * and cannot be changed thereafter.
- */
-static void guc_params_init(struct drm_i915_private *dev_priv)
-{
-	struct intel_guc *guc = &dev_priv->guc;
-	u32 params[GUC_CTL_MAX_DWORDS];
-	int i;
-
-	memset(&params, 0, sizeof(params));
-
-	params[GUC_CTL_DEVICE_INFO] |=
-		(get_gttype(dev_priv) << GUC_CTL_GTTYPE_SHIFT) |
-		(get_core_family(dev_priv) << GUC_CTL_COREFAMILY_SHIFT);
-
-	/*
-	 * GuC ARAT increment is 10 ns. GuC default scheduler quantum is one
-	 * second. This ARAR is calculated by:
-	 * Scheduler-Quantum-in-ns / ARAT-increment-in-ns = 1000000000 / 10
-	 */
-	params[GUC_CTL_ARAT_HIGH] = 0;
-	params[GUC_CTL_ARAT_LOW] = 100000000;
-
-	params[GUC_CTL_WA] |= GUC_CTL_WA_UK_BY_DRIVER;
-
-	params[GUC_CTL_FEATURE] |= GUC_CTL_DISABLE_SCHEDULER |
-			GUC_CTL_VCS2_ENABLED;
-
-	params[GUC_CTL_LOG_PARAMS] = guc->log.flags;
-
-	if (i915_modparams.guc_log_level >= 0) {
-		params[GUC_CTL_DEBUG] =
-			i915_modparams.guc_log_level << GUC_LOG_VERBOSITY_SHIFT;
-	} else
-		params[GUC_CTL_DEBUG] = GUC_LOG_DISABLED;
-
-	/* If GuC submission is enabled, set up additional parameters here */
-	if (i915_modparams.enable_guc_submission) {
-		u32 ads = guc_ggtt_offset(guc->ads_vma) >> PAGE_SHIFT;
-		u32 pgs = guc_ggtt_offset(dev_priv->guc.stage_desc_pool);
-		u32 ctx_in_16 = GUC_MAX_STAGE_DESCRIPTORS / 16;
-
-		params[GUC_CTL_DEBUG] |= ads << GUC_ADS_ADDR_SHIFT;
-		params[GUC_CTL_DEBUG] |= GUC_ADS_ENABLED;
-
-		pgs >>= PAGE_SHIFT;
-		params[GUC_CTL_CTXINFO] = (pgs << GUC_CTL_BASE_ADDR_SHIFT) |
-			(ctx_in_16 << GUC_CTL_CTXNUM_IN16_SHIFT);
-
-		params[GUC_CTL_FEATURE] |= GUC_CTL_KERNEL_SUBMISSIONS;
-
-		/* Unmask this bit to enable the GuC's internal scheduler */
-		params[GUC_CTL_FEATURE] &= ~GUC_CTL_DISABLE_SCHEDULER;
-	}
-
-	I915_WRITE(SOFT_SCRATCH(0), 0);
-
-	for (i = 0; i < GUC_CTL_MAX_DWORDS; i++)
-		I915_WRITE(SOFT_SCRATCH(1 + i), params[i]);
-}
-
  /*
   * Read the GuC status register (GUC_STATUS) and store it in the
   * specified location; then return a boolean indicating whether
@@ -301,8 +218,6 @@ static int guc_ucode_xfer(struct drm_i915_private *dev_priv)
  		I915_WRITE(GUC_ARAT_C6DIS, 0x1FF);
  	}
 
-	guc_params_init(dev_priv);
-
  	ret = guc_ucode_xfer_dma(dev_priv, vma);
 
  	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
drivers/gpu/drm/i915/intel_uc.c +0 -0
index 7b938e8..53fdd9a 100644

drivers/gpu/drm/i915/intel_uc.c int intel_uc_init_hw(struct drm_i915_private *dev_priv) · line 201

Quoted 7 lines
drivers/gpu/drm/i915/intel_uc.c +1 -0
@@ -195,6 +195,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
  			goto err_submission;
 
  		intel_huc_init_hw(&dev_priv->huc);
+		intel_guc_init_params(guc);
  		ret = intel_guc_init_hw(&dev_priv->guc);
  		if (ret == 0 || ret != -EAGAIN)
  			break;

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [PATCH v3 02/14] drm/i915/guc: Move GuC boot param initialization out of xfer

Ignore checkpatch related review. Saw the fixes in 03/14

Quoted 255 lines · Sagar Arun Kamble
Quoted 26 lines · Michal Wajdeczko

We want to keep ucode xfer functions separate from other initialization. Once separated, add explicit forcewake.

v2: use BLITTER domain only and add comment (Daniele)

---
  drivers/gpu/drm/i915/intel_guc.c        | 92
+++++++++++++++++++++++++++++++++
  drivers/gpu/drm/i915/intel_guc.h        |  1 +
  drivers/gpu/drm/i915/intel_guc_loader.c | 85
------------------------------
  drivers/gpu/drm/i915/intel_uc.c         |  1 +

  4 files changed, 94 insertions(+), 85 deletions(-)
drivers/gpu/drm/i915/intel_guc.c +0 -0
index be1c9a7..719144a 100644

drivers/gpu/drm/i915/intel_guc.c void intel_guc_init_early(struct intel_guc *guc) · line 69

Quoted 3 lines
drivers/gpu/drm/i915/intel_guc.c +0 -0
@@ -67,6 +67,98 @@ void intel_guc_init_early(struct intel_guc *guc)
       guc->notify = gen8_guc_raise_irq;
   }
   +static u32 get_gttype(struct drm_i915_private *dev_priv)

I think renaming this as get_gt_type as suggested would be good.

Quoted 47 lines
drivers/gpu/drm/i915/intel_guc.c +38 -0
+{
+    /* XXX: GT type based on PCI device ID? field seems unused by fw */
+    return 0;
+}
+
+static u32 get_core_family(struct drm_i915_private *dev_priv)
+{
+    u32 gen = INTEL_GEN(dev_priv);
+
+    switch (gen) {
+    case 9:
+        return GUC_CORE_FAMILY_GEN9;
+
+    default:
+        MISSING_CASE(gen);
+        return GUC_CORE_FAMILY_UNKNOWN;
+    }
+}
+
+/*
+ * Initialise the GuC parameter block before starting the firmware
+ * transfer. These parameters are read by the firmware on startup
+ * and cannot be changed thereafter.
+ */
+void intel_guc_init_params(struct intel_guc *guc)
+{
+    struct drm_i915_private *dev_priv = guc_to_i915(guc);
+    u32 params[GUC_CTL_MAX_DWORDS];
+    int i;
+
+    memset(&params, 0, sizeof(params));
+
+    params[GUC_CTL_DEVICE_INFO] |=
+        (get_gttype(dev_priv) << GUC_CTL_GTTYPE_SHIFT) |
+        (get_core_family(dev_priv) << GUC_CTL_COREFAMILY_SHIFT);
+
+    /*
+     * GuC ARAT increment is 10 ns. GuC default scheduler quantum is 

one
+     * second. This ARAR is calculated by:
+     * Scheduler-Quantum-in-ns / ARAT-increment-in-ns = 1000000000 / 10 +     */
+    params[GUC_CTL_ARAT_HIGH] = 0;
+    params[GUC_CTL_ARAT_LOW] = 100000000;

drivers/gpu/drm/i915/intel_guc.c +3 -0
+
+    params[GUC_CTL_WA] |= GUC_CTL_WA_UK_BY_DRIVER;
+

drivers/gpu/drm/i915/intel_guc.c void intel_guc_init_early(struct intel_guc *guc) · line 126

Quoted 10 lines
drivers/gpu/drm/i915/intel_guc.c +10 -0
+    params[GUC_CTL_FEATURE] |= GUC_CTL_DISABLE_SCHEDULER |
+            GUC_CTL_VCS2_ENABLED;
+
+    params[GUC_CTL_LOG_PARAMS] = guc->log.flags;
+
+    if (i915_modparams.guc_log_level >= 0) {
+        params[GUC_CTL_DEBUG] =
+            i915_modparams.guc_log_level << GUC_LOG_VERBOSITY_SHIFT;
+    } else
+        params[GUC_CTL_DEBUG] = GUC_LOG_DISABLED;

Unbalanced {} here. Doing this checkpatch fix now would be good.

Quoted 22 lines

+
+    /* If GuC submission is enabled, set up additional parameters here */
+    if (i915_modparams.enable_guc_submission) {
+        u32 ads = guc_ggtt_offset(guc->ads_vma) >> PAGE_SHIFT; +        u32 pgs = guc_ggtt_offset(dev_priv->guc.stage_desc_pool); +        u32 ctx_in_16 = GUC_MAX_STAGE_DESCRIPTORS / 16;

drivers/gpu/drm/i915/intel_guc.c +15 -0
+
+        params[GUC_CTL_DEBUG] |= ads << GUC_ADS_ADDR_SHIFT;
+        params[GUC_CTL_DEBUG] |= GUC_ADS_ENABLED;
+
+        pgs >>= PAGE_SHIFT;
+        params[GUC_CTL_CTXINFO] = (pgs << GUC_CTL_BASE_ADDR_SHIFT) |
+            (ctx_in_16 << GUC_CTL_CTXNUM_IN16_SHIFT);
+
+        params[GUC_CTL_FEATURE] |= GUC_CTL_KERNEL_SUBMISSIONS;
+
+        /* Unmask this bit to enable the GuC's internal scheduler */
+        params[GUC_CTL_FEATURE] &= ~GUC_CTL_DISABLE_SCHEDULER;
+    }
+
+    /*

drivers/gpu/drm/i915/intel_guc.c void intel_guc_init_early(struct intel_guc *guc) · line 157

Quoted 10 lines
drivers/gpu/drm/i915/intel_guc.c +10 -0
+     * All SOFT_SCRATCH registers are in FORCEWAKE_BLITTER domain and
+     * they are power context saved so it's ok to release forcewake
+     * when we are done here and take it again at xfer time.
+     */
+    intel_uncore_forcewake_get(dev_priv, FORCEWAKE_BLITTER);
+
+    I915_WRITE(SOFT_SCRATCH(0), 0);
+
+    for (i = 0; i < GUC_CTL_MAX_DWORDS; i++)
+        I915_WRITE(SOFT_SCRATCH(1 + i), params[i]);

May be for later (since retry is only for Gen9) but will it be good idea to keep these params in intel_guc struct and just doing register writes during guc_init_hw. That way possibly we can move the params initialization to guc_submission_init (although that is more than submission currently)

Quoted 130 lines
drivers/gpu/drm/i915/intel_guc.c +4 -0
+
+    intel_uncore_forcewake_put(dev_priv, FORCEWAKE_BLITTER);
+}
+

  int intel_guc_send_nop(struct intel_guc *guc, const u32 *action, u32 len) {
      WARN(1, "Unexpected send: action=%#x\n", *action);

drivers/gpu/drm/i915/intel_guc.h +1 -0
index aa9a7b5..8b44165 100644
@@ -95,6 +95,7 @@ static inline u32 guc_ggtt_offset(struct i915_vma 
 *vma)
     void intel_guc_init_early(struct intel_guc *guc);
   void intel_guc_init_send_regs(struct intel_guc *guc);
+void intel_guc_init_params(struct intel_guc *guc);
   int intel_guc_send_nop(struct intel_guc *guc, const u32 *action, u32 len);
   int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len);
   int intel_guc_sample_forcewake(struct intel_guc *guc);
drivers/gpu/drm/i915/intel_guc_loader.c +0 -38
index 30b70f5..d9089bc 100644
@@ -79,89 +79,6 @@ MODULE_FIRMWARE(I915_KBL_GUC_UCODE);
   #define I915_GLK_GUC_UCODE GUC_FW_PATH(glk, GLK_FW_MAJOR, GLK_FW_MINOR)
     -static u32 get_gttype(struct drm_i915_private *dev_priv)
-{
-    /* XXX: GT type based on PCI device ID? field seems unused by fw */
-    return 0;
-}
-
-static u32 get_core_family(struct drm_i915_private *dev_priv)
-{
-    u32 gen = INTEL_GEN(dev_priv);
-
-    switch (gen) {
-    case 9:
-        return GUC_CORE_FAMILY_GEN9;
-
-    default:
-        MISSING_CASE(gen);
-        return GUC_CORE_FAMILY_UNKNOWN;
-    }
-}
-
-/*
- * Initialise the GuC parameter block before starting the firmware
- * transfer. These parameters are read by the firmware on startup
- * and cannot be changed thereafter.
- */
-static void guc_params_init(struct drm_i915_private *dev_priv)
-{
-    struct intel_guc *guc = &dev_priv->guc;
-    u32 params[GUC_CTL_MAX_DWORDS];
-    int i;
-
-    memset(&params, 0, sizeof(params));
-
-    params[GUC_CTL_DEVICE_INFO] |=
-        (get_gttype(dev_priv) << GUC_CTL_GTTYPE_SHIFT) |
-        (get_core_family(dev_priv) << GUC_CTL_COREFAMILY_SHIFT);
-
-    /*
-     * GuC ARAT increment is 10 ns. GuC default scheduler quantum is 

one
-     * second. This ARAR is calculated by:
-     * Scheduler-Quantum-in-ns / ARAT-increment-in-ns = 1000000000 / 10 -     */
-    params[GUC_CTL_ARAT_HIGH] = 0;
-    params[GUC_CTL_ARAT_LOW] = 100000000;

drivers/gpu/drm/i915/intel_guc_loader.c +0 -15
-
-    params[GUC_CTL_WA] |= GUC_CTL_WA_UK_BY_DRIVER;
-
-    params[GUC_CTL_FEATURE] |= GUC_CTL_DISABLE_SCHEDULER |
-            GUC_CTL_VCS2_ENABLED;
-
-    params[GUC_CTL_LOG_PARAMS] = guc->log.flags;
-
-    if (i915_modparams.guc_log_level >= 0) {
-        params[GUC_CTL_DEBUG] =
-            i915_modparams.guc_log_level << GUC_LOG_VERBOSITY_SHIFT;
-    } else
-        params[GUC_CTL_DEBUG] = GUC_LOG_DISABLED;
-
-    /* If GuC submission is enabled, set up additional parameters 

here */
-    if (i915_modparams.enable_guc_submission) {
-        u32 ads = guc_ggtt_offset(guc->ads_vma) >> PAGE_SHIFT; -        u32 pgs = guc_ggtt_offset(dev_priv->guc.stage_desc_pool); -        u32 ctx_in_16 = GUC_MAX_STAGE_DESCRIPTORS / 16;

drivers/gpu/drm/i915/intel_guc_loader.c +0 -20
-
-        params[GUC_CTL_DEBUG] |= ads << GUC_ADS_ADDR_SHIFT;
-        params[GUC_CTL_DEBUG] |= GUC_ADS_ENABLED;
-
-        pgs >>= PAGE_SHIFT;
-        params[GUC_CTL_CTXINFO] = (pgs << GUC_CTL_BASE_ADDR_SHIFT) |
-            (ctx_in_16 << GUC_CTL_CTXNUM_IN16_SHIFT);
-
-        params[GUC_CTL_FEATURE] |= GUC_CTL_KERNEL_SUBMISSIONS;
-
-        /* Unmask this bit to enable the GuC's internal scheduler */
-        params[GUC_CTL_FEATURE] &= ~GUC_CTL_DISABLE_SCHEDULER;
-    }
-
-    I915_WRITE(SOFT_SCRATCH(0), 0);
-
-    for (i = 0; i < GUC_CTL_MAX_DWORDS; i++)
-        I915_WRITE(SOFT_SCRATCH(1 + i), params[i]);
-}
-

  /*
   * Read the GuC status register (GUC_STATUS) and store it in the
   * specified location; then return a boolean indicating whether

drivers/gpu/drm/i915/intel_guc_loader.c +0 -1
@@ -301,8 +218,6 @@ static int guc_ucode_xfer(struct drm_i915_private 
 *dev_priv)
           I915_WRITE(GUC_ARAT_C6DIS, 0x1FF);
       }
   -    guc_params_init(dev_priv);
-
       ret = guc_ucode_xfer_dma(dev_priv, vma);
         intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
drivers/gpu/drm/i915/intel_uc.c +1 -0
index 7b938e8..53fdd9a 100644
@@ -195,6 +195,7 @@ int intel_uc_init_hw(struct drm_i915_private 
 *dev_priv)
               goto err_submission;
             intel_huc_init_hw(&dev_priv->huc);
+        intel_guc_init_params(guc);
Quoted 8 lines

drivers/gpu/drm/i915/intel_uc.c int intel_uc_init_hw(struct drm_i915_private *dev_priv) · line 201

Quoted 3 lines
drivers/gpu/drm/i915/intel_uc.c +0 -0
           ret = intel_guc_init_hw(&dev_priv->guc);
           if (ret == 0 || ret != -EAGAIN)
               break;

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

PATCH v3 3/14 drm/i915/guc: Small fixups post code move

In reply to Michal Wajdeczko

Existing code needs some style fixes. To avoid polluting pure move patch, do it now as separate step.

---
 drivers/gpu/drm/i915/intel_guc.c      | 11 ++++++-----
 drivers/gpu/drm/i915/intel_guc_fwif.h |  4 ++--
 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_guc.c +6 -5
index 719144a..10037c0 100644
@@ -67,7 +67,7 @@ void intel_guc_init_early(struct intel_guc *guc)
 	guc->notify = gen8_guc_raise_irq;
 }
 
-static u32 get_gttype(struct drm_i915_private *dev_priv)
+static u32 get_gt_type(struct drm_i915_private *dev_priv)
 {
 	/* XXX: GT type based on PCI device ID? field seems unused by fw */
 	return 0;
@@ -98,11 +98,11 @@ void intel_guc_init_params(struct intel_guc *guc)
 	u32 params[GUC_CTL_MAX_DWORDS];
 	int i;
 
-	memset(&params, 0, sizeof(params));
+	memset(params, 0, sizeof(params));
 
 	params[GUC_CTL_DEVICE_INFO] |=
-		(get_gttype(dev_priv) << GUC_CTL_GTTYPE_SHIFT) |
-		(get_core_family(dev_priv) << GUC_CTL_COREFAMILY_SHIFT);
+		(get_gt_type(dev_priv) << GUC_CTL_GT_TYPE_SHIFT) |
+		(get_core_family(dev_priv) << GUC_CTL_CORE_FAMILY_SHIFT);
 
 	/*
 	 * GuC ARAT increment is 10 ns. GuC default scheduler quantum is one
@@ -122,8 +122,9 @@ void intel_guc_init_params(struct intel_guc *guc)
 	if (i915_modparams.guc_log_level >= 0) {
 		params[GUC_CTL_DEBUG] =
 			i915_modparams.guc_log_level << GUC_LOG_VERBOSITY_SHIFT;
-	} else
+	} else {
 		params[GUC_CTL_DEBUG] = GUC_LOG_DISABLED;
+	}
 
 	/* If GuC submission is enabled, set up additional parameters here */
 	if (i915_modparams.enable_guc_submission) {
drivers/gpu/drm/i915/intel_guc_fwif.h +2 -2
index 1c0a2a3..80c5074 100644
@@ -82,8 +82,8 @@
 #define GUC_CTL_ARAT_LOW		2
 
 #define GUC_CTL_DEVICE_INFO		3
-#define   GUC_CTL_GTTYPE_SHIFT		0
-#define   GUC_CTL_COREFAMILY_SHIFT	7
+#define   GUC_CTL_GT_TYPE_SHIFT		0
+#define   GUC_CTL_CORE_FAMILY_SHIFT	7
 
 #define GUC_CTL_LOG_PARAMS		4
 #define   GUC_LOG_VALID			(1 << 0)
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH v3 4/14 drm/i915/guc: Move doc near related definitions

In reply to Michal Wajdeczko

After Guc code reorg some documentation was left in wrong place. Move it closer to corresponding definitions.

Cc Joonas Lahtinen <[email protected]>
Cc Sagar Arun Kamble <[email protected]>
---
 drivers/gpu/drm/i915/intel_guc.h        | 11 +++++++++++
 drivers/gpu/drm/i915/intel_guc_loader.c | 23 -----------------------
 drivers/gpu/drm/i915/intel_uc_fw.h      |  5 +++++
 3 files changed, 16 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_guc.h +11 -0
index 8b44165..c7088a7 100644
@@ -33,6 +33,11 @@
 #include "i915_guc_reg.h"
 #include "i915_vma.h"
 
+/*
+ * Top level structure of guc. It handles firmware loading and manages client
+ * pool and doorbells. intel_guc owns a i915_guc_client to replace the legacy
+ * ExecList submission.
+ */
 struct intel_guc {
 	struct intel_uc_fw fw;
 	struct intel_guc_log log;
@@ -83,6 +88,12 @@ static inline void intel_guc_notify(struct intel_guc *guc)
 	guc->notify(guc);
 }
 
+/*
+ * GuC does not allow any gfx GGTT address that falls into range [0, WOPCM_TOP),
+ * which is reserved for Boot ROM, SRAM and WOPCM. Currently this top address is
+ * 512K. In order to exclude 0-512K address space from GGTT, all gfx objects
+ * used by GuC is pinned with PIN_OFFSET_BIAS along with size of WOPCM.
+ */
 static inline u32 guc_ggtt_offset(struct i915_vma *vma)
 {
 	u32 offset = i915_ggtt_offset(vma);
drivers/gpu/drm/i915/intel_guc_loader.c +0 -23
index d9089bc..8508b94 100644
@@ -29,29 +29,6 @@
 #include "i915_drv.h"
 #include "intel_uc.h"
 
-/**
- * DOC: GuC-specific firmware loader
- *
- * intel_guc:
- * Top level structure of guc. It handles firmware loading and manages client
- * pool and doorbells. intel_guc owns a i915_guc_client to replace the legacy
- * ExecList submission.
- *
- * Firmware versioning:
- * The firmware build process will generate a version header file with major and
- * minor version defined. The versions are built into CSS header of firmware.
- * i915 kernel driver set the minimal firmware version required per platform.
- * The firmware installation package will install (symbolic link) proper version
- * of firmware.
- *
- * GuC address space:
- * GuC does not allow any gfx GGTT address that falls into range [0, WOPCM_TOP),
- * which is reserved for Boot ROM, SRAM and WOPCM. Currently this top address is
- * 512K. In order to exclude 0-512K address space from GGTT, all gfx objects
- * used by GuC is pinned with PIN_OFFSET_BIAS along with size of WOPCM.
- *
- */
-
 #define SKL_FW_MAJOR 6
 #define SKL_FW_MINOR 1
 
drivers/gpu/drm/i915/intel_uc_fw.h +5 -0
index c3e9af4..5c01849 100644
@@ -50,6 +50,11 @@ struct intel_uc_fw {
 	enum intel_uc_fw_status fetch_status;
 	enum intel_uc_fw_status load_status;
 
+	/*
+	 * The firmware build process will generate a version header file with major and
+	 * minor version defined. The versions are built into CSS header of firmware.
+	 * i915 kernel driver set the minimal firmware version required per platform.
+	 */
 	u16 major_ver_wanted;
 	u16 minor_ver_wanted;
 	u16 major_ver_found;
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v3 4/14
#7 lore raw

Re: [PATCH v3 04/14] drm/i915/guc: Move doc near related definitions

Quoted 6 lines · Michal Wajdeczko

After Guc code reorg some documentation was left in wrong place. Move it closer to corresponding definitions.

Cc Joonas Lahtinen <[email protected]>
Cc Sagar Arun Kamble <[email protected]>

nitpick: Can we use "GuC" or other preferred name consistently in all comments/commit message/subject except for tag for all GuC related changes.

Quoted 75 lines
---
  drivers/gpu/drm/i915/intel_guc.h        | 11 +++++++++++
  drivers/gpu/drm/i915/intel_guc_loader.c | 23 -----------------------
  drivers/gpu/drm/i915/intel_uc_fw.h      |  5 +++++
  3 files changed, 16 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_guc.h +11 -0
index 8b44165..c7088a7 100644
@@ -33,6 +33,11 @@
  #include "i915_guc_reg.h"
  #include "i915_vma.h"
 
+/*
+ * Top level structure of guc. It handles firmware loading and manages client
+ * pool and doorbells. intel_guc owns a i915_guc_client to replace the legacy
+ * ExecList submission.
+ */
  struct intel_guc {
  	struct intel_uc_fw fw;
  	struct intel_guc_log log;
@@ -83,6 +88,12 @@ static inline void intel_guc_notify(struct intel_guc *guc)
  	guc->notify(guc);
  }
 
+/*
+ * GuC does not allow any gfx GGTT address that falls into range [0, WOPCM_TOP),
+ * which is reserved for Boot ROM, SRAM and WOPCM. Currently this top address is
+ * 512K. In order to exclude 0-512K address space from GGTT, all gfx objects
+ * used by GuC is pinned with PIN_OFFSET_BIAS along with size of WOPCM.
+ */
  static inline u32 guc_ggtt_offset(struct i915_vma *vma)
  {
  	u32 offset = i915_ggtt_offset(vma);
drivers/gpu/drm/i915/intel_guc_loader.c +0 -23
index d9089bc..8508b94 100644
@@ -29,29 +29,6 @@
  #include "i915_drv.h"
  #include "intel_uc.h"
 
-/**
- * DOC: GuC-specific firmware loader
- *
- * intel_guc:
- * Top level structure of guc. It handles firmware loading and manages client
- * pool and doorbells. intel_guc owns a i915_guc_client to replace the legacy
- * ExecList submission.
- *
- * Firmware versioning:
- * The firmware build process will generate a version header file with major and
- * minor version defined. The versions are built into CSS header of firmware.
- * i915 kernel driver set the minimal firmware version required per platform.
- * The firmware installation package will install (symbolic link) proper version
- * of firmware.
- *
- * GuC address space:
- * GuC does not allow any gfx GGTT address that falls into range [0, WOPCM_TOP),
- * which is reserved for Boot ROM, SRAM and WOPCM. Currently this top address is
- * 512K. In order to exclude 0-512K address space from GGTT, all gfx objects
- * used by GuC is pinned with PIN_OFFSET_BIAS along with size of WOPCM.
- *
- */
-
  #define SKL_FW_MAJOR 6
  #define SKL_FW_MINOR 1
 
drivers/gpu/drm/i915/intel_uc_fw.h +0 -0
index c3e9af4..5c01849 100644
@@ -50,6 +50,11 @@ struct intel_uc_fw {
  	enum intel_uc_fw_status fetch_status;

drivers/gpu/drm/i915/intel_uc_fw.h struct intel_uc_fw { · line 60

Quoted 10 lines
drivers/gpu/drm/i915/intel_uc_fw.h +5 -0
  	enum intel_uc_fw_status load_status;
 
+	/*
+	 * The firmware build process will generate a version header file with major and
+	 * minor version defined. The versions are built into CSS header of firmware.
+	 * i915 kernel driver set the minimal firmware version required per platform.
+	 */
  	u16 major_ver_wanted;
  	u16 minor_ver_wanted;
  	u16 major_ver_found;

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

PATCH v3 5/14 drm/i915/guc: Rename intel_guc_loader.c to intel_guc_fw.c

In reply to Michal Wajdeczko

Remaining functions in intel_guc_loader.c were focused around GuC firmware. Rename them to match object-verb pattern and rename file itself.

---
 drivers/gpu/drm/i915/Makefile           |   2 +-
 drivers/gpu/drm/i915/intel_guc.h        |   4 +-
 drivers/gpu/drm/i915/intel_guc_fw.c     | 298 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_guc_fw.h     |  33 ++++
 drivers/gpu/drm/i915/intel_guc_loader.c | 298 --------------------------------
 drivers/gpu/drm/i915/intel_uc.c         |   4 +-
 6 files changed, 335 insertions(+), 304 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_guc_fw.c
 create mode 100644 drivers/gpu/drm/i915/intel_guc_fw.h
 delete mode 100644 drivers/gpu/drm/i915/intel_guc_loader.c
drivers/gpu/drm/i915/Makefile +1 -1
index 66d23b6..6c3b048 100644
@@ -64,7 +64,7 @@ i915-y += intel_uc.o \
 	  intel_guc.o \
 	  intel_guc_ct.o \
 	  intel_guc_log.o \
-	  intel_guc_loader.o \
+	  intel_guc_fw.o \
 	  intel_huc.o \
 	  i915_guc_submission.o
 
drivers/gpu/drm/i915/intel_guc.h +1 -3
index c7088a7..f643e04 100644
@@ -26,6 +26,7 @@
 #define _INTEL_GUC_H_
 
 #include "intel_uncore.h"
+#include "intel_guc_fw.h"
 #include "intel_guc_fwif.h"
 #include "intel_guc_ct.h"
 #include "intel_guc_log.h"
@@ -114,9 +115,6 @@ int intel_guc_auth_huc(struct intel_guc *guc, u32 rsa_offset);
 int intel_guc_suspend(struct drm_i915_private *dev_priv);
 int intel_guc_resume(struct drm_i915_private *dev_priv);
 struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size);
-
-int intel_guc_select_fw(struct intel_guc *guc);
-int intel_guc_init_hw(struct intel_guc *guc);
 u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv);
 
 #endif
drivers/gpu/drm/i915/intel_guc_fw.c new file +298 -0

298 lines not on this page · raw message

drivers/gpu/drm/i915/intel_guc_fw.h new file +33 -0
new file mode 100644
index 0000000..023f5ba
@@ -0,0 +1,33 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#ifndef _INTEL_GUC_FW_H_
+#define _INTEL_GUC_FW_H_
+
+struct intel_guc;
+
+int intel_guc_fw_select(struct intel_guc *guc);
+int intel_guc_fw_upload(struct intel_guc *guc);
+
+#endif
drivers/gpu/drm/i915/intel_guc_loader.c deleted +0 -298

298 lines not on this page · raw message

drivers/gpu/drm/i915/intel_uc.c +2 -2
index 53fdd9a..048f5c4 100644
@@ -68,7 +68,7 @@ void intel_uc_sanitize_options(struct drm_i915_private *dev_priv)
 		if (HAS_HUC_UCODE(dev_priv))
 			intel_huc_select_fw(&dev_priv->huc);
 
-		if (intel_guc_select_fw(&dev_priv->guc))
+		if (intel_guc_fw_select(&dev_priv->guc))
 			i915_modparams.enable_guc_loading = 0;
 	}
 
@@ -196,7 +196,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 
 		intel_huc_init_hw(&dev_priv->huc);
 		intel_guc_init_params(guc);
-		ret = intel_guc_init_hw(&dev_priv->guc);
+		ret = intel_guc_fw_upload(guc);
 		if (ret == 0 || ret != -EAGAIN)
 			break;
 
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH v3 6/14 drm/i915/guc: Reorder functions in intel_guc_fw.c

In reply to Michal Wajdeczko

Functions should be defined in their use order.

---
 drivers/gpu/drm/i915/intel_guc_fw.c | 81 +++++++++++++++++++------------------
 1 file changed, 41 insertions(+), 40 deletions(-)
drivers/gpu/drm/i915/intel_guc_fw.c +41 -40
index 61d6369..71dacc3 100644
@@ -56,6 +56,47 @@ MODULE_FIRMWARE(I915_KBL_GUC_UCODE);
 
 #define I915_GLK_GUC_UCODE GUC_FW_PATH(glk, GLK_FW_MAJOR, GLK_FW_MINOR)
 
+/**
+ * intel_guc_fw_select() - selects GuC firmware for uploading
+ *
+ * @guc:	intel_guc struct
+ *
+ * Return: zero when we know firmware, non-zero in other case
+ */
+int intel_guc_fw_select(struct intel_guc *guc)
+{
+	struct drm_i915_private *dev_priv = guc_to_i915(guc);
+
+	intel_uc_fw_init(&guc->fw, INTEL_UC_FW_TYPE_GUC);
+
+	if (i915_modparams.guc_firmware_path) {
+		guc->fw.path = i915_modparams.guc_firmware_path;
+		guc->fw.major_ver_wanted = 0;
+		guc->fw.minor_ver_wanted = 0;
+	} else if (IS_SKYLAKE(dev_priv)) {
+		guc->fw.path = I915_SKL_GUC_UCODE;
+		guc->fw.major_ver_wanted = SKL_FW_MAJOR;
+		guc->fw.minor_ver_wanted = SKL_FW_MINOR;
+	} else if (IS_BROXTON(dev_priv)) {
+		guc->fw.path = I915_BXT_GUC_UCODE;
+		guc->fw.major_ver_wanted = BXT_FW_MAJOR;
+		guc->fw.minor_ver_wanted = BXT_FW_MINOR;
+	} else if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv)) {
+		guc->fw.path = I915_KBL_GUC_UCODE;
+		guc->fw.major_ver_wanted = KBL_FW_MAJOR;
+		guc->fw.minor_ver_wanted = KBL_FW_MINOR;
+	} else if (IS_GEMINILAKE(dev_priv)) {
+		guc->fw.path = I915_GLK_GUC_UCODE;
+		guc->fw.major_ver_wanted = GLK_FW_MAJOR;
+		guc->fw.minor_ver_wanted = GLK_FW_MINOR;
+	} else {
+		DRM_ERROR("No GuC firmware known for platform with GuC!\n");
+		return -ENOENT;
+	}
+
+	return 0;
+}
+
 /*
  * Read the GuC status register (GUC_STATUS) and store it in the
  * specified location; then return a boolean indicating whether
@@ -256,43 +297,3 @@ int intel_guc_fw_upload(struct intel_guc *guc)
 
 	return 0;
 }
-
-/**
- * intel_guc_fw_select() - selects GuC firmware for loading
- * @guc:	intel_guc struct
- *
- * Return: zero when we know firmware, non-zero in other case
- */
-int intel_guc_fw_select(struct intel_guc *guc)
-{
-	struct drm_i915_private *dev_priv = guc_to_i915(guc);
-
-	intel_uc_fw_init(&guc->fw, INTEL_UC_FW_TYPE_GUC);
-
-	if (i915_modparams.guc_firmware_path) {
-		guc->fw.path = i915_modparams.guc_firmware_path;
-		guc->fw.major_ver_wanted = 0;
-		guc->fw.minor_ver_wanted = 0;
-	} else if (IS_SKYLAKE(dev_priv)) {
-		guc->fw.path = I915_SKL_GUC_UCODE;
-		guc->fw.major_ver_wanted = SKL_FW_MAJOR;
-		guc->fw.minor_ver_wanted = SKL_FW_MINOR;
-	} else if (IS_BROXTON(dev_priv)) {
-		guc->fw.path = I915_BXT_GUC_UCODE;
-		guc->fw.major_ver_wanted = BXT_FW_MAJOR;
-		guc->fw.minor_ver_wanted = BXT_FW_MINOR;
-	} else if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv)) {
-		guc->fw.path = I915_KBL_GUC_UCODE;
-		guc->fw.major_ver_wanted = KBL_FW_MAJOR;
-		guc->fw.minor_ver_wanted = KBL_FW_MINOR;
-	} else if (IS_GEMINILAKE(dev_priv)) {
-		guc->fw.path = I915_GLK_GUC_UCODE;
-		guc->fw.major_ver_wanted = GLK_FW_MAJOR;
-		guc->fw.minor_ver_wanted = GLK_FW_MINOR;
-	} else {
-		DRM_ERROR("No GuC firmware known for platform with GuC!\n");
-		return -ENOENT;
-	}
-
-	return 0;
-}
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH v3 7/14 drm/i915/guc: Move firmware size check out of generic code

In reply to Michal Wajdeczko

Checking GuC firmware size can be done in GuC specific code right before DMA copy as it is unlikely to fail anyway.

v2: rebased

---
 drivers/gpu/drm/i915/intel_guc_fw.c | 7 ++++++-
 drivers/gpu/drm/i915/intel_uc_fw.c  | 8 --------
 2 files changed, 6 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_guc_fw.c +6 -1
index 71dacc3..020ce26 100644
@@ -133,6 +133,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
 	unsigned long offset;
 	struct sg_table *sg = vma->pages;
 	u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT];
+	u32 size = guc_fw->header_size + guc_fw->ucode_size;
 	int i, ret = 0;
 
 	/* where RSA signature starts */
@@ -145,7 +146,11 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
 
 	/* The header plus uCode will be copied to WOPCM via DMA, excluding any
 	 * other components */
-	I915_WRITE(DMA_COPY_SIZE, guc_fw->header_size + guc_fw->ucode_size);
+	if (size > intel_guc_wopcm_size(dev_priv)) {
+		DRM_ERROR("Firmware is too large to fit in WOPCM\n");
+		return -EFBIG;
+	}
+	I915_WRITE(DMA_COPY_SIZE, size);
 
 	/* Set the source address for the new blob */
 	offset = guc_ggtt_offset(vma) + guc_fw->header_offset;
drivers/gpu/drm/i915/intel_uc_fw.c +0 -8
index 766b1cb..482115b 100644
@@ -108,14 +108,6 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
 	 */
 	switch (uc_fw->type) {
 	case INTEL_UC_FW_TYPE_GUC:
-		/* Header and uCode will be loaded to WOPCM. Size of the two. */
-		size = uc_fw->header_size + uc_fw->ucode_size;
-
-		/* Top 32k of WOPCM is reserved (8K stack + 24k RC6 context). */
-		if (size > intel_guc_wopcm_size(dev_priv)) {
-			DRM_ERROR("Firmware is too large to fit in WOPCM\n");
-			goto fail;
-		}
 		uc_fw->major_ver_found = css->guc.sw_version >> 16;
 		uc_fw->minor_ver_found = css->guc.sw_version & 0xFFFF;
 		break;
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v3 7/14
#11 lore raw

Re: [PATCH v3 07/14] drm/i915/guc: Move firmware size check out of generic code

Quoted 27 lines · Michal Wajdeczko

Checking GuC firmware size can be done in GuC specific code right before DMA copy as it is unlikely to fail anyway.

v2: rebased

---
  drivers/gpu/drm/i915/intel_guc_fw.c | 7 ++++++-
  drivers/gpu/drm/i915/intel_uc_fw.c  | 8 --------
  2 files changed, 6 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_guc_fw.c +1 -0
index 71dacc3..020ce26 100644
@@ -133,6 +133,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
  	unsigned long offset;
  	struct sg_table *sg = vma->pages;
  	u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT];
+	u32 size = guc_fw->header_size + guc_fw->ucode_size;
  	int i, ret = 0;
 
  	/* where RSA signature starts */

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, · line 149

Quoted 5 lines
drivers/gpu/drm/i915/intel_guc_fw.c +1 -1
@@ -145,7 +146,11 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
 
  	/* The header plus uCode will be copied to WOPCM via DMA, excluding any
  	 * other components */
-	I915_WRITE(DMA_COPY_SIZE, guc_fw->header_size + guc_fw->ucode_size);
+	if (size > intel_guc_wopcm_size(dev_priv)) {

This size check better be done before RSA copy. With that:

Quoted 16 lines
drivers/gpu/drm/i915/intel_guc_fw.c +4 -0
+		DRM_ERROR("Firmware is too large to fit in WOPCM\n");
+		return -EFBIG;
+	}
+	I915_WRITE(DMA_COPY_SIZE, size);
 
  	/* Set the source address for the new blob */
  	offset = guc_ggtt_offset(vma) + guc_fw->header_offset;
drivers/gpu/drm/i915/intel_uc_fw.c +0 -1
index 766b1cb..482115b 100644
@@ -108,14 +108,6 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
  	 */
  	switch (uc_fw->type) {
  	case INTEL_UC_FW_TYPE_GUC:
-		/* Header and uCode will be loaded to WOPCM. Size of the two. */

drivers/gpu/drm/i915/intel_uc_fw.c void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, · line 113

Quoted 10 lines
drivers/gpu/drm/i915/intel_uc_fw.c +0 -7
-		size = uc_fw->header_size + uc_fw->ucode_size;
-
-		/* Top 32k of WOPCM is reserved (8K stack + 24k RC6 context). */
-		if (size > intel_guc_wopcm_size(dev_priv)) {
-			DRM_ERROR("Firmware is too large to fit in WOPCM\n");
-			goto fail;
-		}
  		uc_fw->major_ver_found = css->guc.sw_version >> 16;
  		uc_fw->minor_ver_found = css->guc.sw_version & 0xFFFF;
  		break;

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw

Re: [PATCH v3 07/14] drm/i915/guc: Move firmware size check out of generic code

Quoted 37 lines · Sagar Arun Kamble
Quoted 31 lines · Michal Wajdeczko

Checking GuC firmware size can be done in GuC specific code right before DMA copy as it is unlikely to fail anyway.

v2: rebased

---
  drivers/gpu/drm/i915/intel_guc_fw.c | 7 ++++++-
  drivers/gpu/drm/i915/intel_uc_fw.c  | 8 --------
  2 files changed, 6 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_guc_fw.c +1 -0
index 71dacc3..020ce26 100644
@@ -133,6 +133,7 @@ static int guc_ucode_xfer_dma(struct  
 drm_i915_private *dev_priv,
  	unsigned long offset;
  	struct sg_table *sg = vma->pages;
  	u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT];
+	u32 size = guc_fw->header_size + guc_fw->ucode_size;
  	int i, ret = 0;
    	/* where RSA signature starts */
@@ -145,7 +146,11 @@ static int guc_ucode_xfer_dma(struct  
 drm_i915_private *dev_priv,
    	/* The header plus uCode will be copied to WOPCM via DMA,  

excluding any
* other components */

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, · line 149

Quoted 2 lines
drivers/gpu/drm/i915/intel_guc_fw.c +1 -1
-	I915_WRITE(DMA_COPY_SIZE, guc_fw->header_size + guc_fw->ucode_size);
+	if (size > intel_guc_wopcm_size(dev_priv)) {

This size check better be done before RSA copy. With that:

Quoted 1 line

Hmm, I was planning to separate handling of RSA signature out of this function and focus here only on DMA xfer, so that move will be void. And I still think that size check is better to be done closer to the place where that size will be used in HW commands.

Michal

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/i915/intel_guc_fw.c +4 -0
+		DRM_ERROR("Firmware is too large to fit in WOPCM\n");
+		return -EFBIG;
+	}
+	I915_WRITE(DMA_COPY_SIZE, size);
    	/* Set the source address for the new blob */
  	offset = guc_ggtt_offset(vma) + guc_fw->header_offset;
drivers/gpu/drm/i915/intel_uc_fw.c +0 -3
index 766b1cb..482115b 100644
@@ -108,14 +108,6 @@ void intel_uc_fw_fetch(struct drm_i915_private  
 *dev_priv,
  	 */
  	switch (uc_fw->type) {
  	case INTEL_UC_FW_TYPE_GUC:
-		/* Header and uCode will be loaded to WOPCM. Size of the two. */
-		size = uc_fw->header_size + uc_fw->ucode_size;
-
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_uc_fw.c +0 -5
-		/* Top 32k of WOPCM is reserved (8K stack + 24k RC6 context). */
-		if (size > intel_guc_wopcm_size(dev_priv)) {
-			DRM_ERROR("Firmware is too large to fit in WOPCM\n");
-			goto fail;
-		}
  		uc_fw->major_ver_found = css->guc.sw_version >> 16;
  		uc_fw->minor_ver_found = css->guc.sw_version & 0xFFFF;

break;

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw

PATCH v3 8/14 drm/i915/guc: Pick better place for Guc final status message

In reply to Michal Wajdeczko

Guc status message printed right after firmware upload may be too optimistic, as we may fail on subsequent steps. Move that message to the end of intel_uc_init_hw where we know the status for sure.

v2: use dev_info (Chris)

Cc Joonas Lahtinen <[email protected]>
Cc Sagar Arun Kamble <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/intel_guc_fw.c | 6 ------
 drivers/gpu/drm/i915/intel_uc.c     | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_guc_fw.c +0 -6
index 020ce26..51be318 100644
@@ -294,11 +294,5 @@ int intel_guc_fw_upload(struct intel_guc *guc)
 
 	guc->fw.load_status = INTEL_UC_FIRMWARE_SUCCESS;
 
-	DRM_INFO("GuC %s (firmware %s [version %u.%u])\n",
-		 i915_modparams.enable_guc_submission ? "submission enabled" :
-							"loaded",
-		 guc->fw.path,
-		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
-
 	return 0;
 }
drivers/gpu/drm/i915/intel_uc.c +6 -0
index 048f5c4..9d84fdd 100644
@@ -222,6 +222,12 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 			goto err_interrupts;
 	}
 
+	dev_info(dev_priv->drm.dev, "GuC %s (firmware %s [version %u.%u])\n",
+		 i915_modparams.enable_guc_submission ? "submission enabled" :
+							"loaded",
+		 guc->fw.path,
+		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
+
 	return 0;
 
 	/*
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

Re: [PATCH v3 08/14] drm/i915/guc: Pick better place for Guc final status message

Quoted 21 lines · Michal Wajdeczko

Guc status message printed right after firmware upload may be too optimistic, as we may fail on subsequent steps. Move that message to the end of intel_uc_init_hw where we know the status for sure.

v2: use dev_info (Chris)

Cc Joonas Lahtinen <[email protected]>
Cc Sagar Arun Kamble <[email protected]>
Cc Chris Wilson <[email protected]>
---
  drivers/gpu/drm/i915/intel_guc_fw.c | 6 ------
  drivers/gpu/drm/i915/intel_uc.c     | 6 ++++++
  2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_guc_fw.c +0 -0
index 020ce26..51be318 100644

drivers/gpu/drm/i915/intel_guc_fw.c int intel_guc_fw_upload(struct intel_guc *guc) · line 302

Quoted 9 lines
drivers/gpu/drm/i915/intel_guc_fw.c +0 -6
@@ -294,11 +294,5 @@ int intel_guc_fw_upload(struct intel_guc *guc)
 
  	guc->fw.load_status = INTEL_UC_FIRMWARE_SUCCESS;
 
-	DRM_INFO("GuC %s (firmware %s [version %u.%u])\n",
-		 i915_modparams.enable_guc_submission ? "submission enabled" :
-							"loaded",
-		 guc->fw.path,
-		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
-

It would be good to say "GuC loaded (firmware _path_ [version x.x])" here.

Quoted 7 lines
drivers/gpu/drm/i915/intel_guc_fw.c +0 -0
  	return 0;
  }
drivers/gpu/drm/i915/intel_uc.c +0 -0
index 048f5c4..9d84fdd 100644

drivers/gpu/drm/i915/intel_uc.c int intel_uc_init_hw(struct drm_i915_private *dev_priv) · line 230

Quoted 9 lines
drivers/gpu/drm/i915/intel_uc.c +6 -0
@@ -222,6 +222,12 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
  			goto err_interrupts;
  	}
 
+	dev_info(dev_priv->drm.dev, "GuC %s (firmware %s [version %u.%u])\n",
+		 i915_modparams.enable_guc_submission ? "submission enabled" :
+							"loaded",
+		 guc->fw.path,
+		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
+

And move this print inside i915_guc_submission_enable (And limit to "submission enabled"/"submission disabled" as we plan to enable/disable submission during resume from sleep/reset.

drivers/gpu/drm/i915/intel_uc.c int intel_uc_init_hw(struct drm_i915_private *dev_priv) · line 233

Quoted 3 lines
drivers/gpu/drm/i915/intel_uc.c +0 -0
  	return 0;
 
  	/*

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#15 lore raw

Re: [PATCH v3 08/14] drm/i915/guc: Pick better place for Guc final status message

Quoted 19 lines · Sagar Arun Kamble
Quoted 16 lines · Michal Wajdeczko

Guc status message printed right after firmware upload may be too optimistic, as we may fail on subsequent steps. Move that message to the end of intel_uc_init_hw where we know the status for sure.

v2: use dev_info (Chris)

Cc Joonas Lahtinen <[email protected]>
Cc Sagar Arun Kamble <[email protected]>
Cc Chris Wilson <[email protected]>
---
  drivers/gpu/drm/i915/intel_guc_fw.c | 6 ------
  drivers/gpu/drm/i915/intel_uc.c     | 6 ++++++
  2 files changed, 6 insertions(+), 6 deletions(-)
Quoted 13 lines

drivers/gpu/drm/i915/intel_guc_fw.c int intel_guc_fw_upload(struct intel_guc *guc) · line 300

Quoted 12 lines
drivers/gpu/drm/i915/intel_guc_fw.c +0 -5
index 020ce26..51be318 100644
@@ -294,11 +294,5 @@ int intel_guc_fw_upload(struct intel_guc *guc)
    	guc->fw.load_status = INTEL_UC_FIRMWARE_SUCCESS;
  -	DRM_INFO("GuC %s (firmware %s [version %u.%u])\n",
-		 i915_modparams.enable_guc_submission ? "submission enabled" :
-							"loaded",
-		 guc->fw.path,
-		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
-

It would be good to say "GuC loaded (firmware _path_ [version x.x])" here.

Note that this message will return in 11/14 as part of intel_uc_fw_upload:

	DRM_INFO("%s: Loaded firmware %s (version %u.%u)\n",
		 intel_uc_fw_type_repr(uc_fw->type),
		 uc_fw->path,
		 uc_fw->major_ver_found, uc_fw->minor_ver_found);

Michal

Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/intel_guc_fw.c +0 -0
  	return 0;
  }
drivers/gpu/drm/i915/intel_uc.c +0 -0
index 048f5c4..9d84fdd 100644
@@ -222,6 +222,12 @@ int intel_uc_init_hw(struct drm_i915_private  
 *dev_priv)
  			goto err_interrupts;
  	}
  +	dev_info(dev_priv->drm.dev, "GuC %s (firmware %s [version  
Quoted 10 lines

drivers/gpu/drm/i915/intel_uc.c int intel_uc_init_hw(struct drm_i915_private *dev_priv) · line 230

Quoted 6 lines
drivers/gpu/drm/i915/intel_uc.c +5 -0
 %u.%u])\n",
+		 i915_modparams.enable_guc_submission ? "submission enabled" :
+							"loaded",
+		 guc->fw.path,
+		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
+

And move this print inside i915_guc_submission_enable (And limit to "submission enabled"/"submission disabled" as we plan to enable/disable submission during resume from sleep/reset.

Quoted 2 lines
drivers/gpu/drm/i915/intel_uc.c +0 -0
  	return 0;
    	/*

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw

Re: [PATCH v3 08/14] drm/i915/guc: Pick better place for Guc final status message

In reply to Sagar Arun Kamble
Quoted 19 lines · Sagar Arun Kamble
Quoted 16 lines · Michal Wajdeczko

Guc status message printed right after firmware upload may be too optimistic, as we may fail on subsequent steps. Move that message to the end of intel_uc_init_hw where we know the status for sure.

v2: use dev_info (Chris)

Cc Joonas Lahtinen <[email protected]>
Cc Sagar Arun Kamble <[email protected]>
Cc Chris Wilson <[email protected]>
---
  drivers/gpu/drm/i915/intel_guc_fw.c | 6 ------
  drivers/gpu/drm/i915/intel_uc.c     | 6 ++++++
  2 files changed, 6 insertions(+), 6 deletions(-)

...

Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_uc.c +0 -0
index 048f5c4..9d84fdd 100644
@@ -222,6 +222,12 @@ int intel_uc_init_hw(struct drm_i915_private  
 *dev_priv)
  			goto err_interrupts;
  	}
  +	dev_info(dev_priv->drm.dev, "GuC %s (firmware %s [version  
Quoted 8 lines

drivers/gpu/drm/i915/intel_uc.c int intel_uc_init_hw(struct drm_i915_private *dev_priv) · line 230

Quoted 6 lines
drivers/gpu/drm/i915/intel_uc.c +5 -0
 %u.%u])\n",
+		 i915_modparams.enable_guc_submission ? "submission enabled" :
+							"loaded",
+		 guc->fw.path,
+		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
+

And move this print inside i915_guc_submission_enable (And limit to "submission enabled"/"submission disabled" as we plan to enable/disable submission during resume from sleep/reset.

So maybe this is better to be done together with related changes?

Michal
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#17 lore raw

Re: [PATCH v3 08/14] drm/i915/guc: Pick better place for Guc final status message

Quoted 41 lines · Michal Wajdeczko
Quoted 19 lines · Sagar Arun Kamble
Quoted 16 lines · Michal Wajdeczko

Guc status message printed right after firmware upload may be too optimistic, as we may fail on subsequent steps. Move that message to the end of intel_uc_init_hw where we know the status for sure.

v2: use dev_info (Chris)

Cc Joonas Lahtinen <[email protected]>
Cc Sagar Arun Kamble <[email protected]>
Cc Chris Wilson <[email protected]>

---
  drivers/gpu/drm/i915/intel_guc_fw.c | 6 ------
  drivers/gpu/drm/i915/intel_uc.c     | 6 ++++++

  2 files changed, 6 insertions(+), 6 deletions(-)

...

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_uc.c +0 -0
index 048f5c4..9d84fdd 100644
@@ -222,6 +222,12 @@ int intel_uc_init_hw(struct drm_i915_private 
 *dev_priv)
               goto err_interrupts;
       }
Quoted 8 lines

drivers/gpu/drm/i915/intel_uc.c int intel_uc_init_hw(struct drm_i915_private *dev_priv) · line 230

Quoted 6 lines
drivers/gpu/drm/i915/intel_uc.c +5 -0
   +    dev_info(dev_priv->drm.dev, "GuC %s (firmware %s [version %u.%u])\n",
+         i915_modparams.enable_guc_submission ? "submission enabled" :
+                            "loaded",
+         guc->fw.path,
+         guc->fw.major_ver_found, guc->fw.minor_ver_found);
+

And move this print inside i915_guc_submission_enable (And limit to "submission enabled"/"submission disabled" as we plan to enable/disable submission during resume from sleep/reset.

Quoted 1 line

So maybe this is better to be done together with related changes?

Ok. Sure.

Quoted 2 lines

Michal

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#18 lore raw

PATCH v3 9/14 drm/i915/uc: Improve debug messages in firmware fetch

In reply to Michal Wajdeczko

Time to remove less important info and make messages clear and consistent.

v2: change some message levels (Chris)
v3: restore DRM_WARN (Chris)

Cc Sagar Arun Kamble <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/intel_uc_fw.c | 75 +++++++++++++++++++++++---------------
 1 file changed, 46 insertions(+), 29 deletions(-)
drivers/gpu/drm/i915/intel_uc_fw.c +46 -29
index 482115b..560fe39 100644
@@ -45,26 +45,33 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
 	size_t size;
 	int err;
 
+	DRM_DEBUG_DRIVER("%s fw fetch %s\n",
+			 intel_uc_fw_type_repr(uc_fw->type), uc_fw->path);
+
 	if (!uc_fw->path)
 		return;
 
 	uc_fw->fetch_status = INTEL_UC_FIRMWARE_PENDING;
-
-	DRM_DEBUG_DRIVER("before requesting firmware: uC fw fetch status %s\n",
+	DRM_DEBUG_DRIVER("%s fw fetch %s\n",
+			 intel_uc_fw_type_repr(uc_fw->type),
 			 intel_uc_fw_status_repr(uc_fw->fetch_status));
 
 	err = request_firmware(&fw, uc_fw->path, &pdev->dev);
-	if (err)
-		goto fail;
-	if (!fw)
+	if (err) {
+		DRM_DEBUG_DRIVER("%s fw request_firmware err=%d\n",
+				 intel_uc_fw_type_repr(uc_fw->type), err);
 		goto fail;
+	}
 
-	DRM_DEBUG_DRIVER("fetch uC fw from %s succeeded, fw %p\n",
-			 uc_fw->path, fw);
+	DRM_DEBUG_DRIVER("%s fw size %zu ptr %p\n",
+			 intel_uc_fw_type_repr(uc_fw->type), fw->size, fw);
 
 	/* Check the size of the blob before examining buffer contents */
 	if (fw->size < sizeof(struct uc_css_header)) {
-		DRM_NOTE("Firmware header is missing\n");
+		DRM_WARN("%s: Unexpected firmware size (%zu, min %zu)\n",
+			 intel_uc_fw_type_repr(uc_fw->type),
+			 fw->size, sizeof(struct uc_css_header));
+		err = -ENODATA;
 		goto fail;
 	}
 
@@ -77,7 +84,9 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
 			     sizeof(u32);
 
 	if (uc_fw->header_size != sizeof(struct uc_css_header)) {
-		DRM_NOTE("CSS header definition mismatch\n");
+		DRM_WARN("%s: Mismatched firmware header definition\n",
+			 intel_uc_fw_type_repr(uc_fw->type));
+		err = -ENOEXEC;
 		goto fail;
 	}
 
@@ -87,7 +96,9 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
 
 	/* now RSA */
 	if (css->key_size_dw != UOS_RSA_SCRATCH_MAX_COUNT) {
-		DRM_NOTE("RSA key size is bad\n");
+		DRM_WARN("%s: Mismatched firmware RSA key size (%u)\n",
+			 intel_uc_fw_type_repr(uc_fw->type), css->key_size_dw);
+		err = -ENOEXEC;
 		goto fail;
 	}
 	uc_fw->rsa_offset = uc_fw->ucode_offset + uc_fw->ucode_size;
@@ -96,7 +107,9 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
 	/* At least, it should have header, uCode and RSA. Size of all three. */
 	size = uc_fw->header_size + uc_fw->ucode_size + uc_fw->rsa_size;
 	if (fw->size < size) {
-		DRM_NOTE("Missing firmware components\n");
+		DRM_WARN("%s: Truncated firmware (%zu, expected %zu)\n",
+			 intel_uc_fw_type_repr(uc_fw->type), fw->size, size);
+		err = -ENOEXEC;
 		goto fail;
 	}
 
@@ -118,17 +131,21 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
 		break;
 
 	default:
-		DRM_ERROR("Unknown firmware type %d\n", uc_fw->type);
-		err = -ENOEXEC;
-		goto fail;
+		MISSING_CASE(uc_fw->type);
+		break;
 	}
 
+	DRM_DEBUG_DRIVER("%s fw version %u.%u (wanted %u.%u)\n",
+			 intel_uc_fw_type_repr(uc_fw->type),
+			 uc_fw->major_ver_found, uc_fw->minor_ver_found,
+			 uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted);
+
 	if (uc_fw->major_ver_wanted == 0 && uc_fw->minor_ver_wanted == 0) {
-		DRM_NOTE("Skipping %s firmware version check\n",
+		DRM_NOTE("%s: Skipping firmware version check\n",
 			 intel_uc_fw_type_repr(uc_fw->type));
 	} else if (uc_fw->major_ver_found != uc_fw->major_ver_wanted ||
 		   uc_fw->minor_ver_found < uc_fw->minor_ver_wanted) {
-		DRM_NOTE("%s firmware version %d.%d, required %d.%d\n",
+		DRM_NOTE("%s: Wrong firmware version (%u.%u, required %u.%u)\n",
 			 intel_uc_fw_type_repr(uc_fw->type),
 			 uc_fw->major_ver_found, uc_fw->minor_ver_found,
 			 uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted);
@@ -136,34 +153,34 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
 		goto fail;
 	}
 
-	DRM_DEBUG_DRIVER("firmware version %d.%d OK (minimum %d.%d)\n",
-			 uc_fw->major_ver_found, uc_fw->minor_ver_found,
-			 uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted);
-
 	obj = i915_gem_object_create_from_data(dev_priv, fw->data, fw->size);
 	if (IS_ERR(obj)) {
 		err = PTR_ERR(obj);
+		DRM_DEBUG_DRIVER("%s fw object_create err=%d\n",
+				 intel_uc_fw_type_repr(uc_fw->type), err);
 		goto fail;
 	}
 
 	uc_fw->obj = obj;
 	uc_fw->size = fw->size;
-
-	DRM_DEBUG_DRIVER("uC fw fetch status SUCCESS, obj %p\n",
-			 uc_fw->obj);
+	uc_fw->fetch_status = INTEL_UC_FIRMWARE_SUCCESS;
+	DRM_DEBUG_DRIVER("%s fw fetch %s\n",
+			 intel_uc_fw_type_repr(uc_fw->type),
+			 intel_uc_fw_status_repr(uc_fw->fetch_status));
 
 	release_firmware(fw);
-	uc_fw->fetch_status = INTEL_UC_FIRMWARE_SUCCESS;
 	return;
 
 fail:
-	DRM_WARN("Failed to fetch valid uC firmware from %s (error %d)\n",
-		 uc_fw->path, err);
-	DRM_DEBUG_DRIVER("uC fw fetch status FAIL; err %d, fw %p, obj %p\n",
-			 err, fw, uc_fw->obj);
+	uc_fw->fetch_status = INTEL_UC_FIRMWARE_FAIL;
+	DRM_DEBUG_DRIVER("%s fw fetch %s\n",
+			 intel_uc_fw_type_repr(uc_fw->type),
+			 intel_uc_fw_status_repr(uc_fw->fetch_status));
+
+	DRM_WARN("%s: Failed to fetch firmware %s (error %d)\n",
+		 intel_uc_fw_type_repr(uc_fw->type), uc_fw->path, err);
 
 	release_firmware(fw);		/* OK even if fw is NULL */
-	uc_fw->fetch_status = INTEL_UC_FIRMWARE_FAIL;
 }
 
 /**
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

PATCH v3 10/14 drm/i915/uc: Add message with firmware url

In reply to Michal Wajdeczko

In case of firmware fetch failure we should help user find latest firmware.

---
 drivers/gpu/drm/i915/intel_uc_fw.c | 2 ++
 drivers/gpu/drm/i915/intel_uc_fw.h | 2 ++
 2 files changed, 4 insertions(+)
drivers/gpu/drm/i915/intel_uc_fw.c +2 -0
index 560fe39..e246dbd 100644
@@ -179,6 +179,8 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
 
 	DRM_WARN("%s: Failed to fetch firmware %s (error %d)\n",
 		 intel_uc_fw_type_repr(uc_fw->type), uc_fw->path, err);
+	DRM_INFO("%s: Firmware can be downloaded from %s\n",
+		 intel_uc_fw_type_repr(uc_fw->type), INTEL_UC_FIRMWARE_URL);
 
 	release_firmware(fw);		/* OK even if fw is NULL */
 }
drivers/gpu/drm/i915/intel_uc_fw.h +2 -0
index 5c01849..1d580fa 100644
@@ -27,6 +27,8 @@
 
 struct drm_i915_private;
 
+#define INTEL_UC_FIRMWARE_URL "https://01.org/linuxgraphics/downloads/firmware"
+
 enum intel_uc_fw_status {
 	INTEL_UC_FIRMWARE_FAIL = -1,
 	INTEL_UC_FIRMWARE_NONE = 0,
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw

Re: [PATCH v3 10/14] drm/i915/uc: Add message with firmware url

Quoting Michal Wajdeczko (2017-10-12 23:54:43)

drivers/gpu/drm/i915/intel_uc_fw.h line 30

Quoted 9 lines
drivers/gpu/drm/i915/intel_uc_fw.h +1 -0
index 5c01849..1d580fa 100644
@@ -27,6 +27,8 @@
 
 struct drm_i915_private;
 
+#define INTEL_UC_FIRMWARE_URL "https://01.org/linuxgraphics/downloads/firmware"

Pull it out from intel_csr.c, say intel_drv.h?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#21 lore raw

Re: [PATCH v3 10/14] drm/i915/uc: Add message with firmware url

Quoted 7 lines · Chris Wilson

Quoting Michal Wajdeczko (2017-10-12 23:54:43)

Quoted 6 lines
drivers/gpu/drm/i915/intel_uc_fw.h +0 -0
index 5c01849..1d580fa 100644
@@ -27,6 +27,8 @@
 
Quoted 6 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_uc_fw.h +1 -0
 struct drm_i915_private;
 
+#define INTEL_UC_FIRMWARE_URL  

"https://01.org/linuxgraphics/downloads/firmware"

Pull it out from intel_csr.c, say intel_drv.h?

Well, the secret plan was to update intel_csr.c in separate patch. Then we could fix message there to be more clear and user friendly, as today URL is in place where one will expect firmware filename:

"Failed to load DMC firmware"
" [" FIRMWARE_URL "],"
" disabling runtime power management.\n");

And for location of the URL macro, I still prefer intel_uc_fw.h over intel_drv.h, as the latter one is little overloaded, while former is still accessible to csr.c and there is a chance to even reuse more uc_fw functions in csr.c in the future.

Michal
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#22 lore raw

PATCH v3 11/14 drm/i915/uc: Unify firmware loading

In reply to Michal Wajdeczko

Firmware loading for GuC and Huc are similar. Move common code into generic function for maximum reuse.

v2: change message levels (Chris)

Cc Joonas Lahtinen <[email protected]>
Cc Sagar Arun Kamble <[email protected]>
Cc Anusha Srivatsa <[email protected]>
Cc Sujaritha Sundaresan <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/intel_guc_fw.c | 52 +++---------------------
 drivers/gpu/drm/i915/intel_huc.c    | 53 +++----------------------
 drivers/gpu/drm/i915/intel_uc_fw.c  | 79 +++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_uc_fw.h  |  4 ++
 4 files changed, 93 insertions(+), 95 deletions(-)
drivers/gpu/drm/i915/intel_guc_fw.c +5 -47
index 51be318..4629ff3 100644
@@ -193,24 +193,13 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
 /*
  * Load the GuC firmware blob into the MinuteIA.
  */
-static int guc_ucode_xfer(struct drm_i915_private *dev_priv)
+static int guc_ucode_xfer(struct intel_uc_fw *guc_fw, struct i915_vma *vma)
 {
-	struct intel_uc_fw *guc_fw = &dev_priv->guc.fw;
-	struct i915_vma *vma;
+	struct intel_guc *guc = container_of(guc_fw, struct intel_guc, fw);
+	struct drm_i915_private *dev_priv = guc_to_i915(guc);
 	int ret;
 
-	ret = i915_gem_object_set_to_gtt_domain(guc_fw->obj, false);
-	if (ret) {
-		DRM_DEBUG_DRIVER("set-domain failed %d\n", ret);
-		return ret;
-	}
-
-	vma = i915_gem_object_ggtt_pin(guc_fw->obj, NULL, 0, 0,
-				       PIN_OFFSET_BIAS | GUC_WOPCM_TOP);
-	if (IS_ERR(vma)) {
-		DRM_DEBUG_DRIVER("pin failed %d\n", (int)PTR_ERR(vma));
-		return PTR_ERR(vma);
-	}
+	GEM_BUG_ON(guc_fw->type != INTEL_UC_FW_TYPE_GUC);
 
 	intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
 
@@ -245,12 +234,6 @@ static int guc_ucode_xfer(struct drm_i915_private *dev_priv)
 
 	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
 
-	/*
-	 * We keep the object pages for reuse during resume. But we can unpin it
-	 * now that DMA has completed, so it doesn't continue to take up space.
-	 */
-	i915_vma_unpin(vma);
-
 	return ret;
 }
 
@@ -269,30 +252,5 @@ static int guc_ucode_xfer(struct drm_i915_private *dev_priv)
  */
 int intel_guc_fw_upload(struct intel_guc *guc)
 {
-	struct drm_i915_private *dev_priv = guc_to_i915(guc);
-	const char *fw_path = guc->fw.path;
-	int ret;
-
-	DRM_DEBUG_DRIVER("GuC fw status: path %s, fetch %s, load %s\n",
-		fw_path,
-		intel_uc_fw_status_repr(guc->fw.fetch_status),
-		intel_uc_fw_status_repr(guc->fw.load_status));
-
-	if (guc->fw.fetch_status != INTEL_UC_FIRMWARE_SUCCESS)
-		return -EIO;
-
-	guc->fw.load_status = INTEL_UC_FIRMWARE_PENDING;
-
-	DRM_DEBUG_DRIVER("GuC fw status: fetch %s, load %s\n",
-		intel_uc_fw_status_repr(guc->fw.fetch_status),
-		intel_uc_fw_status_repr(guc->fw.load_status));
-
-	ret = guc_ucode_xfer(dev_priv);
-
-	if (ret)
-		return -EAGAIN;
-
-	guc->fw.load_status = INTEL_UC_FIRMWARE_SUCCESS;
-
-	return 0;
+	return intel_uc_fw_upload(&guc->fw, guc_ucode_xfer);
 }
drivers/gpu/drm/i915/intel_huc.c +5 -48

76 lines not on this page · raw message

drivers/gpu/drm/i915/intel_uc_fw.c +79 -0

85 lines not on this page · raw message

drivers/gpu/drm/i915/intel_uc_fw.h +4 -0
index 1d580fa..78ce556 100644
@@ -26,6 +26,7 @@
 #define _INTEL_UC_FW_H_
 
 struct drm_i915_private;
+struct i915_vma;
 
 #define INTEL_UC_FIRMWARE_URL "https://01.org/linuxgraphics/downloads/firmware"
 
@@ -109,6 +110,9 @@ void intel_uc_fw_init(struct intel_uc_fw *uc_fw, enum intel_uc_fw_type type)
 
 void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
 		       struct intel_uc_fw *uc_fw);
+int intel_uc_fw_upload(struct intel_uc_fw *uc_fw,
+		       int (*xfer)(struct intel_uc_fw *uc_fw,
+				   struct i915_vma *vma));
 void intel_uc_fw_fini(struct intel_uc_fw *uc_fw);
 
 #endif
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#23 lore raw

PATCH v3 12/14 drm/i915/guc: Update Guc messages on load failure

In reply to Michal Wajdeczko

In case of GuC firmware loading failure we were reporting DRM_ERROR also for case when GuC loading was not strictly required.

Cc Chris Wilson <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Sagar Arun Kamble <[email protected]>
---
 drivers/gpu/drm/i915/intel_uc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_uc.c +5 -4
index 9d84fdd..25bd162 100644
@@ -250,12 +250,14 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 err_guc:
 	i915_ggtt_disable_guc(dev_priv);
 
-	DRM_ERROR("GuC init failed\n");
 	if (i915_modparams.enable_guc_loading > 1 ||
-	    i915_modparams.enable_guc_submission > 1)
+	    i915_modparams.enable_guc_submission > 1) {
+		DRM_ERROR("GuC init failed. Firmware loading disabled.\n");
 		ret = -EIO;
-	else
+	} else {
+		DRM_NOTE("GuC init failed. Firmware loading disabled.\n");
 		ret = 0;
+	}
 
 	if (i915_modparams.enable_guc_submission) {
 		i915_modparams.enable_guc_submission = 0;
@@ -263,7 +265,6 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 	}
 
 	i915_modparams.enable_guc_loading = 0;
-	DRM_NOTE("GuC firmware loading disabled\n");
 
 	return ret;
 }
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#24 lore raw

PATCH v3 13/14 drm/i915/huc: Move fw select function

In reply to Michal Wajdeczko

No functional change. Just place the function closer to related definitions.

---
 drivers/gpu/drm/i915/intel_huc.c | 72 ++++++++++++++++++++--------------------
 1 file changed, 36 insertions(+), 36 deletions(-)
drivers/gpu/drm/i915/intel_huc.c +36 -36
index 8be3bfe..c8a48cb 100644
@@ -78,6 +78,42 @@ MODULE_FIRMWARE(I915_KBL_HUC_UCODE);
 	GLK_HUC_FW_MINOR, GLK_BLD_NUM)
 
 /**
+ * intel_huc_select_fw() - selects HuC firmware for loading
+ * @huc:	intel_huc struct
+ */
+void intel_huc_select_fw(struct intel_huc *huc)
+{
+	struct drm_i915_private *dev_priv = huc_to_i915(huc);
+
+	intel_uc_fw_init(&huc->fw, INTEL_UC_FW_TYPE_HUC);
+
+	if (i915_modparams.huc_firmware_path) {
+		huc->fw.path = i915_modparams.huc_firmware_path;
+		huc->fw.major_ver_wanted = 0;
+		huc->fw.minor_ver_wanted = 0;
+	} else if (IS_SKYLAKE(dev_priv)) {
+		huc->fw.path = I915_SKL_HUC_UCODE;
+		huc->fw.major_ver_wanted = SKL_HUC_FW_MAJOR;
+		huc->fw.minor_ver_wanted = SKL_HUC_FW_MINOR;
+	} else if (IS_BROXTON(dev_priv)) {
+		huc->fw.path = I915_BXT_HUC_UCODE;
+		huc->fw.major_ver_wanted = BXT_HUC_FW_MAJOR;
+		huc->fw.minor_ver_wanted = BXT_HUC_FW_MINOR;
+	} else if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv)) {
+		huc->fw.path = I915_KBL_HUC_UCODE;
+		huc->fw.major_ver_wanted = KBL_HUC_FW_MAJOR;
+		huc->fw.minor_ver_wanted = KBL_HUC_FW_MINOR;
+	} else if (IS_GEMINILAKE(dev_priv)) {
+		huc->fw.path = I915_GLK_HUC_UCODE;
+		huc->fw.major_ver_wanted = GLK_HUC_FW_MAJOR;
+		huc->fw.minor_ver_wanted = GLK_HUC_FW_MINOR;
+	} else {
+		DRM_ERROR("No HuC firmware known for platform with HuC!\n");
+		return;
+	}
+}
+
+/**
  * huc_ucode_xfer() - DMA's the firmware
  * @dev_priv: the drm_i915_private device
  *
@@ -128,42 +164,6 @@ static int huc_ucode_xfer(struct intel_uc_fw *huc_fw, struct i915_vma *vma)
 }
 
 /**
- * intel_huc_select_fw() - selects HuC firmware for loading
- * @huc:	intel_huc struct
- */
-void intel_huc_select_fw(struct intel_huc *huc)
-{
-	struct drm_i915_private *dev_priv = huc_to_i915(huc);
-
-	intel_uc_fw_init(&huc->fw, INTEL_UC_FW_TYPE_HUC);
-
-	if (i915_modparams.huc_firmware_path) {
-		huc->fw.path = i915_modparams.huc_firmware_path;
-		huc->fw.major_ver_wanted = 0;
-		huc->fw.minor_ver_wanted = 0;
-	} else if (IS_SKYLAKE(dev_priv)) {
-		huc->fw.path = I915_SKL_HUC_UCODE;
-		huc->fw.major_ver_wanted = SKL_HUC_FW_MAJOR;
-		huc->fw.minor_ver_wanted = SKL_HUC_FW_MINOR;
-	} else if (IS_BROXTON(dev_priv)) {
-		huc->fw.path = I915_BXT_HUC_UCODE;
-		huc->fw.major_ver_wanted = BXT_HUC_FW_MAJOR;
-		huc->fw.minor_ver_wanted = BXT_HUC_FW_MINOR;
-	} else if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv)) {
-		huc->fw.path = I915_KBL_HUC_UCODE;
-		huc->fw.major_ver_wanted = KBL_HUC_FW_MAJOR;
-		huc->fw.minor_ver_wanted = KBL_HUC_FW_MINOR;
-	} else if (IS_GEMINILAKE(dev_priv)) {
-		huc->fw.path = I915_GLK_HUC_UCODE;
-		huc->fw.major_ver_wanted = GLK_HUC_FW_MAJOR;
-		huc->fw.minor_ver_wanted = GLK_HUC_FW_MINOR;
-	} else {
-		DRM_ERROR("No HuC firmware known for platform with HuC!\n");
-		return;
-	}
-}
-
-/**
  * intel_huc_init_hw() - load HuC uCode to device
  * @huc: intel_huc structure
  *
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#25 lore raw

PATCH v3 14/14 HAX enable GuC submission for CI

In reply to Michal Wajdeczko

Also revert ("drm/i915/guc: Assert that we switch between known ggtt->invalidate functions")

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 8 ++------
 drivers/gpu/drm/i915/i915_params.h  | 4 ++--
 2 files changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -6
index daba55a..2a38ad9 100644
@@ -3568,17 +3568,13 @@ int i915_ggtt_enable_hw(struct drm_i915_private *dev_priv)
 
 void i915_ggtt_enable_guc(struct drm_i915_private *i915)
 {
-	GEM_BUG_ON(i915->ggtt.invalidate != gen6_ggtt_invalidate);
-
 	i915->ggtt.invalidate = guc_ggtt_invalidate;
 }
 
 void i915_ggtt_disable_guc(struct drm_i915_private *i915)
 {
-	/* We should only be called after i915_ggtt_enable_guc() */
-	GEM_BUG_ON(i915->ggtt.invalidate != guc_ggtt_invalidate);
-
-	i915->ggtt.invalidate = gen6_ggtt_invalidate;
+	if (i915->ggtt.invalidate == guc_ggtt_invalidate)
+		i915->ggtt.invalidate = gen6_ggtt_invalidate;
 }
 
 void i915_gem_restore_gtt_mappings(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/i915_params.h +2 -2
index c729226..97c0611 100644
@@ -44,8 +44,8 @@
 	param(int, disable_power_well, -1) \
 	param(int, enable_ips, 1) \
 	param(int, invert_brightness, 0) \
-	param(int, enable_guc_loading, 0) \
-	param(int, enable_guc_submission, 0) \
+	param(int, enable_guc_loading, 2) \
+	param(int, enable_guc_submission, 2) \
 	param(int, guc_log_level, -1) \
 	param(char *, guc_firmware_path, NULL) \
 	param(char *, huc_firmware_path, NULL) \
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#26 lore raw

✗ Fi.CI.BAT: failure for Firmware code reorg (rev2)

In reply to Michal Wajdeczko
== Series Details ==

== Series Details ==

Series: Firmware code reorg (rev2)
URL : https://patchwork.freedesktop.org/series/31846/
State : failure

== Summary ==

Series 31846v2 Firmware code reorg
https://patchwork.freedesktop.org/api/1.0/series/31846/revisions/2/mbox/

Test chamelium:

        Subgroup dp-crc-fast:
                fail       -> PASS       (fi-kbl-7500u) fdo#102514
Test debugfs_test:
        Subgroup read_all_entries:
                pass       -> SKIP       (fi-glk-1)
Test drv_hangman:
        Subgroup error-state-basic:
                pass       -> SKIP       (fi-glk-1)
Test gem_busy:
        Subgroup basic-busy-default:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-hang-default:
                pass       -> SKIP       (fi-glk-1)
Test gem_close_race:
        Subgroup basic-process:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-threads:
                pass       -> SKIP       (fi-glk-1)
Test gem_cpu_reloc:
        Subgroup basic:
                pass       -> SKIP       (fi-glk-1)
Test gem_cs_tlb:
        Subgroup basic-default:
                pass       -> SKIP       (fi-glk-1)
Test gem_ctx_create:
        Subgroup basic:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-files:
                pass       -> SKIP       (fi-glk-1)
Test gem_ctx_exec:
        Subgroup basic:
                pass       -> SKIP       (fi-glk-1)
Test gem_ctx_switch:
        Subgroup basic-default:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-default-heavy:
                pass       -> SKIP       (fi-glk-1)
Test gem_exec_basic:
        Subgroup basic-blt:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-bsd:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-default:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-render:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-vebox:
                pass       -> SKIP       (fi-glk-1)
        Subgroup gtt-blt:
                pass       -> SKIP       (fi-glk-1)
        Subgroup gtt-bsd:
                pass       -> SKIP       (fi-glk-1)
        Subgroup gtt-default:
                pass       -> SKIP       (fi-glk-1)
        Subgroup gtt-render:
                pass       -> SKIP       (fi-glk-1)
        Subgroup gtt-vebox:
                pass       -> SKIP       (fi-glk-1)
        Subgroup readonly-blt:
                pass       -> SKIP       (fi-glk-1)
        Subgroup readonly-bsd:
                pass       -> SKIP       (fi-glk-1)
        Subgroup readonly-default:
                pass       -> SKIP       (fi-glk-1)
        Subgroup readonly-render:
                pass       -> SKIP       (fi-glk-1)
        Subgroup readonly-vebox:
                pass       -> SKIP       (fi-glk-1)
Test gem_exec_create:
        Subgroup basic:
                pass       -> SKIP       (fi-glk-1)
Test gem_exec_fence:
        Subgroup basic-busy-default:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-wait-default:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-await-default:
                pass       -> SKIP       (fi-glk-1)
        Subgroup await-hang-default:
                pass       -> SKIP       (fi-glk-1)
        Subgroup nb-await-default:
                pass       -> SKIP       (fi-glk-1)
Test gem_exec_flush:
        Subgroup basic-batch-kernel-default-uc:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-batch-kernel-default-wb:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-uc-pro-default:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-uc-prw-default:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-uc-ro-default:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-uc-rw-default:
                pass       -> SKIP       (fi-glk-1)
        Subgroup basic-uc-set-default:

WARNING: Long output truncated

490bd134d63554815d2ea6ff56e6d32fd50ff472 drm-tip: 2017y-10m-12d-20h-08m-10s UTC integration manifest 9a8805cbd2d8 HAX enable GuC submission for CI
4a5b2aabfbb6 drm/i915/huc: Move fw select function
5e60965598b1 drm/i915/guc: Update Guc messages on load failure
69ec9d58087a drm/i915/uc: Unify firmware loading
da7268f052c1 drm/i915/uc: Add message with firmware url
28711f5a832a drm/i915/uc: Improve debug messages in firmware fetch
4c227b6e4851 drm/i915/guc: Pick better place for Guc final status message 0a3fc4e5fda3 drm/i915/guc: Move firmware size check out of generic code
2f6dd5acae83 drm/i915/guc: Reorder functions in intel_guc_fw.c
cfa5498effbb drm/i915/guc: Rename intel_guc_loader.c to intel_guc_fw.c
b101e15485a9 drm/i915/guc: Move doc near related definitions
f166e4ac781e drm/i915/guc: Small fixups post code move
75a6d77f7a78 drm/i915/guc: Move GuC boot param initialization out of xfer b0a9e7e131c3 drm/i915: Move intel_guc_wopcm_size to intel_guc.c

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6017/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx