Commit 0704df2b authored by Oscar Mateo's avatar Oscar Mateo Committed by Joonas Lahtinen

drm/i915/guc: The Additional Data Struct (ADS) should get enabled together with GuC submission

It's mandatory and it gets created if and only if GuC submission is enabled, so that should be
the condition for informing the GuC about it.

Also s/guc_addon_create/guc_ads_create and s/guc_addon_destroy/guc_ads_destroy and, while
at it, add an explanation of what things go inside the ADS object.
Signed-off-by: default avatarOscar Mateo <oscar.mateo@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
parent 3950bf3d
...@@ -62,6 +62,13 @@ ...@@ -62,6 +62,13 @@
* ELSP context descriptor dword into Work Item. * ELSP context descriptor dword into Work Item.
* See guc_wq_item_append() * See guc_wq_item_append()
* *
* ADS:
* The Additional Data Struct (ADS) has pointers for different buffers used by
* the GuC. One single gem object contains the ADS struct itself (guc_ads), the
* scheduling policies (guc_policies), a structure describing a collection of
* register sets (guc_mmio_reg_state) and some extra pages for the GuC to save
* its internal state for sleep.
*
*/ */
static inline bool is_high_priority(struct i915_guc_client* client) static inline bool is_high_priority(struct i915_guc_client* client)
...@@ -936,7 +943,7 @@ static void guc_policies_init(struct guc_policies *policies) ...@@ -936,7 +943,7 @@ static void guc_policies_init(struct guc_policies *policies)
policies->is_valid = 1; policies->is_valid = 1;
} }
static int guc_addon_create(struct intel_guc *guc) static int guc_ads_create(struct intel_guc *guc)
{ {
struct drm_i915_private *dev_priv = guc_to_i915(guc); struct drm_i915_private *dev_priv = guc_to_i915(guc);
struct i915_vma *vma; struct i915_vma *vma;
...@@ -999,7 +1006,7 @@ static int guc_addon_create(struct intel_guc *guc) ...@@ -999,7 +1006,7 @@ static int guc_addon_create(struct intel_guc *guc)
return 0; return 0;
} }
static void guc_addon_destroy(struct intel_guc *guc) static void guc_ads_destroy(struct intel_guc *guc)
{ {
i915_vma_unpin_and_release(&guc->ads_vma); i915_vma_unpin_and_release(&guc->ads_vma);
} }
...@@ -1049,7 +1056,7 @@ int i915_guc_submission_init(struct drm_i915_private *dev_priv) ...@@ -1049,7 +1056,7 @@ int i915_guc_submission_init(struct drm_i915_private *dev_priv)
if (ret < 0) if (ret < 0)
goto err_vaddr; goto err_vaddr;
ret = guc_addon_create(guc); ret = guc_ads_create(guc);
if (ret < 0) if (ret < 0)
goto err_log; goto err_log;
...@@ -1068,7 +1075,7 @@ int i915_guc_submission_init(struct drm_i915_private *dev_priv) ...@@ -1068,7 +1075,7 @@ int i915_guc_submission_init(struct drm_i915_private *dev_priv)
return 0; return 0;
err_ads: err_ads:
guc_addon_destroy(guc); guc_ads_destroy(guc);
err_log: err_log:
intel_guc_log_destroy(guc); intel_guc_log_destroy(guc);
err_vaddr: err_vaddr:
...@@ -1088,7 +1095,7 @@ void i915_guc_submission_fini(struct drm_i915_private *dev_priv) ...@@ -1088,7 +1095,7 @@ void i915_guc_submission_fini(struct drm_i915_private *dev_priv)
guc_client_free(guc->execbuf_client); guc_client_free(guc->execbuf_client);
guc->execbuf_client = NULL; guc->execbuf_client = NULL;
ida_destroy(&guc->ctx_ids); ida_destroy(&guc->ctx_ids);
guc_addon_destroy(guc); guc_ads_destroy(guc);
intel_guc_log_destroy(guc); intel_guc_log_destroy(guc);
i915_gem_object_unpin_map(guc->ctx_pool->obj); i915_gem_object_unpin_map(guc->ctx_pool->obj);
i915_vma_unpin_and_release(&guc->ctx_pool); i915_vma_unpin_and_release(&guc->ctx_pool);
......
...@@ -148,17 +148,15 @@ static void guc_params_init(struct drm_i915_private *dev_priv) ...@@ -148,17 +148,15 @@ static void guc_params_init(struct drm_i915_private *dev_priv)
} else } else
params[GUC_CTL_DEBUG] = GUC_LOG_DISABLED; params[GUC_CTL_DEBUG] = GUC_LOG_DISABLED;
if (guc->ads_vma) {
u32 ads = guc_ggtt_offset(guc->ads_vma) >> PAGE_SHIFT;
params[GUC_CTL_DEBUG] |= ads << GUC_ADS_ADDR_SHIFT;
params[GUC_CTL_DEBUG] |= GUC_ADS_ENABLED;
}
/* If GuC submission is enabled, set up additional parameters here */ /* If GuC submission is enabled, set up additional parameters here */
if (i915.enable_guc_submission) { if (i915.enable_guc_submission) {
u32 ads = guc_ggtt_offset(guc->ads_vma) >> PAGE_SHIFT;
u32 pgs = guc_ggtt_offset(dev_priv->guc.ctx_pool); u32 pgs = guc_ggtt_offset(dev_priv->guc.ctx_pool);
u32 ctx_in_16 = GUC_MAX_GPU_CONTEXTS / 16; u32 ctx_in_16 = GUC_MAX_GPU_CONTEXTS / 16;
params[GUC_CTL_DEBUG] |= ads << GUC_ADS_ADDR_SHIFT;
params[GUC_CTL_DEBUG] |= GUC_ADS_ENABLED;
pgs >>= PAGE_SHIFT; pgs >>= PAGE_SHIFT;
params[GUC_CTL_CTXINFO] = (pgs << GUC_CTL_BASE_ADDR_SHIFT) | params[GUC_CTL_CTXINFO] = (pgs << GUC_CTL_BASE_ADDR_SHIFT) |
(ctx_in_16 << GUC_CTL_CTXNUM_IN16_SHIFT); (ctx_in_16 << GUC_CTL_CTXNUM_IN16_SHIFT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment