[PATCH] drm/xe: Initialize GuC ID mgr before registering guc_submit_fini
Matthew Brost
matthew.brost at intel.com
Fri Apr 5 21:27:47 UTC 2024
It reasonable to assume that guc_submit_fini may rely on GuC ID mgr
being available. With that, register guc_submit_fini after initializing
the GuC ID mgr. This will ensure the GuC ID mgr is available in
guc_submit_fini due the reverse execution order of
drmm_add_action_or_reset.
Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
Signed-off-by: Matthew Brost <matthew.brost at intel.com>
---
drivers/gpu/drm/xe/xe_guc_submit.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index 9c30bd9ac8c0..148c5dc2c1ac 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -232,15 +232,20 @@ static struct workqueue_struct *get_submit_wq(struct xe_guc *guc)
}
#endif
-static void guc_submit_fini(struct drm_device *drm, void *arg)
+static void __guc_submit_fini(struct xe_guc *guc)
{
- struct xe_guc *guc = arg;
-
xa_destroy(&guc->submission_state.exec_queue_lookup);
free_submit_wq(guc);
mutex_destroy(&guc->submission_state.lock);
}
+static void guc_submit_fini(struct drm_device *drm, void *arg)
+{
+ struct xe_guc *guc = arg;
+
+ __guc_submit_fini(guc);
+}
+
static const struct xe_exec_queue_ops guc_exec_queue_ops;
static void primelockdep(struct xe_guc *guc)
@@ -277,11 +282,13 @@ int xe_guc_submit_init(struct xe_guc *guc)
primelockdep(guc);
- err = drmm_add_action_or_reset(&xe->drm, guc_submit_fini, guc);
- if (err)
+ err = xe_guc_id_mgr_init(&guc->submission_state.idm, ~0);
+ if (err) {
+ __guc_submit_fini(guc);
return err;
+ }
- err = xe_guc_id_mgr_init(&guc->submission_state.idm, ~0);
+ err = drmm_add_action_or_reset(&xe->drm, guc_submit_fini, guc);
if (err)
return err;
--
2.34.1
More information about the Intel-xe
mailing list