Re: [PATCH 4/5] drm/i915/guc: group initialization of GuC objects

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

 





On 10/4/2017 4:27 AM, Sujaritha Sundaresan wrote:
The previous patch has split up the initialization of some of the GuC
objects in 2 different functions, let's pull them back together.

v3: Group initialization of GuC objects

v2: Decoupling ADS together with logs (Daniele)

v3: Rebase

v4: Rebase

v5: Separated from previous patch

Cc: Anusha Srivatsa <anusha.srivatsa@xxxxxxxxx>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@xxxxxxxxx>
Cc: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx>
Cc: Oscar Mateo <oscar.mateo@xxxxxxxxx>
Cc: Sagar Arun Kamble <sagar.a.kamble@xxxxxxxxx>
Signed-off-by: Sujaritha Sundaresan <sujaritha.sundaresan@xxxxxxxxx>
---
  drivers/gpu/drm/i915/i915_guc_submission.c |  7 ++---
  drivers/gpu/drm/i915/intel_uc.c            | 41 +++++++++++++++++-------------
  drivers/gpu/drm/i915/intel_uc.h            |  4 +--
  3 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index c456c55..a351339 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -920,9 +920,8 @@ void i915_guc_policies_init(struct guc_policies *policies)
   * Set up the memory resources to be shared with the GuC (via the GGTT)
   * at firmware loading time.
   */
-int i915_guc_submission_init(struct drm_i915_private *dev_priv)
+int i915_guc_submission_shared_objects_init(struct intel_guc *guc)
Squash next patch into this. Argument dev_priv fits here.
  {
-	struct intel_guc *guc = &dev_priv->guc;
  	struct i915_vma *vma;
  	void *vaddr;
@@ -950,10 +949,8 @@ int i915_guc_submission_init(struct drm_i915_private *dev_priv)
  	return 0;
  }
-void i915_guc_submission_fini(struct drm_i915_private *dev_priv)
+void i915_guc_submission_shared_objects_fini(struct intel_guc *guc)
  {
-	struct intel_guc *guc = &dev_priv->guc;
-
  	ida_destroy(&guc->stage_ids);
  	i915_gem_object_unpin_map(guc->stage_desc_pool->obj);
  	i915_vma_unpin_and_release(&guc->stage_desc_pool);
diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
index 732f188..69239e4 100644
--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -423,13 +423,33 @@ static int guc_shared_objects_init(struct intel_guc *guc)
ret = guc_ads_create(guc);
  	if (ret < 0)
-		intel_guc_log_destroy(guc);
+		goto err_logs;
+
+	if (i915_modparams.enable_guc_submission) {
+		/*
+		 * This is stuff we need to have available at fw load time
+		 * if we are planning to enable submission later
+		 */
+		ret = i915_guc_submission_shared_objects_init(guc);
+		if (ret)
+			goto err_ads;
+	}
+
+	return 0;
+
+err_ads:
+	guc_ads_destroy(guc);
+err_logs:
+	intel_guc_log_destroy(guc);
return ret;
  }
static void guc_shared_objects_fini(struct intel_guc *guc)
  {
+	if (i915_modparams.enable_guc_submission)
+		i915_guc_submission_shared_objects_fini(guc);
+
  	guc_ads_destroy(guc);
  	intel_guc_log_destroy(guc);
  }
@@ -452,16 +472,6 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
  	if (ret)
  		goto err_guc;
- if (i915_modparams.enable_guc_submission) {
-		/*
-		 * This is stuff we need to have available at fw load time
-		 * if we are planning to enable submission later
-		 */
-		ret = i915_guc_submission_init(dev_priv);
-		if (ret)
-			goto err_shared;
-	}
-
  	/* init WOPCM */
  	I915_WRITE(GUC_WOPCM_SIZE, intel_guc_wopcm_size(dev_priv));
  	I915_WRITE(DMA_GUC_WOPCM_OFFSET,
@@ -481,7 +491,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
  		 */
  		ret = __intel_uc_reset_hw(dev_priv);
  		if (ret)
-			goto err_submission;
+			goto err_shared;
intel_huc_init_hw(&dev_priv->huc);
  		ret = intel_guc_init_hw(&dev_priv->guc);
@@ -526,11 +536,8 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
  	gen9_disable_guc_interrupts(dev_priv);
  err_log_capture:
  	guc_capture_load_err_log(guc);
-err_submission:
-	if (i915_modparams.enable_guc_submission)
-		i915_guc_submission_fini(dev_priv);
  err_shared:
-		guc_shared_objects_fini(guc);
+	guc_shared_objects_fini(guc);
  err_guc:
  	i915_ggtt_disable_guc(dev_priv);
@@ -567,7 +574,7 @@ void intel_uc_fini_hw(struct drm_i915_private *dev_priv) if (i915_modparams.enable_guc_submission) {
  		gen9_disable_guc_interrupts(dev_priv);
-		i915_guc_submission_fini(dev_priv);
+		i915_guc_submission_shared_objects_fini(dev_priv);
  	}
guc_shared_objects_fini(&dev_priv->guc);
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 0d12ff4..5106046 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -230,10 +230,10 @@ static inline void intel_guc_notify(struct intel_guc *guc)
  u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv);
/* i915_guc_submission.c */
-int i915_guc_submission_init(struct drm_i915_private *dev_priv);
+int i915_guc_submission_shared_objects_init(struct intel_guc *guc);
  int i915_guc_submission_enable(struct drm_i915_private *dev_priv);
  void i915_guc_submission_disable(struct drm_i915_private *dev_priv);
-void i915_guc_submission_fini(struct drm_i915_private *dev_priv);
+void i915_guc_submission_shared_objects_fini(struct intel_guc *guc);
  struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size);
  void i915_guc_policies_init(struct guc_policies *policies);

_______________________________________________
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