Commit edad2547 authored by Daniele Ceraolo Spurio's avatar Daniele Ceraolo Spurio Committed by Chris Wilson

drm/i915/guc: init submission structures as part of guc_init

guc->stage_desc_pool is required as part of the init parameters and
there is no reason we have to init them after HuC. This fixes a NULL
ptr dereference due to guc->stage_desc_pool not being set (no fixes
tag since GuC submission can't be enabled yet).
Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190725174655.24382-1-daniele.ceraolospurio@intel.com
parent 97dee74b
...@@ -290,6 +290,16 @@ int intel_guc_init(struct intel_guc *guc) ...@@ -290,6 +290,16 @@ int intel_guc_init(struct intel_guc *guc)
if (ret) if (ret)
goto err_ads; goto err_ads;
if (intel_uc_is_using_guc_submission(&gt->uc)) {
/*
* This is stuff we need to have available at fw load time
* if we are planning to enable submission later
*/
ret = intel_guc_submission_init(guc);
if (ret)
goto err_ct;
}
/* now that everything is perma-pinned, initialize the parameters */ /* now that everything is perma-pinned, initialize the parameters */
guc_init_params(guc); guc_init_params(guc);
...@@ -298,6 +308,8 @@ int intel_guc_init(struct intel_guc *guc) ...@@ -298,6 +308,8 @@ int intel_guc_init(struct intel_guc *guc)
return 0; return 0;
err_ct:
intel_guc_ct_fini(&guc->ct);
err_ads: err_ads:
intel_guc_ads_destroy(guc); intel_guc_ads_destroy(guc);
err_log: err_log:
...@@ -317,6 +329,9 @@ void intel_guc_fini(struct intel_guc *guc) ...@@ -317,6 +329,9 @@ void intel_guc_fini(struct intel_guc *guc)
i915_ggtt_disable_guc(gt->ggtt); i915_ggtt_disable_guc(gt->ggtt);
if (intel_uc_is_using_guc_submission(&gt->uc))
intel_guc_submission_fini(guc);
intel_guc_ct_fini(&guc->ct); intel_guc_ct_fini(&guc->ct);
intel_guc_ads_destroy(guc); intel_guc_ads_destroy(guc);
......
...@@ -397,21 +397,8 @@ int intel_uc_init(struct intel_uc *uc) ...@@ -397,21 +397,8 @@ int intel_uc_init(struct intel_uc *uc)
goto err_guc; goto err_guc;
} }
if (intel_uc_is_using_guc_submission(uc)) {
/*
* This is stuff we need to have available at fw load time
* if we are planning to enable submission later
*/
ret = intel_guc_submission_init(guc);
if (ret)
goto err_huc;
}
return 0; return 0;
err_huc:
if (intel_uc_is_using_huc(uc))
intel_huc_fini(huc);
err_guc: err_guc:
intel_guc_fini(guc); intel_guc_fini(guc);
return ret; return ret;
...@@ -426,9 +413,6 @@ void intel_uc_fini(struct intel_uc *uc) ...@@ -426,9 +413,6 @@ void intel_uc_fini(struct intel_uc *uc)
GEM_BUG_ON(!intel_uc_fw_supported(&guc->fw)); GEM_BUG_ON(!intel_uc_fw_supported(&guc->fw));
if (intel_uc_is_using_guc_submission(uc))
intel_guc_submission_fini(guc);
if (intel_uc_is_using_huc(uc)) if (intel_uc_is_using_huc(uc))
intel_huc_fini(&uc->huc); intel_huc_fini(&uc->huc);
......
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