diff options
author | Michał Winiarski <michal.winiarski@intel.com> | 2017-12-13 17:13:51 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-12-14 03:07:00 -0500 |
commit | 8ec52ec8dc6827ea7aed524ed5af7aedcfbc553b (patch) | |
tree | 2861dd722d35295264e34384a67a428512f918d9 | |
parent | 9192d4fb811e1e7d07c8fa1a576d2935826daa91 (diff) |
drm/i915/guc: Extract clients allocation to submission_init
We can now move the clients allocation to submission_init path, rather
than keeping the condition inside submission_enable called on every
reset.
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Michel Thierry <michel.thierry@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20171213221352.7173-6-michal.winiarski@intel.com
-rw-r--r-- | drivers/gpu/drm/i915/intel_guc_submission.c | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/drivers/gpu/drm/i915/intel_guc_submission.c b/drivers/gpu/drm/i915/intel_guc_submission.c index c74e78b6ba41..488110602e7e 100644 --- a/drivers/gpu/drm/i915/intel_guc_submission.c +++ b/drivers/gpu/drm/i915/intel_guc_submission.c | |||
@@ -1149,6 +1149,10 @@ int intel_guc_submission_init(struct intel_guc *guc) | |||
1149 | goto err_log; | 1149 | goto err_log; |
1150 | GEM_BUG_ON(!guc->ads_vma); | 1150 | GEM_BUG_ON(!guc->ads_vma); |
1151 | 1151 | ||
1152 | ret = guc_clients_create(guc); | ||
1153 | if (ret) | ||
1154 | return ret; | ||
1155 | |||
1152 | for_each_engine(engine, dev_priv, id) { | 1156 | for_each_engine(engine, dev_priv, id) { |
1153 | guc->preempt_work[id].engine = engine; | 1157 | guc->preempt_work[id].engine = engine; |
1154 | INIT_WORK(&guc->preempt_work[id].work, inject_preempt_context); | 1158 | INIT_WORK(&guc->preempt_work[id].work, inject_preempt_context); |
@@ -1172,6 +1176,7 @@ void intel_guc_submission_fini(struct intel_guc *guc) | |||
1172 | for_each_engine(engine, dev_priv, id) | 1176 | for_each_engine(engine, dev_priv, id) |
1173 | cancel_work_sync(&guc->preempt_work[id].work); | 1177 | cancel_work_sync(&guc->preempt_work[id].work); |
1174 | 1178 | ||
1179 | guc_clients_destroy(guc); | ||
1175 | guc_ads_destroy(guc); | 1180 | guc_ads_destroy(guc); |
1176 | intel_guc_log_destroy(guc); | 1181 | intel_guc_log_destroy(guc); |
1177 | guc_stage_desc_pool_destroy(guc); | 1182 | guc_stage_desc_pool_destroy(guc); |
@@ -1277,28 +1282,18 @@ int intel_guc_submission_enable(struct intel_guc *guc) | |||
1277 | sizeof(struct guc_wq_item) * | 1282 | sizeof(struct guc_wq_item) * |
1278 | I915_NUM_ENGINES > GUC_WQ_SIZE); | 1283 | I915_NUM_ENGINES > GUC_WQ_SIZE); |
1279 | 1284 | ||
1280 | /* | 1285 | GEM_BUG_ON(!guc->execbuf_client); |
1281 | * We're being called on both module initialization and on reset, | 1286 | |
1282 | * until this flow is changed, we're using regular client presence to | 1287 | guc_reset_wq(guc->execbuf_client); |
1283 | * determine which case are we in, and whether we should allocate new | 1288 | guc_reset_wq(guc->preempt_client); |
1284 | * clients or just reset their workqueues. | ||
1285 | */ | ||
1286 | if (!guc->execbuf_client) { | ||
1287 | err = guc_clients_create(guc); | ||
1288 | if (err) | ||
1289 | return err; | ||
1290 | } else { | ||
1291 | guc_reset_wq(guc->execbuf_client); | ||
1292 | guc_reset_wq(guc->preempt_client); | ||
1293 | } | ||
1294 | 1289 | ||
1295 | err = intel_guc_sample_forcewake(guc); | 1290 | err = intel_guc_sample_forcewake(guc); |
1296 | if (err) | 1291 | if (err) |
1297 | goto err_free_clients; | 1292 | return err; |
1298 | 1293 | ||
1299 | err = guc_clients_doorbell_init(guc); | 1294 | err = guc_clients_doorbell_init(guc); |
1300 | if (err) | 1295 | if (err) |
1301 | goto err_free_clients; | 1296 | return err; |
1302 | 1297 | ||
1303 | /* Take over from manual control of ELSP (execlists) */ | 1298 | /* Take over from manual control of ELSP (execlists) */ |
1304 | guc_interrupts_capture(dev_priv); | 1299 | guc_interrupts_capture(dev_priv); |
@@ -1315,10 +1310,6 @@ int intel_guc_submission_enable(struct intel_guc *guc) | |||
1315 | } | 1310 | } |
1316 | 1311 | ||
1317 | return 0; | 1312 | return 0; |
1318 | |||
1319 | err_free_clients: | ||
1320 | guc_clients_destroy(guc); | ||
1321 | return err; | ||
1322 | } | 1313 | } |
1323 | 1314 | ||
1324 | void intel_guc_submission_disable(struct intel_guc *guc) | 1315 | void intel_guc_submission_disable(struct intel_guc *guc) |
@@ -1332,8 +1323,6 @@ void intel_guc_submission_disable(struct intel_guc *guc) | |||
1332 | 1323 | ||
1333 | /* Revert back to manual ELSP submission */ | 1324 | /* Revert back to manual ELSP submission */ |
1334 | intel_engines_reset_default_submission(dev_priv); | 1325 | intel_engines_reset_default_submission(dev_priv); |
1335 | |||
1336 | guc_clients_destroy(guc); | ||
1337 | } | 1326 | } |
1338 | 1327 | ||
1339 | #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST) | 1328 | #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST) |